From 253972d529e0a39a66e2e8a48e84cb8ef9f03304 Mon Sep 17 00:00:00 2001 From: adrian Date: Sun, 9 Feb 2020 06:42:12 -0300 Subject: [PATCH] Fixes placing objects on closed lockers (#658) --- .../Components/Items/Storage/EntityStorageComponent.cs | 10 ++++++++-- .../Components/PlaceableSurfaceComponent.cs | 5 ++++- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/Content.Server/GameObjects/Components/Items/Storage/EntityStorageComponent.cs b/Content.Server/GameObjects/Components/Items/Storage/EntityStorageComponent.cs index e8057c2af5..77eab4ac52 100644 --- a/Content.Server/GameObjects/Components/Items/Storage/EntityStorageComponent.cs +++ b/Content.Server/GameObjects/Components/Items/Storage/EntityStorageComponent.cs @@ -1,4 +1,5 @@ -using System.Linq; +using System; +using System.Linq; using Content.Server.GameObjects.Components.Items.Storage; using Content.Server.GameObjects.Components.Sound; using Content.Server.GameObjects.EntitySystems; @@ -80,6 +81,11 @@ namespace Content.Server.GameObjects.Components if (_noDoor && !_locked) Open = true; + + if (Owner.TryGetComponent(out var placeableSurfaceComponent)) + { + placeableSurfaceComponent.IsPlaceable = Open; + } } /// @@ -147,7 +153,7 @@ namespace Content.Server.GameObjects.Components // only items that can be stored in an inventory, or a player, can be eaten by a locker if(!entity.HasComponent() && !entity.HasComponent()) continue; - + if (!AddToContents(entity)) { continue; diff --git a/Content.Server/GameObjects/Components/PlaceableSurfaceComponent.cs b/Content.Server/GameObjects/Components/PlaceableSurfaceComponent.cs index c27c5874ec..6c4cb1b619 100644 --- a/Content.Server/GameObjects/Components/PlaceableSurfaceComponent.cs +++ b/Content.Server/GameObjects/Components/PlaceableSurfaceComponent.cs @@ -20,9 +20,12 @@ namespace Content.Server.GameObjects.Components } public bool AttackBy(AttackByEventArgs eventArgs) { + if (!IsPlaceable) + return false; + if(!eventArgs.User.TryGetComponent(out var handComponent)) { - return true; + return false; } handComponent.Drop(eventArgs.AttackWith); eventArgs.AttackWith.Transform.WorldPosition = eventArgs.ClickLocation.Position;