Fix alerts mispredict + log spam (#36004)
tstalker alerted me to it and noticed the classic case of shallow copies.
This commit is contained in:
parent
40cb76facb
commit
87ccd79770
|
|
@ -52,7 +52,7 @@ public sealed class ClientAlertsSystem : AlertsSystem
|
|||
if (args.Current is not AlertComponentState cast)
|
||||
return;
|
||||
|
||||
alerts.Comp.Alerts = cast.Alerts;
|
||||
alerts.Comp.Alerts = new(cast.Alerts);
|
||||
|
||||
UpdateHud(alerts);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -14,6 +14,7 @@ internal sealed class ServerAlertsSystem : AlertsSystem
|
|||
|
||||
private void OnGetState(Entity<AlertsComponent> alerts, ref ComponentGetState args)
|
||||
{
|
||||
args.State = new AlertComponentState(alerts.Comp.Alerts);
|
||||
// TODO: Use sourcegen when clone-state bug fixed.
|
||||
args.State = new AlertComponentState(new(alerts.Comp.Alerts));
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue