Remove usages of physics anchored from content

This commit is contained in:
Pieter-Jan Briers
2021-05-13 02:13:12 +02:00
parent 251df93b71
commit 26c2d9f479
3 changed files with 7 additions and 5 deletions

View File

@@ -8,6 +8,7 @@ using Robust.Shared.GameObjects;
using Robust.Shared.IoC;
using Robust.Shared.Map;
using Robust.Shared.Maths;
using Robust.Shared.Physics;
using Robust.Shared.Random;
using Robust.Shared.Serialization.Manager.Attributes;
using Robust.Shared.ViewVariables;
@@ -58,9 +59,9 @@ namespace Content.Server.GameObjects.Components.Atmos
if (moveProb > ProbabilityOffset && _robustRandom.Prob(MathF.Min(moveProb / 100f, 1f))
&& !float.IsPositiveInfinity(MoveResist)
&& (!physics.Anchored
&& (physics.BodyType != BodyType.Static
&& (maxForce >= (MoveResist * MoveForcePushRatio)))
|| (physics.Anchored && (maxForce >= (MoveResist * MoveForceForcePushRatio))))
|| (physics.BodyType == BodyType.Static && (maxForce >= (MoveResist * MoveForceForcePushRatio))))
{
if (physics.Owner.HasComponent<IMobStateComponent>())

View File

@@ -4,6 +4,7 @@ using Robust.Server.Console;
using Robust.Server.GameObjects;
using Robust.Shared.GameObjects;
using Robust.Shared.IoC;
using Robust.Shared.Physics;
namespace Content.Server.GlobalVerbs
{
@@ -30,7 +31,7 @@ namespace Content.Server.GlobalVerbs
if (groupController.CanCommand(player.PlayerSession, "setanchor"))
{
data.Text = physics.Anchored ? "Unanchor" : "Anchor";
data.Text = physics.BodyType == BodyType.Static ? "Unanchor" : "Anchor";
data.Visibility = VerbVisibility.Visible;
}
}
@@ -46,7 +47,7 @@ namespace Content.Server.GlobalVerbs
if (target.TryGetComponent(out PhysicsComponent? physics))
{
physics.Anchored = !physics.Anchored;
physics.BodyType = physics.BodyType == BodyType.Static ? BodyType.Dynamic : BodyType.Static;
}
}
}

View File

@@ -210,7 +210,7 @@ namespace Content.Shared.GameObjects.Components.Pulling
return false;
}
if (_physics.Anchored)
if (_physics.BodyType == BodyType.Static)
{
return false;
}