Wires are now broken in explosions, and drop cables.

Using the wire cutters on a wire drops a cable.
Fix bug where bullets raise an exception when the hit object deletes itself.
This commit is contained in:
Acruid
2019-12-15 19:58:24 -08:00
parent e0cf442041
commit 72cff220cf
3 changed files with 10 additions and 1 deletions

View File

@@ -1,5 +1,6 @@
using System.Linq;
using Content.Server.GameObjects.Components.Interactable.Tools;
using Content.Server.GameObjects.Components.Stack;
using Content.Server.GameObjects.EntitySystems;
using Robust.Server.Interfaces.GameObjects;
using Robust.Shared.GameObjects;
@@ -137,6 +138,11 @@ namespace Content.Server.GameObjects.Components.Power
if (eventArgs.AttackWith.TryGetComponent(out WirecutterComponent wirecutter))
{
Owner.Delete();
var droppedEnt = Owner.EntityManager.SpawnEntityAt("CableStack", eventArgs.ClickLocation);
if (droppedEnt.TryGetComponent<StackComponent>(out var stackComp))
stackComp.Count = 1;
return true;
}
return false;