public sealed partial class RevenantSystem
{
+ [Dependency] private readonly EmagSystem _emagSystem = default!;
[Dependency] private readonly ThrowingSystem _throwing = default!;
[Dependency] private readonly EntityStorageSystem _entityStorage = default!;
[Dependency] private readonly SharedAppearanceSystem _appearance = default!;
_whitelistSystem.IsBlacklistPass(component.MalfunctionBlacklist, ent))
continue;
- var ev = new GotEmaggedEvent(uid, EmagType.Interaction | EmagType.Access);
- RaiseLocalEvent(ent, ref ev);
+ _emagSystem.TryEmagEffect(uid, uid, ent);
}
}
}
}
/// <summary>
- /// Does the emag effect on a specified entity
+ /// Does the emag effect on a specified entity with a specified EmagType. The optional field customEmagType can be used to override the emag type defined in the component.
/// </summary>
- public bool TryEmagEffect(Entity<EmagComponent?> ent, EntityUid user, EntityUid target)
+ public bool TryEmagEffect(Entity<EmagComponent?> ent, EntityUid user, EntityUid target, EmagType? customEmagType = null)
{
if (!Resolve(ent, ref ent.Comp, false))
return false;
return false;
}
- var emaggedEvent = new GotEmaggedEvent(user, ent.Comp.EmagType);
+ var typeToUse = customEmagType ?? ent.Comp.EmagType;
+
+ var emaggedEvent = new GotEmaggedEvent(user, typeToUse);
RaiseLocalEvent(target, ref emaggedEvent);
if (!emaggedEvent.Handled)
_audio.PlayPredicted(ent.Comp.EmagSound, ent, ent);
- _adminLogger.Add(LogType.Emag, LogImpact.High, $"{ToPrettyString(user):player} emagged {ToPrettyString(target):target} with flag(s): {ent.Comp.EmagType}");
+ _adminLogger.Add(LogType.Emag, LogImpact.High, $"{ToPrettyString(user):player} emagged {ToPrettyString(target):target} with flag(s): {typeToUse}");
if (emaggedEvent.Handled)
_sharedCharges.TryUseCharge(chargesEnt);
{
EnsureComp<EmaggedComponent>(target, out var emaggedComp);
- emaggedComp.EmagType |= ent.Comp.EmagType;
+ emaggedComp.EmagType |= typeToUse;
Dirty(target, emaggedComp);
}
[Flags]
[Serializable, NetSerializable]
-public enum EmagType : byte
+public enum EmagType
{
None = 0,
+ All = ~None,
Interaction = 1 << 1,
Access = 1 << 2
}