From: psykana <36602558+psykana@users.noreply.github.com> Date: Sun, 26 Oct 2025 15:36:36 +0000 (+0000) Subject: Internals: prioritize gas tanks over jetpacks (#35068) X-Git-Url: https://git.smokeofanarchy.ru/gitweb.cgi?a=commitdiff_plain;h=4b24d2959e2d1281ce618270c72df64643cc8ef2;p=space-station-14.git Internals: prioritize gas tanks over jetpacks (#35068) * Internals: prioritize gas tanks over jetpacks * Use HasComp --- diff --git a/Content.Shared/Body/Systems/SharedInternalsSystem.cs b/Content.Shared/Body/Systems/SharedInternalsSystem.cs index 7db02a376c..c0dc6c1172 100644 --- a/Content.Shared/Body/Systems/SharedInternalsSystem.cs +++ b/Content.Shared/Body/Systems/SharedInternalsSystem.cs @@ -7,6 +7,7 @@ using Content.Shared.Hands.Components; using Content.Shared.IdentityManagement; using Content.Shared.Internals; using Content.Shared.Inventory; +using Content.Shared.Movement.Components; using Content.Shared.Popups; using Content.Shared.Verbs; using Robust.Shared.Containers; @@ -258,11 +259,15 @@ public abstract class SharedInternalsSystem : EntitySystem Entity user) { // TODO use _respirator.CanMetabolizeGas() to prioritize metabolizable gasses - // Prioritise - // 1. back equipped tanks - // 2. exo-slot tanks - // 3. in-hand tanks - // 4. pocket/belt tanks + // Lookup order: + // 1. Back + // 2. Exo-slot + // 3. In-hand + // 4. Pocket/belt + // Jetpacks will only be used as a fallback if no other tank is found + + // Store the first jetpack seen + Entity? found = null; if (!Resolve(user, ref user.Comp2, ref user.Comp3)) return null; @@ -271,22 +276,36 @@ public abstract class SharedInternalsSystem : EntitySystem TryComp(backEntity, out var backGasTank) && _gasTank.CanConnectToInternals((backEntity.Value, backGasTank))) { - return (backEntity.Value, backGasTank); + found = (backEntity.Value, backGasTank); + if (!HasComp(backEntity.Value)) + { + return found; + } } if (_inventory.TryGetSlotEntity(user, "suitstorage", out var entity, user.Comp2, user.Comp3) && TryComp(entity, out var gasTank) && _gasTank.CanConnectToInternals((entity.Value, gasTank))) { - return (entity.Value, gasTank); + found ??= (entity.Value, gasTank); + if (!HasComp(entity.Value)) + { + return (entity.Value, gasTank); + } } foreach (var item in _inventory.GetHandOrInventoryEntities((user.Owner, user.Comp1, user.Comp2))) { if (TryComp(item, out gasTank) && _gasTank.CanConnectToInternals((item, gasTank))) - return (item, gasTank); + { + found ??= (item, gasTank); + if (!HasComp(item)) + { + return (item, gasTank); + } + } } - return null; + return found; } }