2021-06-09 22:19:39 +02:00
|
|
|
|
using Content.Server.Chemistry.Components;
|
|
|
|
|
|
using Content.Shared.Interaction;
|
|
|
|
|
|
using Content.Shared.Weapons.Melee;
|
2021-09-06 15:49:44 +02:00
|
|
|
|
using JetBrains.Annotations;
|
2021-06-05 00:20:52 -07:00
|
|
|
|
using Robust.Shared.GameObjects;
|
|
|
|
|
|
|
2021-06-09 22:19:39 +02:00
|
|
|
|
namespace Content.Server.Chemistry.EntitySystems
|
2021-06-05 00:20:52 -07:00
|
|
|
|
{
|
2021-09-06 15:49:44 +02:00
|
|
|
|
[UsedImplicitly]
|
2021-06-05 00:20:52 -07:00
|
|
|
|
public class HypospraySystem : EntitySystem
|
|
|
|
|
|
{
|
|
|
|
|
|
public override void Initialize()
|
|
|
|
|
|
{
|
|
|
|
|
|
base.Initialize();
|
|
|
|
|
|
|
|
|
|
|
|
SubscribeLocalEvent<HyposprayComponent, AfterInteractEvent>(OnAfterInteract);
|
|
|
|
|
|
SubscribeLocalEvent<HyposprayComponent, ClickAttackEvent>(OnClickAttack);
|
2021-09-06 15:49:44 +02:00
|
|
|
|
SubscribeLocalEvent<HyposprayComponent, SolutionChangedEvent>(OnSolutionChange);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private void OnSolutionChange(EntityUid uid, HyposprayComponent component, SolutionChangedEvent args)
|
|
|
|
|
|
{
|
|
|
|
|
|
component.Dirty();
|
2021-06-05 00:20:52 -07:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public void OnAfterInteract(EntityUid uid, HyposprayComponent comp, AfterInteractEvent args)
|
|
|
|
|
|
{
|
|
|
|
|
|
if (!args.CanReach)
|
|
|
|
|
|
return;
|
|
|
|
|
|
var target = args.Target;
|
|
|
|
|
|
var user = args.User;
|
|
|
|
|
|
|
|
|
|
|
|
comp.TryDoInject(target, user);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public void OnClickAttack(EntityUid uid, HyposprayComponent comp, ClickAttackEvent args)
|
|
|
|
|
|
{
|
|
|
|
|
|
var target = args.TargetEntity;
|
|
|
|
|
|
var user = args.User;
|
|
|
|
|
|
|
|
|
|
|
|
comp.TryDoInject(target, user);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|