Cannot stack binary and trinary Atmos pumps and devices. 5x Filter rate boost (#16331)

* Cannot stack binary and trinary Atmos pumps and devices

- Filters now have a 5x max volume to compensate for no more stacking
- Add flipped versions of mixers and filters to the list of constructables

* Oi! No anchoring unstackables together!

* Use EntityLookupSystem in Unstackable and Window lookup

- Use static method for AnyUnstackableTiles
This commit is contained in:
Tom Leys
2023-05-19 20:59:20 +12:00
committed by GitHub
parent f859401f96
commit ccd503f8bb
11 changed files with 159 additions and 12 deletions

View File

@@ -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))
return false;
ghost = EntityManager.SpawnEntity("constructionghost", loc);
var comp = EntityManager.GetComponent<ConstructionGhostComponent>(ghost.Value);
@@ -217,6 +216,27 @@ namespace Content.Client.Construction
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>
/// Checks if any construction ghosts are present at the given position
/// </summary>