PlaceableSurfaceSystem uses resolves.

This commit is contained in:
Vera Aguilera Puerto
2021-10-06 11:40:05 +02:00
parent 6f50dd2f7b
commit d16c299af1
2 changed files with 14 additions and 5 deletions

View File

@@ -148,7 +148,7 @@ namespace Content.Server.Storage.Components
if (Owner.TryGetComponent<PlaceableSurfaceComponent>(out var surface)) if (Owner.TryGetComponent<PlaceableSurfaceComponent>(out var surface))
{ {
EntitySystem.Get<PlaceableSurfaceSystem>().SetPlaceable(surface, Open); EntitySystem.Get<PlaceableSurfaceSystem>().SetPlaceable(Owner.Uid, Open, surface);
} }
UpdateAppearance(); UpdateAppearance();
@@ -264,7 +264,7 @@ namespace Content.Server.Storage.Components
if (Owner.TryGetComponent<PlaceableSurfaceComponent>(out var surface)) if (Owner.TryGetComponent<PlaceableSurfaceComponent>(out var surface))
{ {
EntitySystem.Get<PlaceableSurfaceSystem>().SetPlaceable(surface, Open); EntitySystem.Get<PlaceableSurfaceSystem>().SetPlaceable(Owner.Uid, Open, surface);
} }
if (Owner.TryGetComponent(out AppearanceComponent? appearance)) if (Owner.TryGetComponent(out AppearanceComponent? appearance))

View File

@@ -16,20 +16,29 @@ namespace Content.Shared.Placeable
SubscribeLocalEvent<PlaceableSurfaceComponent, ComponentHandleState>(OnHandleState); SubscribeLocalEvent<PlaceableSurfaceComponent, ComponentHandleState>(OnHandleState);
} }
public void SetPlaceable(PlaceableSurfaceComponent surface, bool isPlaceable) public void SetPlaceable(EntityUid uid, bool isPlaceable, PlaceableSurfaceComponent? surface = null)
{ {
if (!Resolve(uid, ref surface))
return;
surface.IsPlaceable = isPlaceable; surface.IsPlaceable = isPlaceable;
surface.Dirty(); surface.Dirty();
} }
public void SetPlaceCentered(PlaceableSurfaceComponent surface, bool placeCentered) public void SetPlaceCentered(EntityUid uid, bool placeCentered, PlaceableSurfaceComponent? surface = null)
{ {
if (!Resolve(uid, ref surface))
return;
surface.PlaceCentered = placeCentered; surface.PlaceCentered = placeCentered;
surface.Dirty(); surface.Dirty();
} }
public void SetPositionOffset(PlaceableSurfaceComponent surface, Vector2 offset) public void SetPositionOffset(EntityUid uid, Vector2 offset, PlaceableSurfaceComponent? surface = null)
{ {
if (!Resolve(uid, ref surface))
return;
surface.PositionOffset = offset; surface.PositionOffset = offset;
surface.Dirty(); surface.Dirty();
} }