Update trivial components to use auto comp states (#20539)

This commit is contained in:
DrSmugleaf
2023-09-28 16:20:29 -07:00
committed by GitHub
parent 14cfe44ece
commit a44fa86b68
158 changed files with 806 additions and 2866 deletions

View File

@@ -1,6 +1,5 @@
using System.Linq;
using Content.Shared.BarSign;
using Robust.Shared.GameStates;
using Robust.Shared.Prototypes;
using Robust.Shared.Random;
@@ -15,17 +14,11 @@ namespace Content.Server.BarSign.Systems
public override void Initialize()
{
SubscribeLocalEvent<BarSignComponent, MapInitEvent>(OnMapInit);
SubscribeLocalEvent<BarSignComponent, ComponentGetState>(OnGetState);
}
private void OnGetState(EntityUid uid, BarSignComponent component, ref ComponentGetState args)
{
args.State = new BarSignComponentState(component.CurrentSign);
}
private void OnMapInit(EntityUid uid, BarSignComponent component, MapInitEvent args)
{
if (component.CurrentSign != null)
if (component.Current != null)
return;
var prototypes = _prototypeManager
@@ -40,7 +33,7 @@ namespace Content.Server.BarSign.Systems
_metaData.SetEntityName(uid, Loc.GetString(name), meta);
_metaData.SetEntityDescription(uid, Loc.GetString(newPrototype.Description), meta);
component.CurrentSign = newPrototype.ID;
component.Current = newPrototype.ID;
Dirty(component);
}
}