Fix gravity mispredict (#10017)

This commit is contained in:
metalgearsloth
2022-07-25 16:55:24 +10:00
committed by GitHub
parent 12d8987dde
commit 04cb1d63dd

View File

@@ -46,21 +46,28 @@ namespace Content.Server.Gravity.EntitySystems
public void EnableGravity(GravityComponent comp) public void EnableGravity(GravityComponent comp)
{ {
if (comp.Enabled) return; if (comp.Enabled)
return;
var gridId = Transform(comp.Owner).GridUid; var gridId = Transform(comp.Owner).GridUid;
Dirty(comp);
if (gridId == null) if (gridId == null)
return; return;
comp.Enabled = true; comp.Enabled = true;
var message = new GravityChangedEvent(gridId.Value, true); var message = new GravityChangedEvent(gridId.Value, true);
RaiseLocalEvent(message); RaiseLocalEvent(message);
} }
public void DisableGravity(GravityComponent comp) public void DisableGravity(GravityComponent comp)
{ {
if (!comp.Enabled) return; if (!comp.Enabled)
return;
comp.Enabled = false; comp.Enabled = false;
Dirty(comp);
var gridId = Transform(comp.Owner).GridUid; var gridId = Transform(comp.Owner).GridUid;
if (gridId == null) if (gridId == null)