2021-02-23 07:48:57 +00:00
|
|
|
using System.Threading.Tasks;
|
2021-06-09 22:19:39 +02:00
|
|
|
using Content.Shared.ActionBlocker;
|
|
|
|
|
using Content.Shared.Interaction;
|
|
|
|
|
using Content.Shared.Random.Helpers;
|
|
|
|
|
using Content.Shared.Tag;
|
2020-10-26 23:19:46 +01:00
|
|
|
using Robust.Shared.GameObjects;
|
2021-12-03 11:11:52 +01:00
|
|
|
using Robust.Shared.IoC;
|
2020-10-26 23:19:46 +01:00
|
|
|
|
2021-06-09 22:19:39 +02:00
|
|
|
namespace Content.Server.Botany.Components
|
2020-10-26 23:19:46 +01:00
|
|
|
{
|
|
|
|
|
[RegisterComponent]
|
|
|
|
|
public class LogComponent : Component, IInteractUsing
|
|
|
|
|
{
|
|
|
|
|
public override string Name => "Log";
|
|
|
|
|
|
2021-02-04 17:44:49 +01:00
|
|
|
async Task<bool> IInteractUsing.InteractUsing(InteractUsingEventArgs eventArgs)
|
2020-10-26 23:19:46 +01:00
|
|
|
{
|
2021-12-03 15:53:09 +01:00
|
|
|
if (!EntitySystem.Get<ActionBlockerSystem>().CanInteract(eventArgs.User))
|
2020-10-26 23:19:46 +01:00
|
|
|
return false;
|
|
|
|
|
|
2021-12-08 17:04:21 +01:00
|
|
|
var entMan = IoCManager.Resolve<IEntityManager>();
|
|
|
|
|
|
2021-02-23 07:48:57 +00:00
|
|
|
if (eventArgs.Using.HasTag("BotanySharp"))
|
2020-10-26 23:19:46 +01:00
|
|
|
{
|
|
|
|
|
for (var i = 0; i < 2; i++)
|
|
|
|
|
{
|
2021-12-08 17:04:21 +01:00
|
|
|
var plank = entMan.SpawnEntity("MaterialWoodPlank1", entMan.GetComponent<TransformComponent>(Owner).Coordinates);
|
2020-10-26 23:19:46 +01:00
|
|
|
plank.RandomOffset(0.25f);
|
|
|
|
|
}
|
|
|
|
|
|
2021-12-08 17:04:21 +01:00
|
|
|
entMan.QueueDeleteEntity(Owner);
|
2020-10-26 23:19:46 +01:00
|
|
|
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|