Fix weightlessness status effect appearing only after something checks if an entity is weightless (#2434)
* Revert "Add weightlessness status effect. (#2384)"
This reverts commit 9b751fc079.
* Bring back the icon and status
* Make weightless status track gravity and parent
This commit is contained in:
@@ -3,6 +3,7 @@ using System.Linq;
|
||||
using Content.Server.GameObjects.Components.Gravity;
|
||||
using Content.Server.GameObjects.Components.Mobs;
|
||||
using Content.Shared.GameObjects.Components.Gravity;
|
||||
using Content.Shared.GameObjects.EntitySystemMessages.Gravity;
|
||||
using JetBrains.Annotations;
|
||||
using Robust.Server.GameObjects.EntitySystems;
|
||||
using Robust.Server.Interfaces.Player;
|
||||
@@ -41,7 +42,7 @@ namespace Content.Server.GameObjects.EntitySystems
|
||||
{
|
||||
generator.UpdateState();
|
||||
}
|
||||
|
||||
|
||||
if (generator.Status == GravityGeneratorStatus.On)
|
||||
{
|
||||
gridsWithGravity.Add(generator.Owner.Transform.GridID);
|
||||
@@ -52,12 +53,11 @@ namespace Content.Server.GameObjects.EntitySystems
|
||||
{
|
||||
if (grid.HasGravity && !gridsWithGravity.Contains(grid.Index))
|
||||
{
|
||||
grid.HasGravity = false;
|
||||
ScheduleGridToShake(grid.Index, ShakeTimes);
|
||||
} else if (!grid.HasGravity && gridsWithGravity.Contains(grid.Index))
|
||||
DisableGravity(grid);
|
||||
}
|
||||
else if (!grid.HasGravity && gridsWithGravity.Contains(grid.Index))
|
||||
{
|
||||
grid.HasGravity = true;
|
||||
ScheduleGridToShake(grid.Index, ShakeTimes);
|
||||
EnableGravity(grid);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -68,6 +68,26 @@ namespace Content.Server.GameObjects.EntitySystems
|
||||
}
|
||||
}
|
||||
|
||||
private void EnableGravity(IMapGrid grid)
|
||||
{
|
||||
grid.HasGravity = true;
|
||||
ScheduleGridToShake(grid.Index, ShakeTimes);
|
||||
|
||||
var message = new GravityChangedMessage(grid);
|
||||
|
||||
RaiseLocalEvent(message);
|
||||
}
|
||||
|
||||
private void DisableGravity(IMapGrid grid)
|
||||
{
|
||||
grid.HasGravity = false;
|
||||
ScheduleGridToShake(grid.Index, ShakeTimes);
|
||||
|
||||
var message = new GravityChangedMessage(grid);
|
||||
|
||||
RaiseLocalEvent(message);
|
||||
}
|
||||
|
||||
private void ScheduleGridToShake(GridId gridId, uint shakeTimes)
|
||||
{
|
||||
if (!_gridsToShake.Keys.Contains(gridId))
|
||||
|
||||
Reference in New Issue
Block a user