From d16c299af1befcc0c1236609222786626dadb86f Mon Sep 17 00:00:00 2001 From: Vera Aguilera Puerto Date: Wed, 6 Oct 2021 11:40:05 +0200 Subject: [PATCH] PlaceableSurfaceSystem uses resolves. --- .../Storage/Components/EntityStorageComponent.cs | 4 ++-- .../Placeable/PlaceableSurfaceSystem.cs | 15 ++++++++++++--- 2 files changed, 14 insertions(+), 5 deletions(-) diff --git a/Content.Server/Storage/Components/EntityStorageComponent.cs b/Content.Server/Storage/Components/EntityStorageComponent.cs index ecb8da9c18..1cb0066d88 100644 --- a/Content.Server/Storage/Components/EntityStorageComponent.cs +++ b/Content.Server/Storage/Components/EntityStorageComponent.cs @@ -148,7 +148,7 @@ namespace Content.Server.Storage.Components if (Owner.TryGetComponent(out var surface)) { - EntitySystem.Get().SetPlaceable(surface, Open); + EntitySystem.Get().SetPlaceable(Owner.Uid, Open, surface); } UpdateAppearance(); @@ -264,7 +264,7 @@ namespace Content.Server.Storage.Components if (Owner.TryGetComponent(out var surface)) { - EntitySystem.Get().SetPlaceable(surface, Open); + EntitySystem.Get().SetPlaceable(Owner.Uid, Open, surface); } if (Owner.TryGetComponent(out AppearanceComponent? appearance)) diff --git a/Content.Shared/Placeable/PlaceableSurfaceSystem.cs b/Content.Shared/Placeable/PlaceableSurfaceSystem.cs index 7a683c03b5..8c49272653 100644 --- a/Content.Shared/Placeable/PlaceableSurfaceSystem.cs +++ b/Content.Shared/Placeable/PlaceableSurfaceSystem.cs @@ -16,20 +16,29 @@ namespace Content.Shared.Placeable SubscribeLocalEvent(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.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.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.Dirty(); }