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: = <=>
This commit is contained in:
raspy
2021-10-22 21:58:39 -04:00
committed by GitHub
parent 4c19e8a3d6
commit 921717d9cd
+10 -2
View File
@@ -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)