using Content.Shared.Inventory; using Content.Shared.StatusEffect; namespace Content.Shared.Electrocution { public abstract class SharedElectrocutionSystem : EntitySystem { [Dependency] private readonly SharedAppearanceSystem _appearance = default!; public override void Initialize() { base.Initialize(); SubscribeLocalEvent(OnInsulatedElectrocutionAttempt); // as long as legally distinct electric-mice are never added, this should be fine (otherwise a mouse-hat will transfer it's power to the wearer). SubscribeLocalEvent>((e, c, ev) => OnInsulatedElectrocutionAttempt(e, c, ev.Args)); } public void SetInsulatedSiemensCoefficient(EntityUid uid, float siemensCoefficient, InsulatedComponent? insulated = null) { if (!Resolve(uid, ref insulated)) return; insulated.Coefficient = siemensCoefficient; Dirty(uid, insulated); } /// /// Sets electrified value of component and marks dirty if required. /// public void SetElectrified(Entity ent, bool value) { if (ent.Comp.Enabled == value) { return; } ent.Comp.Enabled = value; Dirty(ent, ent.Comp); _appearance.SetData(ent.Owner, ElectrifiedVisuals.IsElectrified, value); } public void SetElectrifiedWireCut(Entity ent, bool value) { if (ent.Comp.IsWireCut == value) { return; } ent.Comp.IsWireCut = value; Dirty(ent); } /// Entity being electrocuted. /// Source entity of the electrocution. /// How much shock damage the entity takes. /// How long the entity will be stunned. /// Should time be refreshed (instead of accumilated) if the entity is already electrocuted? /// How insulated the entity is from the shock. 0 means completely insulated, and 1 means no insulation. /// Status effects to apply to the entity. /// Should the electrocution bypass the Insulated component? /// Whether the entity was stunned by the shock. public virtual bool TryDoElectrocution( EntityUid uid, EntityUid? sourceUid, int shockDamage, TimeSpan time, bool refresh, float siemensCoefficient = 1f, StatusEffectsComponent? statusEffects = null, bool ignoreInsulation = false) { // only done serverside return false; } private void OnInsulatedElectrocutionAttempt(EntityUid uid, InsulatedComponent insulated, ElectrocutionAttemptEvent args) { args.SiemensCoefficient *= insulated.Coefficient; } } }