From 4a161325f5a33739a9f9a3bd20b29d834b6199c7 Mon Sep 17 00:00:00 2001 From: Flipp Syder <76629141+vulppine@users.noreply.github.com> Date: Sat, 4 Dec 2021 01:59:09 -0800 Subject: [PATCH] adds interactusing to electrocution (#5693) --- .../Electrocution/Components/ElectrifiedComponent.cs | 3 +++ Content.Server/Electrocution/ElectrocutionSystem.cs | 9 +++++++++ 2 files changed, 12 insertions(+) diff --git a/Content.Server/Electrocution/Components/ElectrifiedComponent.cs b/Content.Server/Electrocution/Components/ElectrifiedComponent.cs index 1c10308613..9e0da6d030 100644 --- a/Content.Server/Electrocution/Components/ElectrifiedComponent.cs +++ b/Content.Server/Electrocution/Components/ElectrifiedComponent.cs @@ -26,6 +26,9 @@ namespace Content.Server.Electrocution [DataField("onHandInteract")] public bool OnHandInteract { get; set; } = true; + [DataField("onInteractUsing")] + public bool OnInteractUsing { get; set; } = true; + [DataField("requirePower")] public bool RequirePower { get; } = true; diff --git a/Content.Server/Electrocution/ElectrocutionSystem.cs b/Content.Server/Electrocution/ElectrocutionSystem.cs index 8abce7202a..4e02c239f0 100644 --- a/Content.Server/Electrocution/ElectrocutionSystem.cs +++ b/Content.Server/Electrocution/ElectrocutionSystem.cs @@ -75,6 +75,7 @@ namespace Content.Server.Electrocution SubscribeLocalEvent(OnElectrifiedStartCollide); SubscribeLocalEvent(OnElectrifiedAttacked); SubscribeLocalEvent(OnElectrifiedHandInteract); + SubscribeLocalEvent(OnElectrifiedInteractUsing); SubscribeLocalEvent(OnRandomInsulationMapInit); UpdatesAfter.Add(typeof(PowerNetSystem)); @@ -142,6 +143,14 @@ namespace Content.Server.Electrocution TryDoElectrifiedAct(uid, args.User.Uid, electrified); } + private void OnElectrifiedInteractUsing(EntityUid uid, ElectrifiedComponent electrified, InteractUsingEvent args) + { + if (!electrified.OnInteractUsing) + return; + + TryDoElectrifiedAct(uid, args.User.Uid, electrified); + } + public bool TryDoElectrifiedAct(EntityUid uid, EntityUid targetUid, ElectrifiedComponent? electrified = null, NodeContainerComponent? nodeContainer = null,