No atmos stacking (attempt 2) (#16687)
Co-authored-by: metalgearsloth <comedian_vs_clown@hotmail.com>
This commit is contained in:
@@ -14,7 +14,6 @@ namespace Content.Client.Atmos.UI
|
||||
{
|
||||
|
||||
private GasFilterWindow? _window;
|
||||
private const float MaxTransferRate = Atmospherics.MaxTransferRate;
|
||||
|
||||
public GasFilterBoundUserInterface(ClientUserInterfaceComponent owner, Enum uiKey) : base(owner, uiKey)
|
||||
{
|
||||
@@ -49,7 +48,6 @@ namespace Content.Client.Atmos.UI
|
||||
private void OnFilterTransferRatePressed(string value)
|
||||
{
|
||||
float rate = float.TryParse(value, out var parsed) ? parsed : 0f;
|
||||
if (rate > MaxTransferRate) rate = MaxTransferRate;
|
||||
|
||||
SendMessage(new GasFilterChangeRateMessage(rate));
|
||||
}
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
|
||||
<BoxContainer Orientation="Horizontal" HorizontalExpand="True">
|
||||
<Label Text="{Loc comp-gas-filter-ui-filter-transfer-rate}"/>
|
||||
<LineEdit Name="FilterTransferRateInput" MinSize="40 0" />
|
||||
<LineEdit Name="FilterTransferRateInput" MinSize="60 0" />
|
||||
<Button Name="SetFilterRate" Text="{Loc comp-gas-filter-ui-filter-set-rate}" Disabled="True"/>
|
||||
</BoxContainer>
|
||||
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using Content.Client.Popups;
|
||||
using Content.Shared.Construction;
|
||||
using Content.Shared.Construction.Prototypes;
|
||||
using Content.Shared.Examine;
|
||||
@@ -24,6 +25,7 @@ namespace Content.Client.Construction
|
||||
[Dependency] private readonly IPlayerManager _playerManager = default!;
|
||||
[Dependency] private readonly IPrototypeManager _prototypeManager = default!;
|
||||
[Dependency] private readonly SharedInteractionSystem _interactionSystem = default!;
|
||||
[Dependency] private readonly PopupSystem _popupSystem = default!;
|
||||
|
||||
private readonly Dictionary<int, ConstructionGhostComponent> _ghosts = new();
|
||||
private readonly Dictionary<string, ConstructionGuide> _guideCache = new();
|
||||
@@ -188,11 +190,8 @@ namespace Content.Client.Construction
|
||||
if (!_interactionSystem.InRangeUnobstructed(user, loc, 20f, predicate: predicate))
|
||||
return false;
|
||||
|
||||
foreach (var condition in prototype.Conditions)
|
||||
{
|
||||
if (!condition.Condition(user, loc, dir))
|
||||
return false;
|
||||
}
|
||||
if (!CheckConstructionConditions(prototype, loc, dir, user, showPopup: true))
|
||||
return false;
|
||||
|
||||
ghost = EntityManager.SpawnEntity("constructionghost", loc);
|
||||
var comp = EntityManager.GetComponent<ConstructionGhostComponent>(ghost.Value);
|
||||
@@ -217,6 +216,30 @@ namespace Content.Client.Construction
|
||||
return true;
|
||||
}
|
||||
|
||||
private bool CheckConstructionConditions(ConstructionPrototype prototype, EntityCoordinates loc, Direction dir,
|
||||
EntityUid user, bool showPopup = false)
|
||||
{
|
||||
foreach (var condition in prototype.Conditions)
|
||||
{
|
||||
if (!condition.Condition(user, loc, dir))
|
||||
{
|
||||
if (showPopup)
|
||||
{
|
||||
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>
|
||||
/// Checks if any construction ghosts are present at the given position
|
||||
/// </summary>
|
||||
|
||||
Reference in New Issue
Block a user