diff --git a/Content.Server/Electrocution/ElectrocutionSystem.cs b/Content.Server/Electrocution/ElectrocutionSystem.cs index 42c0cb2500..9e6ec7fbbd 100644 --- a/Content.Server/Electrocution/ElectrocutionSystem.cs +++ b/Content.Server/Electrocution/ElectrocutionSystem.cs @@ -1,4 +1,5 @@ using Content.Server.Administration.Logs; +using Content.Server.Light.Components; using Content.Server.NodeContainer; using Content.Server.NodeContainer.EntitySystems; using Content.Server.NodeContainer.NodeGroups; @@ -76,6 +77,7 @@ public sealed class ElectrocutionSystem : SharedElectrocutionSystem SubscribeLocalEvent(OnElectrifiedHandInteract); SubscribeLocalEvent(OnElectrifiedInteractUsing); SubscribeLocalEvent(OnRandomInsulationMapInit); + SubscribeLocalEvent(OnLightAttacked); UpdatesAfter.Add(typeof(PowerNetSystem)); } @@ -159,15 +161,15 @@ public sealed class ElectrocutionSystem : SharedElectrocutionSystem TryDoElectrifiedAct(uid, args.OtherEntity, 1, electrified); } - private void OnElectrifiedAttacked(EntityUid uid, ElectrifiedComponent electrified, AttackedEvent args) - { - if (!electrified.OnAttacked) - return; + private void OnElectrifiedAttacked(EntityUid uid, ElectrifiedComponent electrified, AttackedEvent args) + { + if (!electrified.OnAttacked) + return; - if (_meleeWeapon.GetDamage(args.Used, args.User).Total == 0) - return; + if (_meleeWeapon.GetDamage(args.Used, args.User).Total == 0) + return; - TryDoElectrifiedAct(uid, args.User, 1, electrified); + TryDoElectrifiedAct(uid, args.User, 1, electrified); } private void OnElectrifiedHandInteract(EntityUid uid, ElectrifiedComponent electrified, InteractHandEvent args) @@ -176,6 +178,22 @@ public sealed class ElectrocutionSystem : SharedElectrocutionSystem TryDoElectrifiedAct(uid, args.User, 1, electrified); } + private void OnLightAttacked(EntityUid uid, PoweredLightComponent component, AttackedEvent args) + { + + if (_meleeWeapon.GetDamage(args.Used, args.User).Total == 0) + return; + + if (args.Used != args.User) + return; + + if (component.CurrentLit == false) + return; + + DoCommonElectrocution(args.User, uid, component.UnarmedHitShock, component.UnarmedHitStun, false, 1); + + } + private void OnElectrifiedInteractUsing(EntityUid uid, ElectrifiedComponent electrified, InteractUsingEvent args) { if (!electrified.OnInteractUsing) diff --git a/Content.Server/Light/Components/PoweredLightComponent.cs b/Content.Server/Light/Components/PoweredLightComponent.cs index 0076e00b6a..676aa38223 100644 --- a/Content.Server/Light/Components/PoweredLightComponent.cs +++ b/Content.Server/Light/Components/PoweredLightComponent.cs @@ -68,5 +68,17 @@ namespace Content.Server.Light.Components /// [DataField("ejectBulbDelay")] public float EjectBulbDelay = 2; + + /// + /// Shock damage done to a mob that hits the light with an unarmed attack + /// + [DataField("unarmedHitShock")] + public int UnarmedHitShock = 20; + + /// + /// Stun duration applied to a mob that hits the light with an unarmed attack + /// + [DataField("unarmedHitStun")] + public TimeSpan UnarmedHitStun = TimeSpan.FromSeconds(5); } }