allow grilles to be placed on lattice (#17073)
* allow grilles to be placed on lattice * Revert "allow grilles to be placed on lattice" This reverts commit 5c536686cdcd85d49681f934d9abaf69076e2bc2. * allow grilles to be placed on lattice (fixed) * file namespace
This commit is contained in:
@@ -2,31 +2,43 @@ using Content.Shared.Maps;
|
|||||||
using JetBrains.Annotations;
|
using JetBrains.Annotations;
|
||||||
using Robust.Shared.Map;
|
using Robust.Shared.Map;
|
||||||
|
|
||||||
namespace Content.Shared.Construction.Conditions
|
namespace Content.Shared.Construction.Conditions;
|
||||||
|
|
||||||
|
[UsedImplicitly]
|
||||||
|
[DataDefinition]
|
||||||
|
public sealed class TileNotBlocked : IConstructionCondition
|
||||||
{
|
{
|
||||||
[UsedImplicitly]
|
[DataField("filterMobs")] private bool _filterMobs = false;
|
||||||
[DataDefinition]
|
[DataField("failIfSpace")] private bool _failIfSpace = true;
|
||||||
public sealed class TileNotBlocked : IConstructionCondition
|
[DataField("failIfNotSturdy")] private bool _failIfNotSturdy = true;
|
||||||
|
|
||||||
|
public bool Condition(EntityUid user, EntityCoordinates location, Direction direction)
|
||||||
{
|
{
|
||||||
[DataField("filterMobs")] private bool _filterMobs = false;
|
var tileRef = location.GetTileRef();
|
||||||
[DataField("failIfSpace")] private bool _failIfSpace = true;
|
|
||||||
|
|
||||||
public bool Condition(EntityUid user, EntityCoordinates location, Direction direction)
|
if (tileRef == null)
|
||||||
{
|
{
|
||||||
var tileRef = location.GetTileRef();
|
return false;
|
||||||
|
|
||||||
if (tileRef == null || tileRef.Value.IsSpace())
|
|
||||||
return !_failIfSpace;
|
|
||||||
|
|
||||||
return !tileRef.Value.IsBlockedTurf(_filterMobs);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public ConstructionGuideEntry GenerateGuideEntry()
|
if (tileRef.Value.IsSpace() && _failIfSpace)
|
||||||
{
|
{
|
||||||
return new ConstructionGuideEntry
|
return false;
|
||||||
{
|
|
||||||
Localization = "construction-step-condition-tile-not-blocked",
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!tileRef.Value.GetContentTileDefinition().Sturdy && _failIfNotSturdy)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return !tileRef.Value.IsBlockedTurf(_filterMobs);
|
||||||
|
}
|
||||||
|
|
||||||
|
public ConstructionGuideEntry GenerateGuideEntry()
|
||||||
|
{
|
||||||
|
return new ConstructionGuideEntry
|
||||||
|
{
|
||||||
|
Localization = "construction-step-condition-tile-not-blocked",
|
||||||
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -224,6 +224,7 @@
|
|||||||
description: A flimsy framework of iron rods.
|
description: A flimsy framework of iron rods.
|
||||||
conditions:
|
conditions:
|
||||||
- !type:TileNotBlocked
|
- !type:TileNotBlocked
|
||||||
|
failIfSpace: false
|
||||||
icon:
|
icon:
|
||||||
sprite: Structures/Walls/grille.rsi
|
sprite: Structures/Walls/grille.rsi
|
||||||
state: grille
|
state: grille
|
||||||
|
|||||||
@@ -79,10 +79,6 @@
|
|||||||
conditions:
|
conditions:
|
||||||
- !type:TileNotBlocked
|
- !type:TileNotBlocked
|
||||||
failIfSpace: false
|
failIfSpace: false
|
||||||
- !type:TileType
|
|
||||||
targets:
|
|
||||||
- Lattice
|
|
||||||
- Plating
|
|
||||||
|
|
||||||
- type: construction
|
- type: construction
|
||||||
name: cable terminal
|
name: cable terminal
|
||||||
|
|||||||
Reference in New Issue
Block a user