Expend cables when placing them (#547)
This commit is contained in:
committed by
Pieter-Jan Briers
parent
fd759e4a9d
commit
7bf06a59d4
@@ -1,4 +1,5 @@
|
|||||||
using Content.Server.GameObjects.EntitySystems;
|
using Content.Server.GameObjects.Components.Stack;
|
||||||
|
using Content.Server.GameObjects.EntitySystems;
|
||||||
using Robust.Server.GameObjects;
|
using Robust.Server.GameObjects;
|
||||||
using Robust.Server.Interfaces.GameObjects;
|
using Robust.Server.Interfaces.GameObjects;
|
||||||
using Robust.Shared.GameObjects;
|
using Robust.Shared.GameObjects;
|
||||||
@@ -44,9 +45,13 @@ namespace Content.Server.GameObjects.Components.Power
|
|||||||
if (found)
|
if (found)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
bool hasItemSpriteComp = Owner.TryGetComponent(out SpriteComponent itemSpriteComp);
|
||||||
|
|
||||||
|
if (Owner.TryGetComponent(out StackComponent stack) && !stack.Use(1))
|
||||||
|
return;
|
||||||
|
|
||||||
var newWire = _entityManager.SpawnEntityAt("Wire", grid.GridTileToLocal(snapPos));
|
var newWire = _entityManager.SpawnEntityAt("Wire", grid.GridTileToLocal(snapPos));
|
||||||
if (newWire.TryGetComponent(out SpriteComponent wireSpriteComp)
|
if (newWire.TryGetComponent(out SpriteComponent wireSpriteComp) && hasItemSpriteComp)
|
||||||
&& Owner.TryGetComponent(out SpriteComponent itemSpriteComp))
|
|
||||||
{
|
{
|
||||||
wireSpriteComp.Color = itemSpriteComp.Color;
|
wireSpriteComp.Color = itemSpriteComp.Color;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user