Fix some mispredict reconciliation issues. (#6319)
Co-authored-by: metalgearsloth <comedian_vs_clown@hotmail.com>
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Robust.Shared.Serialization;
|
||||
|
||||
namespace Content.Shared.Damage
|
||||
@@ -11,4 +12,20 @@ namespace Content.Shared.Damage
|
||||
DamageUpdateGroups,
|
||||
ForceUpdate
|
||||
}
|
||||
|
||||
[Serializable, NetSerializable]
|
||||
public class DamageVisualizerGroupData : ICloneable
|
||||
{
|
||||
public List<string> GroupList;
|
||||
|
||||
public DamageVisualizerGroupData(List<string> groupList)
|
||||
{
|
||||
GroupList = groupList;
|
||||
}
|
||||
|
||||
public object Clone()
|
||||
{
|
||||
return new DamageVisualizerGroupData(new List<string>(GroupList));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -87,7 +87,10 @@ namespace Content.Shared.Damage
|
||||
component.Dirty();
|
||||
|
||||
if (EntityManager.TryGetComponent<AppearanceComponent>(component.Owner, out var appearance) && damageDelta != null)
|
||||
appearance.SetData(DamageVisualizerKeys.DamageUpdateGroups, damageDelta.GetDamagePerGroup().Keys.ToList());
|
||||
{
|
||||
var data = new DamageVisualizerGroupData(damageDelta.GetDamagePerGroup().Keys.ToList());
|
||||
appearance.SetData(DamageVisualizerKeys.DamageUpdateGroups, data);
|
||||
}
|
||||
RaiseLocalEvent(component.Owner, new DamageChangedEvent(component, damageDelta, interruptsDoAfters), false);
|
||||
}
|
||||
|
||||
@@ -198,7 +201,7 @@ namespace Content.Shared.Damage
|
||||
component.DamageModifierSetId = state.ModifierSetId;
|
||||
|
||||
// Has the damage actually changed?
|
||||
DamageSpecifier newDamage = new() { DamageDict = state.DamageDict };
|
||||
DamageSpecifier newDamage = new() { DamageDict = new(state.DamageDict) };
|
||||
var delta = component.Damage - newDamage;
|
||||
delta.TrimZeros();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user