Fix alerts mispredict + log spam (#36004)
tstalker alerted me to it and noticed the classic case of shallow copies.
This commit is contained in:
@@ -52,7 +52,7 @@ public sealed class ClientAlertsSystem : AlertsSystem
|
|||||||
if (args.Current is not AlertComponentState cast)
|
if (args.Current is not AlertComponentState cast)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
alerts.Comp.Alerts = cast.Alerts;
|
alerts.Comp.Alerts = new(cast.Alerts);
|
||||||
|
|
||||||
UpdateHud(alerts);
|
UpdateHud(alerts);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -14,6 +14,7 @@ internal sealed class ServerAlertsSystem : AlertsSystem
|
|||||||
|
|
||||||
private void OnGetState(Entity<AlertsComponent> alerts, ref ComponentGetState args)
|
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));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user