CatStation/Content.Shared/Trigger/Systems/ShockOnTriggerSystem.cs
Pieter-Jan Briers 5168b5f3d4
IoC source gen compatibility (#43863)
* IoC source gen compatibility

Can be merged before or after https://github.com/space-wizards/RobustToolbox/pull/6549 doesn't really matter.

* Missed a spot
2026-05-09 03:29:58 +00:00

27 lines
1,018 B
C#

using Content.Shared.Electrocution;
using Content.Shared.Trigger.Components.Effects;
using Robust.Shared.Containers;
namespace Content.Shared.Trigger.Systems;
public sealed partial class ShockOnTriggerSystem : XOnTriggerSystem<ShockOnTriggerComponent>
{
[Dependency] private SharedContainerSystem _container = default!;
[Dependency] private SharedElectrocutionSystem _electrocution = default!;
protected override void OnTrigger(Entity<ShockOnTriggerComponent> ent, EntityUid target, ref TriggerEvent args)
{
// Override the normal target if we target the container
if (ent.Comp.TargetContainer)
{
// shock whoever is wearing this clothing item
if (!_container.TryGetContainingContainer(ent.Owner, out var container))
return;
target = container.Owner;
}
_electrocution.TryDoElectrocution(target, null, ent.Comp.Damage, ent.Comp.Duration, true, ignoreInsulation: true);
args.Handled = true;
}
}