diff --git a/Content.Shared/CCVar/CCVars.cs b/Content.Shared/CCVar/CCVars.cs index 00407bb253c..f89ac1178e3 100644 --- a/Content.Shared/CCVar/CCVars.cs +++ b/Content.Shared/CCVar/CCVars.cs @@ -2467,5 +2467,21 @@ public static readonly CVarDef CVarDef.Create("reclaimer.allow_gibbing", true, CVar.SERVER); #endregion + + #region Jetpack System + + /// + /// When true, Jetpacks can be enabled anywhere, even in gravity. + /// + public static readonly CVarDef JetpackEnableAnywhere = + CVarDef.Create("jetpack.enable_anywhere", false, CVar.REPLICATED); + + /// + /// When true, jetpacks can be enabled on grids that have zero gravity. + /// + public static readonly CVarDef JetpackEnableInNoGravity = + CVarDef.Create("jetpack.enable_in_no_gravity", true, CVar.REPLICATED); + + #endregion } } diff --git a/Content.Shared/Movement/Systems/SharedJetpackSystem.cs b/Content.Shared/Movement/Systems/SharedJetpackSystem.cs index 8c42511f846..8d358f8db39 100644 --- a/Content.Shared/Movement/Systems/SharedJetpackSystem.cs +++ b/Content.Shared/Movement/Systems/SharedJetpackSystem.cs @@ -1,9 +1,11 @@ using Content.Shared.Actions; +using Content.Shared.CCVar; using Content.Shared.Gravity; using Content.Shared.Interaction.Events; using Content.Shared.Movement.Components; using Content.Shared.Movement.Events; using Content.Shared.Popups; +using Robust.Shared.Configuration; using Robust.Shared.Containers; using Robust.Shared.Physics.Components; using Robust.Shared.Physics.Systems; @@ -20,6 +22,7 @@ public abstract class SharedJetpackSystem : EntitySystem [Dependency] private readonly SharedPopupSystem _popup = default!; [Dependency] private readonly SharedPhysicsSystem _physics = default!; [Dependency] private readonly ActionContainerSystem _actionContainer = default!; + [Dependency] private readonly IConfigurationManager _config = default!; public override void Initialize() { @@ -125,8 +128,11 @@ private void OnJetpackToggle(EntityUid uid, JetpackComponent component, ToggleJe private bool CanEnableOnGrid(EntityUid? gridUid) { - return gridUid == null || - (!HasComp(gridUid)); + return _config.GetCVar(CCVars.JetpackEnableAnywhere) + || gridUid == null + || _config.GetCVar(CCVars.JetpackEnableInNoGravity) + && TryComp(gridUid, out var comp) + && comp.Enabled; } private void OnJetpackGetAction(EntityUid uid, JetpackComponent component, GetItemActionsEvent args)