diff --git a/Content.Shared/Movement/Systems/SharedJetpackSystem.cs b/Content.Shared/Movement/Systems/SharedJetpackSystem.cs index 0284a99f4e373c..cbb0d14592e4fd 100644 --- a/Content.Shared/Movement/Systems/SharedJetpackSystem.cs +++ b/Content.Shared/Movement/Systems/SharedJetpackSystem.cs @@ -87,7 +87,7 @@ private void OnJetpackUserCanWeightless(EntityUid uid, JetpackUserComponent comp private void OnJetpackUserEntParentChanged(EntityUid uid, JetpackUserComponent component, ref EntParentChangedMessage args) { if (TryComp(component.Jetpack, out var jetpack) && - !CanEnableOnGrid(args.Transform.GridUid)) + (!CanEnableOnGrid(args.Transform.GridUid) || !CheckMagboots(uid))) // SS220 Magboots with jet fix { SetEnabled(component.Jetpack, jetpack, false, uid); @@ -128,17 +128,15 @@ private void OnJetpackToggle(EntityUid uid, JetpackComponent component, ToggleJe //ss220 magboots with jet on gravity fix end //SS220 Magboots with jet fix begin + if (!CheckMagboots(args.Performer)) + { + _popup.PopupClient(Loc.GetString("jetpack-no-magboots-on-grid"), uid, args.Performer); + return; + } + var slotEnumerator = _inventory.GetSlotEnumerator(args.Performer); while (slotEnumerator.NextItem(out var item)) { - if (HasComp(item) && - TryComp(item, out var itemToggle) && - itemToggle.Activated && !CanEnableOnGrid(xform.GridUid)) - { - _popup.PopupClient(Loc.GetString("jetpack-no-magboots-on-gravity"), uid, args.Performer); - return; - } - // SS220 FIX JETPACK CAMERA START (fix: https://github.com/SerbiaStrong-220/space-station-14/issues/1746) if (TryComp(args.Performer, out var buckleComponent) && buckleComponent.BuckledTo != null) { @@ -181,6 +179,32 @@ private bool CanEnableOnGrid(EntityUid? gridUid) //SS220 Fix jet in zero gravity end } + // SS220 Magboots with jet fix begin + /// + /// Checks whether the entity can use jet with magboots + /// + /// + /// true if entity can use jet with magboots + /// + private bool CheckMagboots(EntityUid user) + { + var xform = Transform(user); + if (xform.GridUid is null) + return true; + + var slotEnumerator = _inventory.GetSlotEnumerator(user); + while (slotEnumerator.NextItem(out var item)) + { + if (HasComp(item) && + TryComp(item, out var itemToggle) && + itemToggle.Activated) + return false; + } + + return true; + } + // SS220 Magboots with jet fix end + private void OnJetpackGetAction(EntityUid uid, JetpackComponent component, GetItemActionsEvent args) { args.AddAction(ref component.ToggleActionEntity, component.ToggleAction); diff --git a/Resources/Locale/ru-RU/ss220/movement/jetpacks.ftl b/Resources/Locale/ru-RU/ss220/movement/jetpacks.ftl index a71b23c794e8e1..f90a9053be9bab 100644 --- a/Resources/Locale/ru-RU/ss220/movement/jetpacks.ftl +++ b/Resources/Locale/ru-RU/ss220/movement/jetpacks.ftl @@ -1 +1 @@ -jetpack-no-magboots-on-gravity = Невозможно использовать джетпак вместе с магнитными сапогами в зоне гравитации +jetpack-no-magboots-on-grid = Невозможно использовать джетпак вместе с магнитными сапогами находясь на объекте