* basics & visuals * pneumatic cannon works perf * loc + popups * gas tank does stuff + queue changes * updates * b * forcefeeding * inhand * crafting! * pie cannon now is a pneumatic cannon * oopy * fix for entman + verbs * pie * change for tools * actual * combat mode + better sounds * reviews
37 lines
1.2 KiB
C#
37 lines
1.2 KiB
C#
using Content.Server.Nutrition.Components;
|
|
using Content.Shared.Throwing;
|
|
using Robust.Shared.GameObjects;
|
|
|
|
namespace Content.Server.Nutrition.EntitySystems
|
|
{
|
|
public class ForcefeedOnCollideSystem : EntitySystem
|
|
{
|
|
public override void Initialize()
|
|
{
|
|
base.Initialize();
|
|
|
|
SubscribeLocalEvent<ForcefeedOnCollideComponent, ThrowDoHitEvent>(OnThrowDoHit);
|
|
SubscribeLocalEvent<ForcefeedOnCollideComponent, LandEvent>(OnLand);
|
|
}
|
|
|
|
private void OnThrowDoHit(EntityUid uid, ForcefeedOnCollideComponent component, ThrowDoHitEvent args)
|
|
{
|
|
if (!args.Target.HasComponent<HungerComponent>())
|
|
return;
|
|
if (!EntityManager.TryGetComponent<FoodComponent>(uid, out var food))
|
|
return;
|
|
|
|
// the 'target' isnt really the 'user' per se.. but..
|
|
food.TryUseFood(args.Target, args.Target);
|
|
}
|
|
|
|
private void OnLand(EntityUid uid, ForcefeedOnCollideComponent component, LandEvent args)
|
|
{
|
|
if (!component.RemoveOnThrowEnd)
|
|
return;
|
|
|
|
EntityManager.RemoveComponent(uid, component);
|
|
}
|
|
}
|
|
}
|