ECS botany except for plantholder (#6466)
This commit is contained in:
32
Content.Server/Botany/Systems/LogSystem.cs
Normal file
32
Content.Server/Botany/Systems/LogSystem.cs
Normal file
@@ -0,0 +1,32 @@
|
||||
using Content.Server.Botany.Components;
|
||||
using Content.Shared.ActionBlocker;
|
||||
using Content.Shared.Interaction;
|
||||
using Content.Shared.Random.Helpers;
|
||||
using Content.Shared.Tag;
|
||||
using Robust.Shared.GameObjects;
|
||||
|
||||
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 (args.Used.HasTag("BotanySharp"))
|
||||
{
|
||||
for (var i = 0; i < component.SpawnCount; i++)
|
||||
{
|
||||
var plank = Spawn(component.SpawnedPrototype, Transform(uid).Coordinates);
|
||||
plank.RandomOffset(0.25f);
|
||||
}
|
||||
|
||||
QueueDel(uid);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user