РЦД - меньше ограничений (#759)
* R? In your CD? * Maybe this time * ugbemugbem osas
This commit is contained in:
@@ -1,5 +1,6 @@
|
|||||||
using Content.Shared._White.RCD;
|
using Content.Shared._White.RCD;
|
||||||
using Content.Shared.RCD.Systems;
|
using Content.Shared.RCD.Systems;
|
||||||
|
using Content.Shared.Whitelist;
|
||||||
using Robust.Shared.Audio;
|
using Robust.Shared.Audio;
|
||||||
using Robust.Shared.GameStates;
|
using Robust.Shared.GameStates;
|
||||||
using Robust.Shared.Physics;
|
using Robust.Shared.Physics;
|
||||||
@@ -76,4 +77,11 @@ public sealed partial class RCDComponent : Component
|
|||||||
/// </remarks>
|
/// </remarks>
|
||||||
[ViewVariables(VVAccess.ReadOnly)]
|
[ViewVariables(VVAccess.ReadOnly)]
|
||||||
public Transform ConstructionTransform { get; private set; } = default!;
|
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;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -13,6 +13,7 @@ using Content.Shared.Popups;
|
|||||||
using Content.Shared.RCD.Components;
|
using Content.Shared.RCD.Components;
|
||||||
using Content.Shared.Tag;
|
using Content.Shared.Tag;
|
||||||
using Content.Shared.Tiles;
|
using Content.Shared.Tiles;
|
||||||
|
using Content.Shared.Whitelist;
|
||||||
using Robust.Shared.Audio.Systems;
|
using Robust.Shared.Audio.Systems;
|
||||||
using Robust.Shared.Map;
|
using Robust.Shared.Map;
|
||||||
using Robust.Shared.Map.Components;
|
using Robust.Shared.Map.Components;
|
||||||
@@ -47,6 +48,7 @@ public class RCDSystem : EntitySystem
|
|||||||
[Dependency] private readonly IPrototypeManager _protoManager = default!;
|
[Dependency] private readonly IPrototypeManager _protoManager = default!;
|
||||||
[Dependency] private readonly SharedMapSystem _mapSystem = default!;
|
[Dependency] private readonly SharedMapSystem _mapSystem = default!;
|
||||||
[Dependency] private readonly TagSystem _tags = default!;
|
[Dependency] private readonly TagSystem _tags = default!;
|
||||||
|
[Dependency] private readonly EntityWhitelistSystem _blacklist = default!;
|
||||||
|
|
||||||
private readonly int _instantConstructionDelay = 0;
|
private readonly int _instantConstructionDelay = 0;
|
||||||
private readonly EntProtoId _instantConstructionFx = "EffectRCDConstruct0";
|
private readonly EntProtoId _instantConstructionFx = "EffectRCDConstruct0";
|
||||||
@@ -405,21 +407,40 @@ public class RCDSystem : EntitySystem
|
|||||||
// Check for existing identical entities in the same tile
|
// Check for existing identical entities in the same tile
|
||||||
_intersectingEntities.Clear();
|
_intersectingEntities.Clear();
|
||||||
_lookup.GetLocalEntitiesIntersecting(mapGridData.GridUid, mapGridData.Position, _intersectingEntities, -0.05f, LookupFlags.Uncontained);
|
_lookup.GetLocalEntitiesIntersecting(mapGridData.GridUid, mapGridData.Position, _intersectingEntities, -0.05f, LookupFlags.Uncontained);
|
||||||
|
// WD EDIT START
|
||||||
if (component.CachedPrototype.Prototype != null)
|
if (component.CachedPrototype.Prototype != null)
|
||||||
{
|
{
|
||||||
foreach (var entity in _intersectingEntities)
|
foreach (var entity in _intersectingEntities)
|
||||||
{
|
{
|
||||||
// Check if the entity has the same prototype ID
|
var entityID = MetaData(entity).EntityPrototype?.ID;
|
||||||
if (MetaData(entity).EntityPrototype?.ID == component.CachedPrototype.Prototype)
|
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)
|
if (popMsgs)
|
||||||
_popup.PopupClient("An identical object already exists in this location.", uid, user);
|
_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(Loc.GetString("rcd-component-cannot-build-identical-entity"), uid, user);
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// WD EDIT END
|
||||||
|
|
||||||
var isWindow = component.CachedPrototype.ConstructionRules.Contains(RcdConstructionRule.IsWindow);
|
var isWindow = component.CachedPrototype.ConstructionRules.Contains(RcdConstructionRule.IsWindow);
|
||||||
var isCatwalk = component.CachedPrototype.ConstructionRules.Contains(RcdConstructionRule.IsCatwalk);
|
var isCatwalk = component.CachedPrototype.ConstructionRules.Contains(RcdConstructionRule.IsCatwalk);
|
||||||
|
|||||||
@@ -30,7 +30,8 @@ rcd-component-must-build-on-subfloor-message = Вы можете строить
|
|||||||
rcd-component-cannot-build-on-subfloor-message = Вы не можете строить это на открытом полу!
|
rcd-component-cannot-build-on-subfloor-message = Вы не можете строить это на открытом полу!
|
||||||
rcd-component-cannot-build-on-occupied-tile-message = Вы не можете строить здесь, это место уже занято!
|
rcd-component-cannot-build-on-occupied-tile-message = Вы не можете строить здесь, это место уже занято!
|
||||||
rcd-component-cannot-build-identical-tile = Эта плитка уже существует!
|
rcd-component-cannot-build-identical-tile = Эта плитка уже существует!
|
||||||
|
rcd-component-cannot-build-blacklisted-entity = Вы не можете строить здесь, недостаточно свободного места!
|
||||||
|
rcd-component-cannot-build-identical-entity = Идентичный объект уже существует в этом месте!
|
||||||
|
|
||||||
### Category names
|
### Category names
|
||||||
|
|
||||||
|
|||||||
@@ -466,6 +466,9 @@
|
|||||||
- APC # WD
|
- APC # WD
|
||||||
- Camera # WD
|
- Camera # WD
|
||||||
- Deconstruct
|
- Deconstruct
|
||||||
|
blacklistOnOneTile: # WD
|
||||||
|
tags:
|
||||||
|
- Lighting
|
||||||
|
|
||||||
- type: entity
|
- type: entity
|
||||||
id: RCDEmpty
|
id: RCDEmpty
|
||||||
@@ -528,6 +531,9 @@
|
|||||||
- DisposalUnit # disposal units
|
- DisposalUnit # disposal units
|
||||||
- MailingUnit
|
- MailingUnit
|
||||||
- ToiletEmpty
|
- ToiletEmpty
|
||||||
|
blacklistOnOneTile: # WD
|
||||||
|
tags:
|
||||||
|
- DisposalUnits
|
||||||
|
|
||||||
- type: entity # WD
|
- type: entity # WD
|
||||||
id: RapidPipeDispenserEmpty
|
id: RapidPipeDispenserEmpty
|
||||||
|
|||||||
@@ -81,6 +81,9 @@
|
|||||||
- !type:PlaySoundBehavior
|
- !type:PlaySoundBehavior
|
||||||
sound:
|
sound:
|
||||||
collection: GlassBreak
|
collection: GlassBreak
|
||||||
|
- type: Tag # WD EDIT
|
||||||
|
tags:
|
||||||
|
- Lighting
|
||||||
- type: LightingOverlay # WD
|
- type: LightingOverlay # WD
|
||||||
- type: LightMark
|
- type: LightMark
|
||||||
placement:
|
placement:
|
||||||
|
|||||||
@@ -64,6 +64,9 @@
|
|||||||
- type: StaticPrice
|
- type: StaticPrice
|
||||||
price: 62
|
price: 62
|
||||||
- type: PowerSwitch
|
- type: PowerSwitch
|
||||||
|
- type: Tag # WD EDIT
|
||||||
|
tags:
|
||||||
|
- DisposalUnits
|
||||||
|
|
||||||
- type: entity
|
- type: entity
|
||||||
id: DisposalUnit
|
id: DisposalUnit
|
||||||
|
|||||||
@@ -103,5 +103,11 @@
|
|||||||
- type: Tag
|
- type: Tag
|
||||||
id: ClusterBang
|
id: ClusterBang
|
||||||
|
|
||||||
|
- type: Tag
|
||||||
|
id: Lighting
|
||||||
|
|
||||||
|
- type: Tag
|
||||||
|
id: DisposalUnits
|
||||||
|
|
||||||
- type: Tag
|
- type: Tag
|
||||||
id: VoiceActivatedBombImplant
|
id: VoiceActivatedBombImplant
|
||||||
|
|||||||
Reference in New Issue
Block a user