Let stacks specify if they get thrown as one item, or individual… (#679)
This commit is contained in:
@@ -26,6 +26,7 @@ namespace Content.Server.GameObjects.Components.Stack
|
|||||||
private const string SerializationCache = "stack";
|
private const string SerializationCache = "stack";
|
||||||
private int _count = 50;
|
private int _count = 50;
|
||||||
private int _maxCount = 50;
|
private int _maxCount = 50;
|
||||||
|
private bool _throwIndividually = false;
|
||||||
|
|
||||||
[ViewVariables(VVAccess.ReadWrite)]
|
[ViewVariables(VVAccess.ReadWrite)]
|
||||||
public int Count
|
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]
|
[ViewVariables]
|
||||||
public int AvailableSpace => MaxCount - Count;
|
public int AvailableSpace => MaxCount - Count;
|
||||||
|
|
||||||
|
|||||||
@@ -175,8 +175,8 @@ namespace Content.Server.GameObjects.EntitySystems
|
|||||||
if (!handsComp.ThrowItem())
|
if (!handsComp.ThrowItem())
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
// pop off an item, or throw the single item in hand.
|
// 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)
|
if (!throwEnt.TryGetComponent(out StackComponent stackComp) || stackComp.Count < 2 || !stackComp.ThrowIndividually)
|
||||||
{
|
{
|
||||||
handsComp.Drop(handsComp.ActiveIndex);
|
handsComp.Drop(handsComp.ActiveIndex);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user