Files
tbd-station-14/Content.Server/Chemistry/EntitySystems/HypospraySystem.cs
Ygg01 b2aca94586 Refactor Solution from Shared -> Server (#5078)
* Move entity solution entity systems to shared

* Move SolutionComponents to Server

* Fix namespaces

* Remove Networked Component.

* Fixes

* Add components to ignore list
2021-10-29 23:40:15 +11:00

45 lines
1.3 KiB
C#

using Content.Server.Chemistry.Components;
using Content.Shared.Interaction;
using Content.Shared.Weapons.Melee;
using JetBrains.Annotations;
using Robust.Shared.GameObjects;
namespace Content.Server.Chemistry.EntitySystems
{
[UsedImplicitly]
public class HypospraySystem : EntitySystem
{
public override void Initialize()
{
base.Initialize();
SubscribeLocalEvent<HyposprayComponent, AfterInteractEvent>(OnAfterInteract);
SubscribeLocalEvent<HyposprayComponent, ClickAttackEvent>(OnClickAttack);
SubscribeLocalEvent<HyposprayComponent, SolutionChangedEvent>(OnSolutionChange);
}
private void OnSolutionChange(EntityUid uid, HyposprayComponent component, SolutionChangedEvent args)
{
component.Dirty();
}
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);
}
}
}