Gravity "Inherent" property for planet maps (#16695)

This commit is contained in:
20kdc
2023-07-16 20:01:54 +01:00
committed by GitHub
parent 99e6f8f0bc
commit 69ff0ae2e6
3 changed files with 17 additions and 1 deletions

View File

@@ -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<GravityGeneratorComponent, TransformComponent>(true))
@@ -52,12 +55,17 @@ namespace Content.Server.Gravity
RefreshGravity(uid);
}
/// <summary>
/// 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.
/// </summary>
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;