Files
tbd-station-14/Content.Server/Botany/Components/LogComponent.cs
Vera Aguilera Puerto c2e6da1e54 Inline QueueDelete
2021-12-03 11:43:22 +01:00

39 lines
1.1 KiB
C#

using System.Threading.Tasks;
using Content.Shared.ActionBlocker;
using Content.Shared.Interaction;
using Content.Shared.Interaction.Events;
using Content.Shared.Random.Helpers;
using Content.Shared.Tag;
using Robust.Shared.GameObjects;
using Robust.Shared.IoC;
namespace Content.Server.Botany.Components
{
[RegisterComponent]
public class LogComponent : Component, IInteractUsing
{
public override string Name => "Log";
async Task<bool> IInteractUsing.InteractUsing(InteractUsingEventArgs eventArgs)
{
if (!EntitySystem.Get<ActionBlockerSystem>().CanInteract(eventArgs.User.Uid))
return false;
if (eventArgs.Using.HasTag("BotanySharp"))
{
for (var i = 0; i < 2; i++)
{
var plank = IoCManager.Resolve<IEntityManager>().SpawnEntity("MaterialWoodPlank1", Owner.Transform.Coordinates);
plank.RandomOffset(0.25f);
}
IoCManager.Resolve<IEntityManager>().QueueDeleteEntity(Owner.Uid);
return true;
}
return false;
}
}
}