diff --git a/Content.Shared/RCD/Components/RCDComponent.cs b/Content.Shared/RCD/Components/RCDComponent.cs index 05e31dbd20..5d2ab9a391 100644 --- a/Content.Shared/RCD/Components/RCDComponent.cs +++ b/Content.Shared/RCD/Components/RCDComponent.cs @@ -1,5 +1,6 @@ using Content.Shared._White.RCD; using Content.Shared.RCD.Systems; +using Content.Shared.Whitelist; using Robust.Shared.Audio; using Robust.Shared.GameStates; using Robust.Shared.Physics; @@ -76,4 +77,11 @@ public sealed partial class RCDComponent : Component /// [ViewVariables(VVAccess.ReadOnly)] public Transform ConstructionTransform { get; private set; } = default!; + + /// + /// WD. + /// A blacklist for limiting entities of the same construction group on one tile. + /// + [DataField] + public EntityWhitelist? BlacklistOnOneTile; } diff --git a/Content.Shared/RCD/Systems/RCDSystem.cs b/Content.Shared/RCD/Systems/RCDSystem.cs index 6dea49a385..f3ec9d6836 100644 --- a/Content.Shared/RCD/Systems/RCDSystem.cs +++ b/Content.Shared/RCD/Systems/RCDSystem.cs @@ -13,6 +13,7 @@ using Content.Shared.Popups; using Content.Shared.RCD.Components; using Content.Shared.Tag; using Content.Shared.Tiles; +using Content.Shared.Whitelist; using Robust.Shared.Audio.Systems; using Robust.Shared.Map; using Robust.Shared.Map.Components; @@ -47,6 +48,7 @@ public class RCDSystem : EntitySystem [Dependency] private readonly IPrototypeManager _protoManager = default!; [Dependency] private readonly SharedMapSystem _mapSystem = default!; [Dependency] private readonly TagSystem _tags = default!; + [Dependency] private readonly EntityWhitelistSystem _blacklist = default!; private readonly int _instantConstructionDelay = 0; private readonly EntProtoId _instantConstructionFx = "EffectRCDConstruct0"; @@ -405,21 +407,40 @@ public class RCDSystem : EntitySystem // Check for existing identical entities in the same tile _intersectingEntities.Clear(); _lookup.GetLocalEntitiesIntersecting(mapGridData.GridUid, mapGridData.Position, _intersectingEntities, -0.05f, LookupFlags.Uncontained); - + // WD EDIT START if (component.CachedPrototype.Prototype != null) { foreach (var entity in _intersectingEntities) { - // Check if the entity has the same prototype ID - if (MetaData(entity).EntityPrototype?.ID == component.CachedPrototype.Prototype) + var entityID = MetaData(entity).EntityPrototype?.ID; + if (entityID == null) + continue; + + // Prevents building entities from same construction group on one tile + if (component.BlacklistOnOneTile?.Tags != null) + { + foreach (var tag in component.BlacklistOnOneTile.Tags) + { + if (_blacklist.IsValid(component.BlacklistOnOneTile, entity) && component.CachedPrototype.Category == tag) + { + if (popMsgs) + _popup.PopupClient(Loc.GetString("rcd-component-cannot-build-blacklisted-entity"), uid, user); + return false; + } + } + } + + // Prevents building identical electrical entities on same tile + if (component.CachedPrototype.Category == "Electrical" && entityID == component.CachedPrototype.Prototype) { if (popMsgs) - _popup.PopupClient("An identical object already exists in this location.", uid, user); + _popup.PopupClient(Loc.GetString("rcd-component-cannot-build-identical-entity"), uid, user); return false; } } } + // WD EDIT END var isWindow = component.CachedPrototype.ConstructionRules.Contains(RcdConstructionRule.IsWindow); var isCatwalk = component.CachedPrototype.ConstructionRules.Contains(RcdConstructionRule.IsCatwalk); diff --git a/Resources/Locale/ru-RU/rcd/components/rcd-component.ftl b/Resources/Locale/ru-RU/rcd/components/rcd-component.ftl index aef1b2b11b..fc08ea2b82 100644 --- a/Resources/Locale/ru-RU/rcd/components/rcd-component.ftl +++ b/Resources/Locale/ru-RU/rcd/components/rcd-component.ftl @@ -30,7 +30,8 @@ rcd-component-must-build-on-subfloor-message = Вы можете строить rcd-component-cannot-build-on-subfloor-message = Вы не можете строить это на открытом полу! rcd-component-cannot-build-on-occupied-tile-message = Вы не можете строить здесь, это место уже занято! rcd-component-cannot-build-identical-tile = Эта плитка уже существует! - +rcd-component-cannot-build-blacklisted-entity = Вы не можете строить здесь, недостаточно свободного места! +rcd-component-cannot-build-identical-entity = Идентичный объект уже существует в этом месте! ### Category names diff --git a/Resources/Prototypes/Entities/Objects/Tools/tools.yml b/Resources/Prototypes/Entities/Objects/Tools/tools.yml index 9cbda39cd5..3a6f430fe3 100644 --- a/Resources/Prototypes/Entities/Objects/Tools/tools.yml +++ b/Resources/Prototypes/Entities/Objects/Tools/tools.yml @@ -466,6 +466,9 @@ - APC # WD - Camera # WD - Deconstruct + blacklistOnOneTile: # WD + tags: + - Lighting - type: entity id: RCDEmpty @@ -528,6 +531,9 @@ - DisposalUnit # disposal units - MailingUnit - ToiletEmpty + blacklistOnOneTile: # WD + tags: + - DisposalUnits - type: entity # WD id: RapidPipeDispenserEmpty diff --git a/Resources/Prototypes/Entities/Structures/Lighting/base_lighting.yml b/Resources/Prototypes/Entities/Structures/Lighting/base_lighting.yml index 0561fe2683..840a00acb8 100644 --- a/Resources/Prototypes/Entities/Structures/Lighting/base_lighting.yml +++ b/Resources/Prototypes/Entities/Structures/Lighting/base_lighting.yml @@ -81,6 +81,9 @@ - !type:PlaySoundBehavior sound: collection: GlassBreak + - type: Tag # WD EDIT + tags: + - Lighting - type: LightingOverlay # WD - type: LightMark placement: diff --git a/Resources/Prototypes/Entities/Structures/Piping/Disposal/units.yml b/Resources/Prototypes/Entities/Structures/Piping/Disposal/units.yml index 2198c854a0..0ea7eae9be 100644 --- a/Resources/Prototypes/Entities/Structures/Piping/Disposal/units.yml +++ b/Resources/Prototypes/Entities/Structures/Piping/Disposal/units.yml @@ -64,6 +64,9 @@ - type: StaticPrice price: 62 - type: PowerSwitch + - type: Tag # WD EDIT + tags: + - DisposalUnits - type: entity id: DisposalUnit diff --git a/Resources/Prototypes/_White/tags.yml b/Resources/Prototypes/_White/tags.yml index 7dc0743d05..51b3f66a7d 100644 --- a/Resources/Prototypes/_White/tags.yml +++ b/Resources/Prototypes/_White/tags.yml @@ -103,5 +103,11 @@ - type: Tag id: ClusterBang +- type: Tag + id: Lighting + +- type: Tag + id: DisposalUnits + - type: Tag id: VoiceActivatedBombImplant