Adds generic damage visualizer to the game (#4893)
This commit is contained in:
14
Content.Shared/Damage/DamageVisualizerKeys.cs
Normal file
14
Content.Shared/Damage/DamageVisualizerKeys.cs
Normal file
@@ -0,0 +1,14 @@
|
||||
using System;
|
||||
using Robust.Shared.Serialization;
|
||||
|
||||
namespace Content.Shared.Damage
|
||||
{
|
||||
[Serializable, NetSerializable]
|
||||
public enum DamageVisualizerKeys
|
||||
{
|
||||
Disabled,
|
||||
DamageSpecifierDelta,
|
||||
DamageUpdateGroups,
|
||||
ForceUpdate
|
||||
}
|
||||
}
|
||||
@@ -83,6 +83,9 @@ namespace Content.Shared.Damage
|
||||
component.DamagePerGroup = component.Damage.GetDamagePerGroup();
|
||||
component.TotalDamage = component.Damage.Total;
|
||||
component.Dirty();
|
||||
|
||||
if (EntityManager.TryGetComponent<SharedAppearanceComponent>(component.Owner.Uid, out var appearance) && damageDelta != null)
|
||||
appearance.SetData(DamageVisualizerKeys.DamageUpdateGroups, damageDelta.GetDamagePerGroup().Keys.ToList());
|
||||
RaiseLocalEvent(component.Owner.Uid, new DamageChangedEvent(component, damageDelta), false);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user