Magboots ECS and Cleanup (#9245)
Co-authored-by: metalgearsloth <31366439+metalgearsloth@users.noreply.github.com>
This commit is contained in:
@@ -1,21 +0,0 @@
|
||||
using Content.Shared.Clothing;
|
||||
using Robust.Shared.GameObjects;
|
||||
|
||||
namespace Content.Client.Clothing
|
||||
{
|
||||
[RegisterComponent]
|
||||
[ComponentReference(typeof(SharedMagbootsComponent))]
|
||||
public sealed class MagbootsComponent : SharedMagbootsComponent
|
||||
{
|
||||
public override bool On { get; set; }
|
||||
|
||||
public override void HandleComponentState(ComponentState? curState, ComponentState? nextState)
|
||||
{
|
||||
if (curState is not MagbootsComponentState compState)
|
||||
return;
|
||||
|
||||
On = compState.On;
|
||||
OnChanged();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,8 +1,27 @@
|
||||
using Content.Shared.Clothing;
|
||||
using Content.Shared.Clothing;
|
||||
using Robust.Shared.GameStates;
|
||||
using static Content.Shared.Clothing.MagbootsComponent;
|
||||
|
||||
namespace Content.Client.Clothing
|
||||
namespace Content.Client.Clothing;
|
||||
|
||||
public sealed class MagbootsSystem : SharedMagbootsSystem
|
||||
{
|
||||
public sealed class MagbootsSystem : SharedMagbootsSystem
|
||||
public override void Initialize()
|
||||
{
|
||||
base.Initialize();
|
||||
|
||||
SubscribeLocalEvent<MagbootsComponent, ComponentHandleState>(OnHandleState);
|
||||
}
|
||||
|
||||
private void OnHandleState(EntityUid uid, MagbootsComponent component, ref ComponentHandleState args)
|
||||
{
|
||||
if (args.Current is not MagbootsComponentState componentState)
|
||||
return;
|
||||
|
||||
if (component.On == componentState.On) return;
|
||||
|
||||
component.On = componentState.On;
|
||||
OnChanged(component);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user