Fix magboot mispredict (#7385)

This commit is contained in:
Leon Friedrich
2022-04-02 16:08:39 +13:00
committed by GitHub
parent 37ccf590d6
commit 971eb5b87e
3 changed files with 27 additions and 30 deletions

View File

@@ -48,7 +48,9 @@ namespace Content.Shared.StatusEffect
private void OnGetState(EntityUid uid, StatusEffectsComponent component, ref ComponentGetState args)
{
args.State = new StatusEffectsComponentState(component.ActiveEffects, component.AllowedEffects);
// Using new(...) To avoid mispredictions due to MergeImplicitData. This will mean the server-side code is
// slightly slower, and really this function should just be overridden by the client...
args.State = new StatusEffectsComponentState(new(component.ActiveEffects), new(component.AllowedEffects));
}
private void OnHandleState(EntityUid uid, StatusEffectsComponent component, ref ComponentHandleState args)
@@ -77,8 +79,8 @@ namespace Content.Shared.StatusEffect
}
var time = effect.Value.Cooldown.Item2 - effect.Value.Cooldown.Item1;
//TODO: Not sure how to handle refresh here.
TryAddStatusEffect(uid, effect.Key, time, true);
TryAddStatusEffect(uid, effect.Key, time, true, component);
}
}