diff --git a/Content.Shared/RCD/RCDPrototype.cs b/Content.Shared/RCD/RCDPrototype.cs index de0cebceb0d090..1e80abfb723b68 100644 --- a/Content.Shared/RCD/RCDPrototype.cs +++ b/Content.Shared/RCD/RCDPrototype.cs @@ -126,12 +126,14 @@ public enum RcdMode : byte ConstructObject, } +// These are to be replaced with more flexible 'RulesRule' at a later time public enum RcdConstructionRule : byte { MustBuildOnEmptyTile, // Can only be built on empty space (e.g. lattice) CanBuildOnEmptyTile, // Can be built on empty space or replace an existing tile (e.g. hull plating) MustBuildOnSubfloor, // Can only be built on exposed subfloor (e.g. catwalks on lattice or hull plating) IsWindow, // The entity is a window and can be built on grilles + IsCatwalk, // The entity is a catwalk } public enum RcdRotation : byte diff --git a/Content.Shared/RCD/Systems/RCDSystem.cs b/Content.Shared/RCD/Systems/RCDSystem.cs index 897c63da5b3acf..cd1e90dc1ff655 100644 --- a/Content.Shared/RCD/Systems/RCDSystem.cs +++ b/Content.Shared/RCD/Systems/RCDSystem.cs @@ -11,6 +11,7 @@ using Content.Shared.Physics; using Content.Shared.Popups; using Content.Shared.RCD.Components; +using Content.Shared.Tag; using Content.Shared.Tiles; using Robust.Shared.Audio.Systems; using Robust.Shared.Map; @@ -44,6 +45,7 @@ public class RCDSystem : EntitySystem [Dependency] private readonly EntityLookupSystem _lookup = default!; [Dependency] private readonly IPrototypeManager _protoManager = default!; [Dependency] private readonly SharedMapSystem _mapSystem = default!; + [Dependency] private readonly TagSystem _tags = default!; private readonly int _instantConstructionDelay = 0; private readonly EntProtoId _instantConstructionFx = "EffectRCDConstruct0"; @@ -394,6 +396,7 @@ private bool IsConstructionLocationValid(EntityUid uid, RCDComponent component, // Check rule: The tile is unoccupied var isWindow = component.CachedPrototype.ConstructionRules.Contains(RcdConstructionRule.IsWindow); + var isCatwalk = component.CachedPrototype.ConstructionRules.Contains(RcdConstructionRule.IsCatwalk); _intersectingEntities.Clear(); _lookup.GetLocalEntitiesIntersecting(mapGridData.GridUid, mapGridData.Position, _intersectingEntities, -0.05f, LookupFlags.Uncontained); @@ -403,6 +406,14 @@ private bool IsConstructionLocationValid(EntityUid uid, RCDComponent component, if (isWindow && HasComp(ent)) continue; + if (isCatwalk && _tags.HasTag(ent, "Catwalk")) + { + if (popMsgs) + _popup.PopupClient(Loc.GetString("rcd-component-cannot-build-on-occupied-tile-message"), uid, user); + + return false; + } + if (component.CachedPrototype.CollisionMask != CollisionGroup.None && TryComp(ent, out var fixtures)) { foreach (var fixture in fixtures.Fixtures.Values) diff --git a/Resources/Prototypes/RCD/rcd.yml b/Resources/Prototypes/RCD/rcd.yml index 04856e217b18ba..cb2c9ed23413aa 100644 --- a/Resources/Prototypes/RCD/rcd.yml +++ b/Resources/Prototypes/RCD/rcd.yml @@ -69,6 +69,7 @@ collisionMask: InteractImpassable rules: - MustBuildOnSubfloor + - IsCatwalk rotation: Fixed fx: EffectRCDConstruct1