@@ -3,7 +3,6 @@ using System.Threading.Tasks;
|
||||
using Content.Shared.Construction;
|
||||
using JetBrains.Annotations;
|
||||
using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.Physics;
|
||||
using Robust.Shared.Serialization;
|
||||
|
||||
namespace Content.Server.Construction.Completions
|
||||
@@ -20,9 +19,9 @@ namespace Content.Server.Construction.Completions
|
||||
|
||||
public async Task PerformAction(IEntity entity, IEntity? user)
|
||||
{
|
||||
if (!entity.TryGetComponent(out IPhysBody? physics)) return;
|
||||
if (!entity.TryGetComponent(out IPhysicsComponent? physics)) return;
|
||||
|
||||
physics.BodyType = Value ? BodyType.Static : BodyType.Dynamic;
|
||||
physics.Anchored = Value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
using Content.Shared.Construction;
|
||||
using JetBrains.Annotations;
|
||||
using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.Physics;
|
||||
using Robust.Shared.Serialization;
|
||||
using Robust.Shared.Utility;
|
||||
|
||||
@@ -20,21 +19,21 @@ namespace Content.Server.Construction.Conditions
|
||||
|
||||
public async Task<bool> Condition(IEntity entity)
|
||||
{
|
||||
if (!entity.TryGetComponent(out IPhysBody physics)) return false;
|
||||
if (!entity.TryGetComponent(out IPhysicsComponent physics)) return false;
|
||||
|
||||
return (physics.BodyType == BodyType.Static && Anchored) || (physics.BodyType != BodyType.Static && !Anchored);
|
||||
return physics.Anchored == Anchored;
|
||||
}
|
||||
|
||||
public bool DoExamine(IEntity entity, FormattedMessage message, bool inDetailsRange)
|
||||
{
|
||||
if (!entity.TryGetComponent(out IPhysBody physics)) return false;
|
||||
if (!entity.TryGetComponent(out IPhysicsComponent physics)) return false;
|
||||
|
||||
switch (Anchored)
|
||||
{
|
||||
case true when physics.BodyType == BodyType.Static:
|
||||
case true when !physics.Anchored:
|
||||
message.AddMarkup("First, anchor it.\n");
|
||||
return true;
|
||||
case false when physics.BodyType == BodyType.Static:
|
||||
case false when physics.Anchored:
|
||||
message.AddMarkup("First, unanchor it.\n");
|
||||
return true;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user