РЦД - меньше ограничений (#759)

* R? In your CD?

* Maybe this time

* ugbemugbem osas
This commit is contained in:
BIGZi0348
2024-11-16 12:53:37 +03:00
committed by GitHub
parent 0cca51f6e9
commit 9afeece604
7 changed files with 53 additions and 5 deletions

View File

@@ -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
/// </remarks>
[ViewVariables(VVAccess.ReadOnly)]
public Transform ConstructionTransform { get; private set; } = default!;
/// <summary>
/// WD.
/// A blacklist for limiting entities of the same construction group on one tile.
/// </summary>
[DataField]
public EntityWhitelist? BlacklistOnOneTile;
}

View File

@@ -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);

View File

@@ -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

View File

@@ -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

View File

@@ -81,6 +81,9 @@
- !type:PlaySoundBehavior
sound:
collection: GlassBreak
- type: Tag # WD EDIT
tags:
- Lighting
- type: LightingOverlay # WD
- type: LightMark
placement:

View File

@@ -64,6 +64,9 @@
- type: StaticPrice
price: 62
- type: PowerSwitch
- type: Tag # WD EDIT
tags:
- DisposalUnits
- type: entity
id: DisposalUnit

View File

@@ -103,5 +103,11 @@
- type: Tag
id: ClusterBang
- type: Tag
id: Lighting
- type: Tag
id: DisposalUnits
- type: Tag
id: VoiceActivatedBombImplant