Files
tbd-station-14/Content.Server/Botany/Systems/LogSystem.cs
2022-05-13 17:59:03 +10:00

31 lines
832 B
C#

using Content.Server.Botany.Components;
using Content.Server.Kitchen.Components;
using Content.Shared.Interaction;
using Content.Shared.Random.Helpers;
namespace Content.Server.Botany.Systems;
public sealed class LogSystem : EntitySystem
{
public override void Initialize()
{
base.Initialize();
SubscribeLocalEvent<LogComponent, InteractUsingEvent>(OnInteractUsing);
}
private void OnInteractUsing(EntityUid uid, LogComponent component, InteractUsingEvent args)
{
if (HasComp<SharpComponent>(args.Used))
{
for (var i = 0; i < component.SpawnCount; i++)
{
var plank = Spawn(component.SpawnedPrototype, Transform(uid).Coordinates);
plank.RandomOffset(0.25f);
}
QueueDel(uid);
}
}
}