From 9e368b336fab246890c532b66387c53584522d70 Mon Sep 17 00:00:00 2001 From: Profane McBane Date: Thu, 13 Feb 2020 22:43:02 +0000 Subject: [PATCH] =?UTF-8?q?Let=20stacks=20specify=20if=20they=20get=20thro?= =?UTF-8?q?wn=20as=20one=20item,=20or=20individual=E2=80=A6=20(#679)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../GameObjects/Components/Stack/StackComponent.cs | 12 ++++++++++++ .../GameObjects/EntitySystems/HandsSystem.cs | 4 ++-- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/Content.Server/GameObjects/Components/Stack/StackComponent.cs b/Content.Server/GameObjects/Components/Stack/StackComponent.cs index 50d529998d..9aaa605f1c 100644 --- a/Content.Server/GameObjects/Components/Stack/StackComponent.cs +++ b/Content.Server/GameObjects/Components/Stack/StackComponent.cs @@ -26,6 +26,7 @@ namespace Content.Server.GameObjects.Components.Stack private const string SerializationCache = "stack"; private int _count = 50; private int _maxCount = 50; + private bool _throwIndividually = false; [ViewVariables(VVAccess.ReadWrite)] public int Count @@ -53,6 +54,17 @@ namespace Content.Server.GameObjects.Components.Stack } } + [ViewVariables(VVAccess.ReadWrite)] + public bool ThrowIndividually + { + get => _throwIndividually; + private set + { + _throwIndividually = value; + Dirty(); + } + } + [ViewVariables] public int AvailableSpace => MaxCount - Count; diff --git a/Content.Server/GameObjects/EntitySystems/HandsSystem.cs b/Content.Server/GameObjects/EntitySystems/HandsSystem.cs index 47687fc712..3c21da0487 100644 --- a/Content.Server/GameObjects/EntitySystems/HandsSystem.cs +++ b/Content.Server/GameObjects/EntitySystems/HandsSystem.cs @@ -175,8 +175,8 @@ namespace Content.Server.GameObjects.EntitySystems if (!handsComp.ThrowItem()) return false; - // pop off an item, or throw the single item in hand. - if (!throwEnt.TryGetComponent(out StackComponent stackComp) || stackComp.Count < 2) + // throw the item, split off from a stack if it's meant to be thrown individually + if (!throwEnt.TryGetComponent(out StackComponent stackComp) || stackComp.Count < 2 || !stackComp.ThrowIndividually) { handsComp.Drop(handsComp.ActiveIndex); }