Finish refactoring tools. Add multitools. (as in multiple tools in one)
This commit is contained in:
36
Content.Server/GameObjects/Components/AnchorableComponent.cs
Normal file
36
Content.Server/GameObjects/Components/AnchorableComponent.cs
Normal file
@@ -0,0 +1,36 @@
|
||||
using Content.Server.GameObjects.Components.Interactable;
|
||||
using Content.Server.GameObjects.EntitySystems;
|
||||
using Content.Shared.GameObjects.Components.Interactable;
|
||||
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
|
||||
{
|
||||
public override string Name => "Anchorable";
|
||||
|
||||
public override void Initialize()
|
||||
{
|
||||
base.Initialize();
|
||||
Owner.EnsureComponent<PhysicsComponent>();
|
||||
}
|
||||
|
||||
public bool WrenchAct(WrenchActEventArgs eventArgs)
|
||||
{
|
||||
if (!Owner.TryGetComponent(out PhysicsComponent physics))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
physics.Anchored = !physics.Anchored;
|
||||
eventArgs.ToolComponent.PlayUseSound();
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user