From 6d8f09ee65e7fd9ba877d76c8efdf39e711996df Mon Sep 17 00:00:00 2001 From: Darki255 Date: Sun, 15 Dec 2024 21:22:15 +0300 Subject: [PATCH] =?UTF-8?q?=D0=94=D0=B6=D0=B5=D1=82=D0=BF=D0=B0=D0=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Content.Shared/CCVar/CCVars.cs | 18 ++++++++++++++++++ .../Movement/Systems/SharedJetpackSystem.cs | 14 ++++++++++++-- 2 files changed, 30 insertions(+), 2 deletions(-) diff --git a/Content.Shared/CCVar/CCVars.cs b/Content.Shared/CCVar/CCVars.cs index 316d9b8690a..321dfbd3a22 100644 --- a/Content.Shared/CCVar/CCVars.cs +++ b/Content.Shared/CCVar/CCVars.cs @@ -25,4 +25,22 @@ public sealed partial class CCVars : CVars /// public static readonly CVarDef DebugPow3rDisableParallel = CVarDef.Create("debug.pow3r_disable_parallel", true, CVar.SERVERONLY); + + // ADT Tweak start + #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 + // ADT Tweak End } diff --git a/Content.Shared/Movement/Systems/SharedJetpackSystem.cs b/Content.Shared/Movement/Systems/SharedJetpackSystem.cs index 548594c01f7..c4010848e1a 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() { @@ -127,8 +130,15 @@ private bool CanEnableOnGrid(EntityUid? gridUid) { // No and no again! Do not attempt to activate the jetpack on a grid with gravity disabled. You will not be the first or the last to try this. // https://discord.com/channels/310555209753690112/310555209753690112/1270067921682694234 - return gridUid == null || - (!HasComp(gridUid)); + + // ADT Tweak start + // return gridUid == null || + // (!HasComp(gridUid)); + if (gridUid == null || !TryComp(gridUid, out var comp)) + return true; + + return !comp.Enabled; + // ADT Tweak End } private void OnJetpackGetAction(EntityUid uid, JetpackComponent component, GetItemActionsEvent args)