Skip to content

Commit

Permalink
Can no longer stack catwalks
Browse files Browse the repository at this point in the history
  • Loading branch information
chromiumboy committed Mar 31, 2024
1 parent c7cd310 commit b937d38
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 0 deletions.
2 changes: 2 additions & 0 deletions Content.Shared/RCD/RCDPrototype.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
11 changes: 11 additions & 0 deletions Content.Shared/RCD/Systems/RCDSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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";
Expand Down Expand Up @@ -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);
Expand All @@ -403,6 +406,14 @@ private bool IsConstructionLocationValid(EntityUid uid, RCDComponent component,
if (isWindow && HasComp<SharedCanBuildWindowOnTopComponent>(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<FixturesComponent>(ent, out var fixtures))
{
foreach (var fixture in fixtures.Fixtures.Values)
Expand Down
1 change: 1 addition & 0 deletions Resources/Prototypes/RCD/rcd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@
collisionMask: InteractImpassable
rules:
- MustBuildOnSubfloor
- IsCatwalk
rotation: Fixed
fx: EffectRCDConstruct1

Expand Down

0 comments on commit b937d38

Please sign in to comment.