Skip to content

Commit

Permalink
Джетпак
Browse files Browse the repository at this point in the history
  • Loading branch information
Darkiich committed Dec 15, 2024
1 parent 22a6348 commit 6d8f09e
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 2 deletions.
18 changes: 18 additions & 0 deletions Content.Shared/CCVar/CCVars.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,22 @@ public sealed partial class CCVars : CVars
/// </summary>
public static readonly CVarDef<bool> DebugPow3rDisableParallel =
CVarDef.Create("debug.pow3r_disable_parallel", true, CVar.SERVERONLY);

// ADT Tweak start
#region Jetpack System

/// <summary>
/// When true, Jetpacks can be enabled anywhere, even in gravity.
/// </summary>
public static readonly CVarDef<bool> JetpackEnableAnywhere =
CVarDef.Create("jetpack.enable_anywhere", false, CVar.REPLICATED);

/// <summary>
/// When true, jetpacks can be enabled on grids that have zero gravity.
/// </summary>
public static readonly CVarDef<bool> JetpackEnableInNoGravity =
CVarDef.Create("jetpack.enable_in_no_gravity", true, CVar.REPLICATED);

#endregion
// ADT Tweak End
}
14 changes: 12 additions & 2 deletions Content.Shared/Movement/Systems/SharedJetpackSystem.cs
Original file line number Diff line number Diff line change
@@ -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;
Expand All @@ -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()
{
Expand Down Expand Up @@ -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<GravityComponent>(gridUid));

// ADT Tweak start
// return gridUid == null ||
// (!HasComp<GravityComponent>(gridUid));
if (gridUid == null || !TryComp<GravityComponent>(gridUid, out var comp))
return true;

return !comp.Enabled;
// ADT Tweak End
}

private void OnJetpackGetAction(EntityUid uid, JetpackComponent component, GetItemActionsEvent args)
Expand Down

0 comments on commit 6d8f09e

Please sign in to comment.