Add layers field to construction prototype (#14222)
This commit is contained in:
@@ -1,4 +1,5 @@
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
using Content.Shared.Construction;
|
using Content.Shared.Construction;
|
||||||
using Content.Shared.Construction.Prototypes;
|
using Content.Shared.Construction.Prototypes;
|
||||||
using Robust.Client.Graphics;
|
using Robust.Client.Graphics;
|
||||||
@@ -49,16 +50,7 @@ namespace Content.Client.Construction
|
|||||||
public override void StartHijack(PlacementManager manager)
|
public override void StartHijack(PlacementManager manager)
|
||||||
{
|
{
|
||||||
base.StartHijack(manager);
|
base.StartHijack(manager);
|
||||||
|
manager.CurrentTextures = _prototype?.Layers.Select(sprite => sprite.DirFrame0()).ToList();
|
||||||
var frame = _prototype?.Icon.DirFrame0();
|
|
||||||
if (frame == null)
|
|
||||||
{
|
|
||||||
manager.CurrentTextures = null;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
manager.CurrentTextures = new List<IDirectionalTextureProvider> {frame};
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -179,10 +179,14 @@ namespace Content.Client.Construction
|
|||||||
_ghosts.Add(comp.GhostId, comp);
|
_ghosts.Add(comp.GhostId, comp);
|
||||||
var sprite = EntityManager.GetComponent<SpriteComponent>(ghost);
|
var sprite = EntityManager.GetComponent<SpriteComponent>(ghost);
|
||||||
sprite.Color = new Color(48, 255, 48, 128);
|
sprite.Color = new Color(48, 255, 48, 128);
|
||||||
sprite.AddBlankLayer(0); // There is no way to actually check if this already exists, so we blindly insert a new one
|
|
||||||
sprite.LayerSetSprite(0, prototype.Icon);
|
for (int i = 0; i < prototype.Layers.Count; i++)
|
||||||
sprite.LayerSetShader(0, "unshaded");
|
{
|
||||||
sprite.LayerSetVisible(0, true);
|
sprite.AddBlankLayer(i); // There is no way to actually check if this already exists, so we blindly insert a new one
|
||||||
|
sprite.LayerSetSprite(i, prototype.Layers[i]);
|
||||||
|
sprite.LayerSetShader(i, "unshaded");
|
||||||
|
sprite.LayerSetVisible(i, true);
|
||||||
|
}
|
||||||
|
|
||||||
if (prototype.CanBuildInImpassable)
|
if (prototype.CanBuildInImpassable)
|
||||||
EnsureComp<WallMountComponent>(ghost).Arc = new(Math.Tau);
|
EnsureComp<WallMountComponent>(ghost).Arc = new(Math.Tau);
|
||||||
|
|||||||
@@ -46,6 +46,12 @@ namespace Content.Shared.Construction.Prototypes
|
|||||||
[DataField("icon")]
|
[DataField("icon")]
|
||||||
public SpriteSpecifier Icon { get; } = SpriteSpecifier.Invalid;
|
public SpriteSpecifier Icon { get; } = SpriteSpecifier.Invalid;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Texture paths used for the construction ghost.
|
||||||
|
/// </summary>
|
||||||
|
[DataField("layers")]
|
||||||
|
private List<SpriteSpecifier>? _layers;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// If you can start building or complete steps on impassable terrain.
|
/// If you can start building or complete steps on impassable terrain.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -70,6 +76,7 @@ namespace Content.Shared.Construction.Prototypes
|
|||||||
public bool CanRotate { get; } = true;
|
public bool CanRotate { get; } = true;
|
||||||
|
|
||||||
public IReadOnlyList<IConstructionCondition> Conditions => _conditions;
|
public IReadOnlyList<IConstructionCondition> Conditions => _conditions;
|
||||||
|
public IReadOnlyList<SpriteSpecifier> Layers => _layers ?? new List<SpriteSpecifier>{Icon};
|
||||||
}
|
}
|
||||||
|
|
||||||
public enum ConstructionType
|
public enum ConstructionType
|
||||||
|
|||||||
@@ -391,6 +391,11 @@
|
|||||||
icon:
|
icon:
|
||||||
sprite: Structures/Piping/Atmospherics/vent.rsi
|
sprite: Structures/Piping/Atmospherics/vent.rsi
|
||||||
state: vent_off
|
state: vent_off
|
||||||
|
layers:
|
||||||
|
- sprite: Structures/Piping/Atmospherics/pipe.rsi
|
||||||
|
state: pipeHalf
|
||||||
|
- sprite: Structures/Piping/Atmospherics/vent.rsi
|
||||||
|
state: vent_off
|
||||||
conditions:
|
conditions:
|
||||||
- !type:TileNotBlocked {}
|
- !type:TileNotBlocked {}
|
||||||
|
|
||||||
@@ -407,6 +412,11 @@
|
|||||||
icon:
|
icon:
|
||||||
sprite: Structures/Piping/Atmospherics/vent.rsi
|
sprite: Structures/Piping/Atmospherics/vent.rsi
|
||||||
state: vent_off
|
state: vent_off
|
||||||
|
layers:
|
||||||
|
- sprite: Structures/Piping/Atmospherics/pipe.rsi
|
||||||
|
state: pipeHalf
|
||||||
|
- sprite: Structures/Piping/Atmospherics/vent.rsi
|
||||||
|
state: vent_off
|
||||||
conditions:
|
conditions:
|
||||||
- !type:TileNotBlocked {}
|
- !type:TileNotBlocked {}
|
||||||
|
|
||||||
@@ -423,6 +433,11 @@
|
|||||||
icon:
|
icon:
|
||||||
sprite: Structures/Piping/Atmospherics/scrubber.rsi
|
sprite: Structures/Piping/Atmospherics/scrubber.rsi
|
||||||
state: scrub_off
|
state: scrub_off
|
||||||
|
layers:
|
||||||
|
- sprite: Structures/Piping/Atmospherics/pipe.rsi
|
||||||
|
state: pipeHalf
|
||||||
|
- sprite: Structures/Piping/Atmospherics/scrubber.rsi
|
||||||
|
state: scrub_off
|
||||||
conditions:
|
conditions:
|
||||||
- !type:TileNotBlocked {}
|
- !type:TileNotBlocked {}
|
||||||
|
|
||||||
@@ -439,6 +454,11 @@
|
|||||||
icon:
|
icon:
|
||||||
sprite: Structures/Piping/Atmospherics/outletinjector.rsi
|
sprite: Structures/Piping/Atmospherics/outletinjector.rsi
|
||||||
state: injector
|
state: injector
|
||||||
|
layers:
|
||||||
|
- sprite: Structures/Piping/Atmospherics/pipe.rsi
|
||||||
|
state: pipeHalf
|
||||||
|
- sprite: Structures/Piping/Atmospherics/outletinjector.rsi
|
||||||
|
state: injector
|
||||||
conditions:
|
conditions:
|
||||||
- !type:TileNotBlocked {}
|
- !type:TileNotBlocked {}
|
||||||
|
|
||||||
@@ -456,6 +476,11 @@
|
|||||||
icon:
|
icon:
|
||||||
sprite: Structures/Piping/Atmospherics/pump.rsi
|
sprite: Structures/Piping/Atmospherics/pump.rsi
|
||||||
state: pumpPressure
|
state: pumpPressure
|
||||||
|
layers:
|
||||||
|
- sprite: Structures/Piping/Atmospherics/pipe.rsi
|
||||||
|
state: pipeStraight
|
||||||
|
- sprite: Structures/Piping/Atmospherics/pump.rsi
|
||||||
|
state: pumpPressure
|
||||||
conditions:
|
conditions:
|
||||||
- !type:TileNotBlocked {}
|
- !type:TileNotBlocked {}
|
||||||
|
|
||||||
@@ -472,6 +497,11 @@
|
|||||||
icon:
|
icon:
|
||||||
sprite: Structures/Piping/Atmospherics/pump.rsi
|
sprite: Structures/Piping/Atmospherics/pump.rsi
|
||||||
state: pumpVolume
|
state: pumpVolume
|
||||||
|
layers:
|
||||||
|
- sprite: Structures/Piping/Atmospherics/pipe.rsi
|
||||||
|
state: pipeStraight
|
||||||
|
- sprite: Structures/Piping/Atmospherics/pump.rsi
|
||||||
|
state: pumpVolume
|
||||||
conditions:
|
conditions:
|
||||||
- !type:TileNotBlocked {}
|
- !type:TileNotBlocked {}
|
||||||
|
|
||||||
@@ -488,6 +518,11 @@
|
|||||||
icon:
|
icon:
|
||||||
sprite: Structures/Piping/Atmospherics/pump.rsi
|
sprite: Structures/Piping/Atmospherics/pump.rsi
|
||||||
state: pumpPassiveGate
|
state: pumpPassiveGate
|
||||||
|
layers:
|
||||||
|
- sprite: Structures/Piping/Atmospherics/pipe.rsi
|
||||||
|
state: pipeStraight
|
||||||
|
- sprite: Structures/Piping/Atmospherics/pump.rsi
|
||||||
|
state: pumpPassiveGate
|
||||||
conditions:
|
conditions:
|
||||||
- !type:TileNotBlocked {}
|
- !type:TileNotBlocked {}
|
||||||
|
|
||||||
@@ -504,6 +539,11 @@
|
|||||||
icon:
|
icon:
|
||||||
sprite: Structures/Piping/Atmospherics/pump.rsi
|
sprite: Structures/Piping/Atmospherics/pump.rsi
|
||||||
state: pumpManualValve
|
state: pumpManualValve
|
||||||
|
layers:
|
||||||
|
- sprite: Structures/Piping/Atmospherics/pipe.rsi
|
||||||
|
state: pipeStraight
|
||||||
|
- sprite: Structures/Piping/Atmospherics/pump.rsi
|
||||||
|
state: pumpManualValve
|
||||||
conditions:
|
conditions:
|
||||||
- !type:TileNotBlocked {}
|
- !type:TileNotBlocked {}
|
||||||
|
|
||||||
@@ -520,6 +560,11 @@
|
|||||||
icon:
|
icon:
|
||||||
sprite: Structures/Piping/Atmospherics/gascanisterport.rsi
|
sprite: Structures/Piping/Atmospherics/gascanisterport.rsi
|
||||||
state: gasCanisterPort
|
state: gasCanisterPort
|
||||||
|
layers:
|
||||||
|
- sprite: Structures/Piping/Atmospherics/pipe.rsi
|
||||||
|
state: pipeHalf
|
||||||
|
- sprite: Structures/Piping/Atmospherics/gascanisterport.rsi
|
||||||
|
state: gasCanisterPort
|
||||||
conditions:
|
conditions:
|
||||||
- !type:TileNotBlocked {}
|
- !type:TileNotBlocked {}
|
||||||
|
|
||||||
@@ -536,6 +581,11 @@
|
|||||||
icon:
|
icon:
|
||||||
sprite: Structures/Piping/Atmospherics/vent.rsi
|
sprite: Structures/Piping/Atmospherics/vent.rsi
|
||||||
state: vent_off
|
state: vent_off
|
||||||
|
layers:
|
||||||
|
- sprite: Structures/Piping/Atmospherics/pipe.rsi
|
||||||
|
state: pipeStraight
|
||||||
|
- sprite: Structures/Piping/Atmospherics/vent.rsi
|
||||||
|
state: vent_off
|
||||||
conditions:
|
conditions:
|
||||||
- !type:TileNotBlocked {}
|
- !type:TileNotBlocked {}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user