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

View File

@@ -77,7 +77,7 @@ namespace Content.Server.GameObjects.Components.Projectiles
} }
} }
if (entity.TryGetComponent(out CameraRecoilComponent recoilComponent) if (!entity.Deleted && entity.TryGetComponent(out CameraRecoilComponent recoilComponent)
&& Owner.TryGetComponent(out PhysicsComponent physicsComponent)) && Owner.TryGetComponent(out PhysicsComponent physicsComponent))
{ {
var direction = physicsComponent.LinearVelocity.Normalized; var direction = physicsComponent.LinearVelocity.Normalized;

View File

@@ -22,6 +22,9 @@
key: power_cables key: power_cables
mode: CardinalFlags mode: CardinalFlags
- type: SubFloorHide - type: SubFloorHide
- type: Destructible
thresholdvalue: 100
spawnondestroy: CableStack
snap: snap:
- Wire - Wire