Fix StackComponent not getting removed from containers when empty (#1645)
This commit is contained in:
@@ -50,9 +50,6 @@ namespace Content.Server.GameObjects.Components.Items
|
|||||||
var desiredTile = _tileDefinitionManager[_outputTile];
|
var desiredTile = _tileDefinitionManager[_outputTile];
|
||||||
mapGrid.SetTile(eventArgs.ClickLocation, new Tile(desiredTile.TileId));
|
mapGrid.SetTile(eventArgs.ClickLocation, new Tile(desiredTile.TileId));
|
||||||
EntitySystem.Get<AudioSystem>().PlayAtCoords("/Audio/Items/genhit.ogg", eventArgs.ClickLocation);
|
EntitySystem.Get<AudioSystem>().PlayAtCoords("/Audio/Items/genhit.ogg", eventArgs.ClickLocation);
|
||||||
if(_stack.Count < 1){
|
|
||||||
Owner.Delete();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -28,15 +28,7 @@ namespace Content.Server.GameObjects.Components.Stack
|
|||||||
public override int Count
|
public override int Count
|
||||||
{
|
{
|
||||||
get => base.Count;
|
get => base.Count;
|
||||||
set
|
set => base.Count = value;
|
||||||
{
|
|
||||||
base.Count = value;
|
|
||||||
|
|
||||||
if (Count <= 0)
|
|
||||||
{
|
|
||||||
Owner.Delete();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
[ViewVariables(VVAccess.ReadWrite)]
|
[ViewVariables(VVAccess.ReadWrite)]
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
using System;
|
using System;
|
||||||
|
using Robust.Shared.Containers;
|
||||||
using Robust.Shared.GameObjects;
|
using Robust.Shared.GameObjects;
|
||||||
using Robust.Shared.Interfaces.Reflection;
|
using Robust.Shared.Interfaces.Reflection;
|
||||||
using Robust.Shared.IoC;
|
using Robust.Shared.IoC;
|
||||||
@@ -26,6 +27,10 @@ namespace Content.Shared.GameObjects.Components
|
|||||||
_count = value;
|
_count = value;
|
||||||
if (_count <= 0)
|
if (_count <= 0)
|
||||||
{
|
{
|
||||||
|
if (ContainerHelpers.TryGetContainerMan(Owner, out var containerManager))
|
||||||
|
{
|
||||||
|
containerManager.Remove(Owner);
|
||||||
|
}
|
||||||
Owner.Delete();
|
Owner.Delete();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user