From 921717d9cd26ce70a1b6bd1e642109932f21e947 Mon Sep 17 00:00:00 2001 From: raspy <47289484+raspy-on-osu@users.noreply.github.com> Date: Fri, 22 Oct 2021 21:58:39 -0400 Subject: [PATCH] tesla counterplay now accounts for grounding rod capacitor type (#15291) * tesla energy loss accounts for capacitor rating * reverse qdel and energy loss as suggested Co-authored-by: = <=> --- code/modules/power/tesla/energy_ball.dm | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/code/modules/power/tesla/energy_ball.dm b/code/modules/power/tesla/energy_ball.dm index fc51915b73..5d7bb9a8b6 100644 --- a/code/modules/power/tesla/energy_ball.dm +++ b/code/modules/power/tesla/energy_ball.dm @@ -358,8 +358,16 @@ var/obj/singularity/energy_ball/tesla = source if(istype(tesla)) if(istype(closest_atom,/obj/machinery/power/grounding_rod) && tesla.energy>13 && !tesla.contained) - qdel(closest_atom) // each rod deletes two miniballs, - tesla.energy = round(tesla.energy/1.5625) // if there are no miniballs the rod stays and continues to pull the ball in + + // getting the grounding rod's capacitor rating for quick maths + var/obj/machinery/power/grounding_rod/rod = closest_atom + // assuming the rod is fully constructed the second part will always be a capacitor + var/obj/item/stock_parts/capacitor/capacitor = rod.component_parts[2] + + tesla.energy = round(tesla.energy/(1 + 0.28125 * capacitor.rating)) + qdel(closest_atom) // each rod removes tesla energy depending on the power of the capacitor, + // if there are no miniballs the rod stays and continues to pull the ball in + if(prob(20))//I know I know tesla_zap(closest_atom, next_range, power * 0.5, zap_flags, shocked_targets) tesla_zap(closest_atom, next_range, power * 0.5, zap_flags, shocked_targets)