Make it possible to hide full health bars below a total damage threshold (#28127)
* Make it possible to hide full health bars below a total damage threshold * Fix not setting state
This commit is contained in:
@@ -1,5 +1,4 @@
|
||||
using System.Linq;
|
||||
using Content.Shared.Administration.Logs;
|
||||
using Content.Shared.Damage.Prototypes;
|
||||
using Content.Shared.FixedPoint;
|
||||
using Content.Shared.Inventory;
|
||||
@@ -229,12 +228,12 @@ namespace Content.Shared.Damage
|
||||
{
|
||||
if (_netMan.IsServer)
|
||||
{
|
||||
args.State = new DamageableComponentState(component.Damage.DamageDict, component.DamageModifierSetId);
|
||||
args.State = new DamageableComponentState(component.Damage.DamageDict, component.DamageModifierSetId, component.HealthBarThreshold);
|
||||
}
|
||||
else
|
||||
{
|
||||
// avoid mispredicting damage on newly spawned entities.
|
||||
args.State = new DamageableComponentState(component.Damage.DamageDict.ShallowClone(), component.DamageModifierSetId);
|
||||
args.State = new DamageableComponentState(component.Damage.DamageDict.ShallowClone(), component.DamageModifierSetId, component.HealthBarThreshold);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -268,6 +267,7 @@ namespace Content.Shared.Damage
|
||||
}
|
||||
|
||||
component.DamageModifierSetId = state.ModifierSetId;
|
||||
component.HealthBarThreshold = state.HealthBarThreshold;
|
||||
|
||||
// Has the damage actually changed?
|
||||
DamageSpecifier newDamage = new() { DamageDict = new(state.DamageDict) };
|
||||
|
||||
Reference in New Issue
Block a user