From dec7e60ca797ee51da9cb925490e92140f967933 Mon Sep 17 00:00:00 2001 From: Vera Aguilera Puerto Date: Fri, 15 Oct 2021 12:20:10 +0200 Subject: [PATCH] Adapt window construction to new sprites and grilles. --- ...llInTile.cs => EmptyOrWindowValidInTile.cs} | 18 ++++++++++-------- Resources/Changelog/Parts/window.yml | 4 ++++ .../Recipes/Construction/structures.yml | 12 ++++++------ 3 files changed, 20 insertions(+), 14 deletions(-) rename Content.Shared/Construction/Conditions/{LowWallInTile.cs => EmptyOrWindowValidInTile.cs} (64%) create mode 100644 Resources/Changelog/Parts/window.yml diff --git a/Content.Shared/Construction/Conditions/LowWallInTile.cs b/Content.Shared/Construction/Conditions/EmptyOrWindowValidInTile.cs similarity index 64% rename from Content.Shared/Construction/Conditions/LowWallInTile.cs rename to Content.Shared/Construction/Conditions/EmptyOrWindowValidInTile.cs index d0e0180603..cfe564862e 100644 --- a/Content.Shared/Construction/Conditions/LowWallInTile.cs +++ b/Content.Shared/Construction/Conditions/EmptyOrWindowValidInTile.cs @@ -10,23 +10,25 @@ namespace Content.Shared.Construction.Conditions { [UsedImplicitly] [DataDefinition] - public class LowWallInTile : IConstructionCondition + public class EmptyOrWindowValidInTile : IConstructionCondition { + [DataField("tileNotBlocked")] + private readonly TileNotBlocked _tileNotBlocked = new(); + public bool Condition(IEntity user, EntityCoordinates location, Direction direction) { - var lowWall = false; + var result = false; foreach (var entity in location.GetEntitiesInTile(LookupFlags.Approximate | LookupFlags.IncludeAnchored)) { if (entity.HasComponent()) - lowWall = true; - - // Already has a window. - if (entity.HasComponent()) - return false; + result = true; } - return lowWall; + if (!result) + result = _tileNotBlocked.Condition(user, location, direction); + + return result; } } } diff --git a/Resources/Changelog/Parts/window.yml b/Resources/Changelog/Parts/window.yml new file mode 100644 index 0000000000..6bf146ce93 --- /dev/null +++ b/Resources/Changelog/Parts/window.yml @@ -0,0 +1,4 @@ +author: Zumorica +changes: + - type: Tweak # One of the following: Add, Remove, Tweak, Fix + message: Adapts window construction to the new sprites and grilles. diff --git a/Resources/Prototypes/Recipes/Construction/structures.yml b/Resources/Prototypes/Recipes/Construction/structures.yml index 2dfba43459..6ad7237adf 100644 --- a/Resources/Prototypes/Recipes/Construction/structures.yml +++ b/Resources/Prototypes/Recipes/Construction/structures.yml @@ -94,9 +94,9 @@ startNode: start targetNode: window category: Structures - description: Clear. Must be built on top of a low wall. + description: Clear. conditions: - - !type:LowWallInTile {} + - !type:EmptyOrWindowValidInTile {} - !type:NoWindowsInTile {} icon: sprite: Structures/Windows/window.rsi @@ -112,9 +112,9 @@ startNode: start targetNode: reinforcedWindow category: Structures - description: Clear but tough. Must be built on top of a low wall. + description: Clear but tough. conditions: - - !type:LowWallInTile {} + - !type:EmptyOrWindowValidInTile {} - !type:NoWindowsInTile {} icon: sprite: Structures/Windows/reinforced_window.rsi @@ -130,9 +130,9 @@ startNode: start targetNode: plasmaWindow category: Structures - description: Clear and even tougher, with an orange tint. Must be built on top of a low wall. + description: Clear and even tougher, with a purple tint. conditions: - - !type:LowWallInTile {} + - !type:EmptyOrWindowValidInTile {} - !type:NoWindowsInTile {} icon: sprite: Structures/Windows/plasma_window.rsi