Update trivial components to use auto comp states (#20539)
This commit is contained in:
@@ -1,8 +1,7 @@
|
||||
using System.Numerics;
|
||||
using Content.Shared.Storage.Components;
|
||||
using Content.Shared.Hands.EntitySystems;
|
||||
using Content.Shared.Interaction;
|
||||
using Robust.Shared.GameStates;
|
||||
using Content.Shared.Storage.Components;
|
||||
|
||||
namespace Content.Shared.Placeable
|
||||
{
|
||||
@@ -15,13 +14,6 @@ namespace Content.Shared.Placeable
|
||||
base.Initialize();
|
||||
|
||||
SubscribeLocalEvent<PlaceableSurfaceComponent, AfterInteractUsingEvent>(OnAfterInteractUsing);
|
||||
SubscribeLocalEvent<PlaceableSurfaceComponent, ComponentGetState>(OnGetState);
|
||||
SubscribeLocalEvent<PlaceableSurfaceComponent, ComponentHandleState>(OnHandleState);
|
||||
}
|
||||
|
||||
private void OnGetState(EntityUid uid, PlaceableSurfaceComponent component, ref ComponentGetState args)
|
||||
{
|
||||
args.State = new PlaceableSurfaceComponentState(component.IsPlaceable, component.PlaceCentered, component.PositionOffset);
|
||||
}
|
||||
|
||||
public void SetPlaceable(EntityUid uid, bool isPlaceable, PlaceableSurfaceComponent? surface = null)
|
||||
@@ -30,7 +22,7 @@ namespace Content.Shared.Placeable
|
||||
return;
|
||||
|
||||
surface.IsPlaceable = isPlaceable;
|
||||
Dirty(surface);
|
||||
Dirty(uid, surface);
|
||||
}
|
||||
|
||||
public void SetPlaceCentered(EntityUid uid, bool placeCentered, PlaceableSurfaceComponent? surface = null)
|
||||
@@ -39,7 +31,7 @@ namespace Content.Shared.Placeable
|
||||
return;
|
||||
|
||||
surface.PlaceCentered = placeCentered;
|
||||
Dirty(surface);
|
||||
Dirty(uid, surface);
|
||||
}
|
||||
|
||||
public void SetPositionOffset(EntityUid uid, Vector2 offset, PlaceableSurfaceComponent? surface = null)
|
||||
@@ -48,7 +40,7 @@ namespace Content.Shared.Placeable
|
||||
return;
|
||||
|
||||
surface.PositionOffset = offset;
|
||||
Dirty(surface);
|
||||
Dirty(uid, surface);
|
||||
}
|
||||
|
||||
private void OnAfterInteractUsing(EntityUid uid, PlaceableSurfaceComponent surface, AfterInteractUsingEvent args)
|
||||
@@ -74,15 +66,5 @@ namespace Content.Shared.Placeable
|
||||
|
||||
args.Handled = true;
|
||||
}
|
||||
|
||||
private void OnHandleState(EntityUid uid, PlaceableSurfaceComponent component, ref ComponentHandleState args)
|
||||
{
|
||||
if (args.Current is not PlaceableSurfaceComponentState state)
|
||||
return;
|
||||
|
||||
component.IsPlaceable = state.IsPlaceable;
|
||||
component.PlaceCentered = state.PlaceCentered;
|
||||
component.PositionOffset = state.PositionOffset;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user