diff --git a/Content.Server/Gravity/GravitySystem.cs b/Content.Server/Gravity/GravitySystem.cs index 21083c9b47..5e0332ae49 100644 --- a/Content.Server/Gravity/GravitySystem.cs +++ b/Content.Server/Gravity/GravitySystem.cs @@ -22,6 +22,9 @@ namespace Content.Server.Gravity if (!Resolve(uid, ref gravity)) return; + if (gravity.Inherent) + return; + var enabled = false; foreach (var (comp, xform) in EntityQuery(true)) @@ -52,12 +55,17 @@ namespace Content.Server.Gravity RefreshGravity(uid); } + /// + /// Enables gravity. Note that this is a fast-path for GravityGeneratorSystem. + /// This means it does nothing if Inherent is set and it might be wiped away with a refresh + /// if you're not supposed to be doing whatever you're doing. + /// public void EnableGravity(EntityUid uid, GravityComponent? gravity = null) { if (!Resolve(uid, ref gravity)) return; - if (gravity.Enabled) + if (gravity.Enabled || gravity.Inherent) return; gravity.Enabled = true; diff --git a/Content.Server/Maps/PlanetCommand.cs b/Content.Server/Maps/PlanetCommand.cs index ed69124d33..8bfd2b9de7 100644 --- a/Content.Server/Maps/PlanetCommand.cs +++ b/Content.Server/Maps/PlanetCommand.cs @@ -71,6 +71,7 @@ public sealed class PlanetCommand : IConsoleCommand var gravity = _entManager.EnsureComponent(mapUid); gravity.Enabled = true; + gravity.Inherent = true; _entManager.Dirty(gravity, metadata); // Day lighting diff --git a/Content.Shared/Gravity/GravityComponent.cs b/Content.Shared/Gravity/GravityComponent.cs index 638e629943..0ddc2d275f 100644 --- a/Content.Shared/Gravity/GravityComponent.cs +++ b/Content.Shared/Gravity/GravityComponent.cs @@ -27,5 +27,12 @@ namespace Content.Shared.Gravity [DataField("enabled")] public bool Enabled; + + /// + /// Inherent gravity ensures GravitySystem won't change Enabled according to the gravity generators attached to this entity. + /// + [ViewVariables(VVAccess.ReadWrite)] + [DataField("inherent")] + public bool Inherent; } }