Update trivial components to use auto comp states (#20539)
This commit is contained in:
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user