Fix gravity mispredict (#10017)
This commit is contained in:
@@ -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)
|
||||||
|
|||||||
Reference in New Issue
Block a user