mirror of
https://github.com/space-syndicate/space-station-14.git
synced 2026-10-10 02:41:18 +03:00
* 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
28 lines
1,004 B
C#
28 lines
1,004 B
C#
using Content.Shared.Lock;
|
|
using Content.Shared.Trigger.Components.Effects;
|
|
|
|
namespace Content.Shared.Trigger.Systems;
|
|
|
|
public sealed partial class LockOnTriggerSystem : XOnTriggerSystem<LockOnTriggerComponent>
|
|
{
|
|
[Dependency] private LockSystem _lock = default!;
|
|
|
|
protected override void OnTrigger(Entity<LockOnTriggerComponent> ent, EntityUid target, ref TriggerEvent args)
|
|
{
|
|
if (!TryComp<LockComponent>(target, out var lockComp))
|
|
return; // prevent the Resolve in Lock/Unlock/ToggleLock from logging errors in case the user does not have the component
|
|
|
|
switch (ent.Comp.LockMode)
|
|
{
|
|
case LockAction.Lock:
|
|
_lock.Lock(target, args.User, lockComp);
|
|
break;
|
|
case LockAction.Unlock:
|
|
_lock.Unlock(target, args.User, lockComp);
|
|
break;
|
|
case LockAction.Toggle:
|
|
_lock.ToggleLock(target, args.User, lockComp);
|
|
break;
|
|
}
|
|
}
|
|
}
|