Files
crystall-punk-14/Content.Server/GameObjects/Components/AnchorableComponent.cs

37 lines
1.0 KiB
C#
Raw Normal View History

using Content.Server.GameObjects.Components.Interactable;
2019-11-06 17:22:55 +01:00
using Content.Server.GameObjects.EntitySystems;
using Content.Shared.GameObjects.Components.Interactable;
2019-11-06 17:22:55 +01:00
using Robust.Server.GameObjects;
using Robust.Server.GameObjects.EntitySystems;
using Robust.Shared.GameObjects;
using Robust.Shared.Interfaces.GameObjects;
using Robust.Shared.IoC;
namespace Content.Server.GameObjects.Components
{
[RegisterComponent]
public class AnchorableComponent : Component, IWrenchAct
2019-11-06 17:22:55 +01:00
{
public override string Name => "Anchorable";
2019-11-06 17:22:55 +01:00
public override void Initialize()
{
base.Initialize();
Owner.EnsureComponent<PhysicsComponent>();
2019-11-06 17:22:55 +01:00
}
public bool WrenchAct(WrenchActEventArgs eventArgs)
2019-11-06 17:22:55 +01:00
{
if (!Owner.TryGetComponent(out PhysicsComponent physics))
{
return false;
}
physics.Anchored = !physics.Anchored;
eventArgs.ToolComponent.PlayUseSound();
2019-11-06 17:22:55 +01:00
return true;
}
}
}