Revert no device stacking (#16608)
This commit is contained in:
@@ -14,6 +14,7 @@ namespace Content.Client.Atmos.UI
|
|||||||
{
|
{
|
||||||
|
|
||||||
private GasFilterWindow? _window;
|
private GasFilterWindow? _window;
|
||||||
|
private const float MaxTransferRate = Atmospherics.MaxTransferRate;
|
||||||
|
|
||||||
public GasFilterBoundUserInterface(ClientUserInterfaceComponent owner, Enum uiKey) : base(owner, uiKey)
|
public GasFilterBoundUserInterface(ClientUserInterfaceComponent owner, Enum uiKey) : base(owner, uiKey)
|
||||||
{
|
{
|
||||||
@@ -48,6 +49,7 @@ namespace Content.Client.Atmos.UI
|
|||||||
private void OnFilterTransferRatePressed(string value)
|
private void OnFilterTransferRatePressed(string value)
|
||||||
{
|
{
|
||||||
float rate = float.TryParse(value, out var parsed) ? parsed : 0f;
|
float rate = float.TryParse(value, out var parsed) ? parsed : 0f;
|
||||||
|
if (rate > MaxTransferRate) rate = MaxTransferRate;
|
||||||
|
|
||||||
SendMessage(new GasFilterChangeRateMessage(rate));
|
SendMessage(new GasFilterChangeRateMessage(rate));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,7 +9,7 @@
|
|||||||
|
|
||||||
<BoxContainer Orientation="Horizontal" HorizontalExpand="True">
|
<BoxContainer Orientation="Horizontal" HorizontalExpand="True">
|
||||||
<Label Text="{Loc comp-gas-filter-ui-filter-transfer-rate}"/>
|
<Label Text="{Loc comp-gas-filter-ui-filter-transfer-rate}"/>
|
||||||
<LineEdit Name="FilterTransferRateInput" MinSize="60 0" />
|
<LineEdit Name="FilterTransferRateInput" MinSize="40 0" />
|
||||||
<Button Name="SetFilterRate" Text="{Loc comp-gas-filter-ui-filter-set-rate}" Disabled="True"/>
|
<Button Name="SetFilterRate" Text="{Loc comp-gas-filter-ui-filter-set-rate}" Disabled="True"/>
|
||||||
</BoxContainer>
|
</BoxContainer>
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
using System.Diagnostics.CodeAnalysis;
|
using System.Diagnostics.CodeAnalysis;
|
||||||
using Content.Client.Popups;
|
|
||||||
using Content.Shared.Construction;
|
using Content.Shared.Construction;
|
||||||
using Content.Shared.Construction.Prototypes;
|
using Content.Shared.Construction.Prototypes;
|
||||||
using Content.Shared.Examine;
|
using Content.Shared.Examine;
|
||||||
@@ -25,7 +24,6 @@ namespace Content.Client.Construction
|
|||||||
[Dependency] private readonly IPlayerManager _playerManager = default!;
|
[Dependency] private readonly IPlayerManager _playerManager = default!;
|
||||||
[Dependency] private readonly IPrototypeManager _prototypeManager = default!;
|
[Dependency] private readonly IPrototypeManager _prototypeManager = default!;
|
||||||
[Dependency] private readonly SharedInteractionSystem _interactionSystem = default!;
|
[Dependency] private readonly SharedInteractionSystem _interactionSystem = default!;
|
||||||
[Dependency] private readonly PopupSystem _popupSystem = default!;
|
|
||||||
|
|
||||||
private readonly Dictionary<int, ConstructionGhostComponent> _ghosts = new();
|
private readonly Dictionary<int, ConstructionGhostComponent> _ghosts = new();
|
||||||
private readonly Dictionary<string, ConstructionGuide> _guideCache = new();
|
private readonly Dictionary<string, ConstructionGuide> _guideCache = new();
|
||||||
@@ -190,8 +188,11 @@ namespace Content.Client.Construction
|
|||||||
if (!_interactionSystem.InRangeUnobstructed(user, loc, 20f, predicate: predicate))
|
if (!_interactionSystem.InRangeUnobstructed(user, loc, 20f, predicate: predicate))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (!CheckConstructionConditions(prototype, loc, dir, user))
|
foreach (var condition in prototype.Conditions)
|
||||||
|
{
|
||||||
|
if (!condition.Condition(user, loc, dir))
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
ghost = EntityManager.SpawnEntity("constructionghost", loc);
|
ghost = EntityManager.SpawnEntity("constructionghost", loc);
|
||||||
var comp = EntityManager.GetComponent<ConstructionGhostComponent>(ghost.Value);
|
var comp = EntityManager.GetComponent<ConstructionGhostComponent>(ghost.Value);
|
||||||
@@ -216,27 +217,6 @@ namespace Content.Client.Construction
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
private bool CheckConstructionConditions(ConstructionPrototype prototype, EntityCoordinates loc, Direction dir,
|
|
||||||
EntityUid user)
|
|
||||||
{
|
|
||||||
foreach (var condition in prototype.Conditions)
|
|
||||||
{
|
|
||||||
if (!condition.Condition(user, loc, dir))
|
|
||||||
{
|
|
||||||
var message = condition.GenerateGuideEntry()?.Localization;
|
|
||||||
if (message != null)
|
|
||||||
{
|
|
||||||
// Show the reason to the user:
|
|
||||||
_popupSystem.PopupCoordinates(Loc.GetString(message), loc);
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Checks if any construction ghosts are present at the given position
|
/// Checks if any construction ghosts are present at the given position
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|||||||
@@ -1,16 +1,13 @@
|
|||||||
using Content.Server.Administration.Logs;
|
using Content.Server.Administration.Logs;
|
||||||
using Content.Server.Construction.Components;
|
|
||||||
using Content.Server.Coordinates.Helpers;
|
using Content.Server.Coordinates.Helpers;
|
||||||
using Content.Server.Popups;
|
using Content.Server.Popups;
|
||||||
using Content.Server.Pulling;
|
using Content.Server.Pulling;
|
||||||
using Content.Shared.Construction.Components;
|
using Content.Shared.Construction.Components;
|
||||||
using Content.Shared.Construction.Conditions;
|
|
||||||
using Content.Shared.Construction.EntitySystems;
|
using Content.Shared.Construction.EntitySystems;
|
||||||
using Content.Shared.Database;
|
using Content.Shared.Database;
|
||||||
using Content.Shared.DoAfter;
|
using Content.Shared.DoAfter;
|
||||||
using Content.Shared.Examine;
|
using Content.Shared.Examine;
|
||||||
using Content.Shared.Pulling.Components;
|
using Content.Shared.Pulling.Components;
|
||||||
using Content.Shared.Tag;
|
|
||||||
using Content.Shared.Tools;
|
using Content.Shared.Tools;
|
||||||
using Content.Shared.Tools.Components;
|
using Content.Shared.Tools.Components;
|
||||||
using Robust.Shared.Map;
|
using Robust.Shared.Map;
|
||||||
@@ -27,7 +24,6 @@ namespace Content.Server.Construction
|
|||||||
[Dependency] private readonly SharedToolSystem _tool = default!;
|
[Dependency] private readonly SharedToolSystem _tool = default!;
|
||||||
[Dependency] private readonly PullingSystem _pulling = default!;
|
[Dependency] private readonly PullingSystem _pulling = default!;
|
||||||
[Dependency] private readonly SharedTransformSystem _transform = default!;
|
[Dependency] private readonly SharedTransformSystem _transform = default!;
|
||||||
[Dependency] private readonly TagSystem _tagSystem = default!;
|
|
||||||
|
|
||||||
public override void Initialize()
|
public override void Initialize()
|
||||||
{
|
{
|
||||||
@@ -89,26 +85,7 @@ namespace Content.Server.Construction
|
|||||||
// TODO: Anchoring snaps rn anyway!
|
// TODO: Anchoring snaps rn anyway!
|
||||||
if (component.Snap)
|
if (component.Snap)
|
||||||
{
|
{
|
||||||
var coordinates = xform.Coordinates.SnapToGrid(EntityManager, _mapManager);
|
_transform.SetCoordinates(uid, xform.Coordinates.SnapToGrid(EntityManager, _mapManager));
|
||||||
|
|
||||||
if (_tagSystem.HasTag(uid, "Unstackable"))
|
|
||||||
{
|
|
||||||
// Need to enforce the unstackable rules on anchoring also.
|
|
||||||
var condition = new NoUnstackableInTile();
|
|
||||||
if (NoUnstackableInTile.AnyUnstackableTiles(coordinates, _tagSystem))
|
|
||||||
{
|
|
||||||
var message = condition.GenerateGuideEntry()?.Localization;
|
|
||||||
if (message != null)
|
|
||||||
{
|
|
||||||
// Show the reason to the user:
|
|
||||||
_popup.PopupEntity(Loc.GetString(message), uid, args.User);
|
|
||||||
}
|
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
_transform.SetCoordinates(uid, coordinates);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
RaiseLocalEvent(uid, new BeforeAnchoredEvent(args.User, used));
|
RaiseLocalEvent(uid, new BeforeAnchoredEvent(args.User, used));
|
||||||
|
|||||||
@@ -1,44 +0,0 @@
|
|||||||
using Content.Shared.Maps;
|
|
||||||
using Content.Shared.Tag;
|
|
||||||
using JetBrains.Annotations;
|
|
||||||
using Robust.Shared.Map;
|
|
||||||
|
|
||||||
namespace Content.Shared.Construction.Conditions
|
|
||||||
{
|
|
||||||
[UsedImplicitly]
|
|
||||||
[DataDefinition]
|
|
||||||
public sealed class NoUnstackableInTile : IConstructionCondition
|
|
||||||
{
|
|
||||||
public bool Condition(EntityUid user, EntityCoordinates location, Direction direction)
|
|
||||||
{
|
|
||||||
var tagSystem = IoCManager.Resolve<IEntitySystemManager>().GetEntitySystem<TagSystem>();
|
|
||||||
|
|
||||||
if (AnyUnstackableTiles(location, tagSystem))
|
|
||||||
return false;
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static bool AnyUnstackableTiles(EntityCoordinates location, TagSystem tagSystem)
|
|
||||||
{
|
|
||||||
var lookup = IoCManager.Resolve<IEntitySystemManager>().GetEntitySystem<EntityLookupSystem>();
|
|
||||||
|
|
||||||
foreach (var entity in lookup.GetEntitiesIntersecting(location, LookupFlags.Approximate | LookupFlags.Static |
|
|
||||||
LookupFlags.Sundries))
|
|
||||||
{
|
|
||||||
if (tagSystem.HasTag(entity, "Unstackable"))
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
public ConstructionGuideEntry GenerateGuideEntry()
|
|
||||||
{
|
|
||||||
return new ConstructionGuideEntry
|
|
||||||
{
|
|
||||||
Localization = "construction-step-condition-no-unstackable-in-tile"
|
|
||||||
};
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -12,9 +12,8 @@ namespace Content.Shared.Construction.Conditions
|
|||||||
public bool Condition(EntityUid user, EntityCoordinates location, Direction direction)
|
public bool Condition(EntityUid user, EntityCoordinates location, Direction direction)
|
||||||
{
|
{
|
||||||
var tagSystem = IoCManager.Resolve<IEntitySystemManager>().GetEntitySystem<TagSystem>();
|
var tagSystem = IoCManager.Resolve<IEntitySystemManager>().GetEntitySystem<TagSystem>();
|
||||||
var lookup = IoCManager.Resolve<IEntitySystemManager>().GetEntitySystem<EntityLookupSystem>();
|
|
||||||
|
|
||||||
foreach (var entity in lookup.GetEntitiesIntersecting(location, LookupFlags.Approximate | LookupFlags.Static))
|
foreach (var entity in location.GetEntitiesInTile(LookupFlags.Approximate | LookupFlags.Static))
|
||||||
{
|
{
|
||||||
if (tagSystem.HasTag(entity, "Window"))
|
if (tagSystem.HasTag(entity, "Window"))
|
||||||
return false;
|
return false;
|
||||||
|
|||||||
@@ -1 +0,0 @@
|
|||||||
construction-step-condition-no-unstackable-in-tile = You cannot make a stack of similar devices.
|
|
||||||
@@ -6,9 +6,6 @@
|
|||||||
mode: SnapgridCenter
|
mode: SnapgridCenter
|
||||||
components:
|
components:
|
||||||
- type: AtmosDevice
|
- type: AtmosDevice
|
||||||
- type: Tag
|
|
||||||
tags:
|
|
||||||
- Unstackable
|
|
||||||
- type: SubFloorHide
|
- type: SubFloorHide
|
||||||
blockInteractions: false
|
blockInteractions: false
|
||||||
blockAmbience: false
|
blockAmbience: false
|
||||||
|
|||||||
@@ -6,9 +6,6 @@
|
|||||||
mode: SnapgridCenter
|
mode: SnapgridCenter
|
||||||
components:
|
components:
|
||||||
- type: AtmosDevice
|
- type: AtmosDevice
|
||||||
- type: Tag
|
|
||||||
tags:
|
|
||||||
- Unstackable
|
|
||||||
- type: SubFloorHide
|
- type: SubFloorHide
|
||||||
blockInteractions: false
|
blockInteractions: false
|
||||||
blockAmbience: false
|
blockAmbience: false
|
||||||
@@ -58,16 +55,11 @@
|
|||||||
type: GasFilterBoundUserInterface
|
type: GasFilterBoundUserInterface
|
||||||
- type: GasFilter
|
- type: GasFilter
|
||||||
enabled: false
|
enabled: false
|
||||||
transferRate: 1000
|
|
||||||
maxTransferRate: 1000
|
|
||||||
- type: Flippable
|
- type: Flippable
|
||||||
mirrorEntity: GasFilterFlipped
|
mirrorEntity: GasFilterFlipped
|
||||||
- type: Construction
|
- type: Construction
|
||||||
graph: GasTrinary
|
graph: GasTrinary
|
||||||
node: filter
|
node: filter
|
||||||
conditions:
|
|
||||||
- !type:TileNotBlocked
|
|
||||||
- !type:NoUnstackableInTile
|
|
||||||
- type: AmbientSound
|
- type: AmbientSound
|
||||||
enabled: false
|
enabled: false
|
||||||
volume: -9
|
volume: -9
|
||||||
@@ -213,9 +205,6 @@
|
|||||||
mode: SnapgridCenter
|
mode: SnapgridCenter
|
||||||
components:
|
components:
|
||||||
- type: AtmosDevice
|
- type: AtmosDevice
|
||||||
- type: Tag
|
|
||||||
tags:
|
|
||||||
- Unstackable
|
|
||||||
- type: SubFloorHide
|
- type: SubFloorHide
|
||||||
blockInteractions: false
|
blockInteractions: false
|
||||||
blockAmbience: false
|
blockAmbience: false
|
||||||
|
|||||||
@@ -516,7 +516,6 @@
|
|||||||
state: pumpPressure
|
state: pumpPressure
|
||||||
conditions:
|
conditions:
|
||||||
- !type:TileNotBlocked {}
|
- !type:TileNotBlocked {}
|
||||||
- !type:NoUnstackableInTile
|
|
||||||
|
|
||||||
- type: construction
|
- type: construction
|
||||||
name: volumetric gas pump
|
name: volumetric gas pump
|
||||||
@@ -538,7 +537,6 @@
|
|||||||
state: pumpVolume
|
state: pumpVolume
|
||||||
conditions:
|
conditions:
|
||||||
- !type:TileNotBlocked {}
|
- !type:TileNotBlocked {}
|
||||||
- !type:NoUnstackableInTile
|
|
||||||
|
|
||||||
- type: construction
|
- type: construction
|
||||||
id: GasPassiveGate
|
id: GasPassiveGate
|
||||||
@@ -560,7 +558,6 @@
|
|||||||
state: pumpPassiveGate
|
state: pumpPassiveGate
|
||||||
conditions:
|
conditions:
|
||||||
- !type:TileNotBlocked {}
|
- !type:TileNotBlocked {}
|
||||||
- !type:NoUnstackableInTile
|
|
||||||
|
|
||||||
- type: construction
|
- type: construction
|
||||||
id: GasValve
|
id: GasValve
|
||||||
@@ -582,7 +579,6 @@
|
|||||||
state: pumpManualValve
|
state: pumpManualValve
|
||||||
conditions:
|
conditions:
|
||||||
- !type:TileNotBlocked {}
|
- !type:TileNotBlocked {}
|
||||||
- !type:NoUnstackableInTile
|
|
||||||
|
|
||||||
- type: construction
|
- type: construction
|
||||||
id: SignalControlledValve
|
id: SignalControlledValve
|
||||||
@@ -604,7 +600,6 @@
|
|||||||
state: pumpSignalValve
|
state: pumpSignalValve
|
||||||
conditions:
|
conditions:
|
||||||
- !type:TileNotBlocked {}
|
- !type:TileNotBlocked {}
|
||||||
- !type:NoUnstackableInTile
|
|
||||||
|
|
||||||
- type: construction
|
- type: construction
|
||||||
id: GasPort
|
id: GasPort
|
||||||
@@ -626,7 +621,6 @@
|
|||||||
state: gasCanisterPort
|
state: gasCanisterPort
|
||||||
conditions:
|
conditions:
|
||||||
- !type:TileNotBlocked {}
|
- !type:TileNotBlocked {}
|
||||||
- !type:NoUnstackableInTile
|
|
||||||
|
|
||||||
- type: construction
|
- type: construction
|
||||||
id: GasDualPortVentPump
|
id: GasDualPortVentPump
|
||||||
@@ -684,24 +678,6 @@
|
|||||||
mirror: GasFilter
|
mirror: GasFilter
|
||||||
conditions:
|
conditions:
|
||||||
- !type:TileNotBlocked {}
|
- !type:TileNotBlocked {}
|
||||||
- !type:NoUnstackableInTile
|
|
||||||
|
|
||||||
- type: construction
|
|
||||||
id: GasFilterFlipped
|
|
||||||
name: gas filter [flipped]
|
|
||||||
description: Very useful for filtering gases.
|
|
||||||
graph: GasTrinary
|
|
||||||
startNode: start
|
|
||||||
targetNode: filter
|
|
||||||
category: construction-category-utilities
|
|
||||||
placementMode: SnapgridCenter
|
|
||||||
canBuildInImpassable: false
|
|
||||||
icon:
|
|
||||||
sprite: Structures/Piping/Atmospherics/gasfilter.rsi
|
|
||||||
state: gasFilterF
|
|
||||||
conditions:
|
|
||||||
- !type:TileNotBlocked {}
|
|
||||||
- !type:NoUnstackableInTile
|
|
||||||
|
|
||||||
- type: construction
|
- type: construction
|
||||||
id: GasMixer
|
id: GasMixer
|
||||||
@@ -736,25 +712,7 @@
|
|||||||
state: gasMixerF
|
state: gasMixerF
|
||||||
mirror: GasMixer
|
mirror: GasMixer
|
||||||
conditions:
|
conditions:
|
||||||
- !type:TileNotBlocked
|
- !type:TileNotBlocked {}
|
||||||
- !type:NoUnstackableInTile
|
|
||||||
|
|
||||||
- type: construction
|
|
||||||
id: GasMixerFlipped
|
|
||||||
name: gas mixer [flipped]
|
|
||||||
description: Very useful for mixing gases.
|
|
||||||
graph: GasTrinary
|
|
||||||
startNode: start
|
|
||||||
targetNode: mixer
|
|
||||||
category: construction-category-utilities
|
|
||||||
placementMode: SnapgridCenter
|
|
||||||
canBuildInImpassable: false
|
|
||||||
icon:
|
|
||||||
sprite: Structures/Piping/Atmospherics/gasmixer.rsi
|
|
||||||
state: gasMixerF
|
|
||||||
conditions:
|
|
||||||
- !type:TileNotBlocked
|
|
||||||
- !type:NoUnstackableInTile
|
|
||||||
|
|
||||||
- type: construction
|
- type: construction
|
||||||
id: PressureControlledValve
|
id: PressureControlledValve
|
||||||
@@ -770,8 +728,7 @@
|
|||||||
sprite: Structures/Piping/Atmospherics/pneumaticvalve.rsi
|
sprite: Structures/Piping/Atmospherics/pneumaticvalve.rsi
|
||||||
state: off
|
state: off
|
||||||
conditions:
|
conditions:
|
||||||
- !type:TileNotBlocked
|
- !type:TileNotBlocked {}
|
||||||
- !type:NoUnstackableInTile
|
|
||||||
|
|
||||||
# INTERCOM
|
# INTERCOM
|
||||||
- type: construction
|
- type: construction
|
||||||
|
|||||||
@@ -694,9 +694,6 @@
|
|||||||
- type: Tag
|
- type: Tag
|
||||||
id: TrashBag
|
id: TrashBag
|
||||||
|
|
||||||
- type: Tag
|
|
||||||
id: Unstackable # To prevent things like atmos devices (filters etc) being stacked on one tile. See NoUnstackableInTile
|
|
||||||
|
|
||||||
- type: Tag
|
- type: Tag
|
||||||
id: VehicleKey
|
id: VehicleKey
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user