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 Robust.Shared.Map;
|
||||
|
||||
namespace Content.Shared.Construction.Conditions
|
||||
namespace Content.Shared.Construction.Conditions;
|
||||
|
||||
[UsedImplicitly]
|
||||
[DataDefinition]
|
||||
public sealed class TileNotBlocked : IConstructionCondition
|
||||
{
|
||||
[UsedImplicitly]
|
||||
[DataDefinition]
|
||||
public sealed class TileNotBlocked : IConstructionCondition
|
||||
[DataField("filterMobs")] private bool _filterMobs = false;
|
||||
[DataField("failIfSpace")] private bool _failIfSpace = true;
|
||||
[DataField("failIfNotSturdy")] private bool _failIfNotSturdy = true;
|
||||
|
||||
public bool Condition(EntityUid user, EntityCoordinates location, Direction direction)
|
||||
{
|
||||
[DataField("filterMobs")] private bool _filterMobs = false;
|
||||
[DataField("failIfSpace")] private bool _failIfSpace = true;
|
||||
var tileRef = location.GetTileRef();
|
||||
|
||||
public bool Condition(EntityUid user, EntityCoordinates location, Direction direction)
|
||||
if (tileRef == null)
|
||||
{
|
||||
var tileRef = location.GetTileRef();
|
||||
|
||||
if (tileRef == null || tileRef.Value.IsSpace())
|
||||
return !_failIfSpace;
|
||||
|
||||
return !tileRef.Value.IsBlockedTurf(_filterMobs);
|
||||
return false;
|
||||
}
|
||||
|
||||
public ConstructionGuideEntry GenerateGuideEntry()
|
||||
if (tileRef.Value.IsSpace() && _failIfSpace)
|
||||
{
|
||||
return new ConstructionGuideEntry
|
||||
{
|
||||
Localization = "construction-step-condition-tile-not-blocked",
|
||||
};
|
||||
return false;
|
||||
}
|
||||
|
||||
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.
|
||||
conditions:
|
||||
- !type:TileNotBlocked
|
||||
failIfSpace: false
|
||||
icon:
|
||||
sprite: Structures/Walls/grille.rsi
|
||||
state: grille
|
||||
|
||||
@@ -79,10 +79,6 @@
|
||||
conditions:
|
||||
- !type:TileNotBlocked
|
||||
failIfSpace: false
|
||||
- !type:TileType
|
||||
targets:
|
||||
- Lattice
|
||||
- Plating
|
||||
|
||||
- type: construction
|
||||
name: cable terminal
|
||||
|
||||
Reference in New Issue
Block a user