mirror of
https://github.com/space-wizards/space-station-14.git
synced 2026-02-15 03:31:30 +01:00
* init * nobody will ever know i copy paste * i hate these names * comment --------- Co-authored-by: iaada <iaada@users.noreply.github.com>
24 lines
831 B
C#
24 lines
831 B
C#
using Content.Shared.Nutrition;
|
|
using Content.Shared.Trigger.Components.Triggers;
|
|
|
|
namespace Content.Shared.Trigger.Systems;
|
|
|
|
public sealed partial class TriggerOnIngestedSystem : TriggerOnXSystem
|
|
{
|
|
public override void Initialize()
|
|
{
|
|
base.Initialize();
|
|
|
|
SubscribeLocalEvent<TriggerOnIngestedComponent, IngestedEvent>(OnIngested);
|
|
}
|
|
|
|
private void OnIngested(Entity<TriggerOnIngestedComponent> ent, ref IngestedEvent args)
|
|
{
|
|
// args.Target is the entity being fed, while args.User is the entity doing the feeding.
|
|
// Since they are not always equal (feeding someone by force, for example) we use a bool to decide which one is the trigger user.
|
|
var user = ent.Comp.EatingIsUser ? args.Target : args.User;
|
|
|
|
Trigger.Trigger(ent.Owner, user, ent.Comp.KeyOut);
|
|
}
|
|
}
|