Fishy swarmers: Carp content and Space Dragon! (#7395)
Co-authored-by: mirrorcult <lunarautomaton6@gmail.com> Co-authored-by: metalgearsloth <comedian_vs_clown@hotmail.com> Co-authored-by: metalgearsloth <31366439+metalgearsloth@users.noreply.github.com>
This commit is contained in:
57
Content.Client/MobState/DamageStateVisualizerSystem.cs
Normal file
57
Content.Client/MobState/DamageStateVisualizerSystem.cs
Normal file
@@ -0,0 +1,57 @@
|
||||
using Content.Shared.MobState;
|
||||
using Robust.Client.GameObjects;
|
||||
using DrawDepth = Content.Shared.DrawDepth.DrawDepth;
|
||||
|
||||
namespace Content.Client.MobState;
|
||||
|
||||
public sealed class DamageStateVisualizerSystem : VisualizerSystem<DamageStateVisualsComponent>
|
||||
{
|
||||
protected override void OnAppearanceChange(EntityUid uid, DamageStateVisualsComponent component, ref AppearanceChangeEvent args)
|
||||
{
|
||||
var sprite = args.Sprite;
|
||||
|
||||
if (sprite == null || !args.Component.TryGetData(DamageStateVisuals.State, out DamageState data))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (!component.States.TryGetValue(data, out var layers))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (component.Rotate)
|
||||
{
|
||||
sprite.NoRotation = data switch
|
||||
{
|
||||
DamageState.Critical => false,
|
||||
DamageState.Dead => false,
|
||||
_ => true
|
||||
};
|
||||
}
|
||||
|
||||
// Brain no worky rn so this was just easier.
|
||||
foreach (var layer in sprite.AllLayers)
|
||||
{
|
||||
layer.Visible = false;
|
||||
}
|
||||
|
||||
foreach (var (key, state) in layers)
|
||||
{
|
||||
sprite.LayerSetVisible(key, true);
|
||||
sprite.LayerSetState(key, state);
|
||||
}
|
||||
|
||||
// So they don't draw over mobs anymore
|
||||
if (data == DamageState.Dead && sprite.DrawDepth > (int) DrawDepth.Items)
|
||||
{
|
||||
component.OriginalDrawDepth = sprite.DrawDepth;
|
||||
sprite.DrawDepth = (int) DrawDepth.Items;
|
||||
}
|
||||
else if (component.OriginalDrawDepth != null)
|
||||
{
|
||||
sprite.DrawDepth = component.OriginalDrawDepth.Value;
|
||||
component. OriginalDrawDepth = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user