diff --git a/code/_globalvars/lists/objects.dm b/code/_globalvars/lists/objects.dm index fee70ee3d5..706a5ed955 100644 --- a/code/_globalvars/lists/objects.dm +++ b/code/_globalvars/lists/objects.dm @@ -13,6 +13,7 @@ GLOBAL_LIST_EMPTY(deliverybeacontags) //list of all tags associated with d GLOBAL_LIST_EMPTY(nuke_list) GLOBAL_LIST_EMPTY(alarmdisplay) //list of all machines or programs that can display station alerts GLOBAL_LIST_EMPTY(singularities) //list of all singularities on the station (actually technically all engines) +GLOBAL_LIST_EMPTY(grounding_rods) //list of all grounding rods on the station GLOBAL_LIST(chemical_reactions_list) //list of all /datum/chemical_reaction datums. Used during chemical reactions GLOBAL_LIST(chemical_reagents_list) //list of all /datum/reagent datums indexed by reagent id. Used by chemistry stuff diff --git a/code/modules/power/tesla/coil.dm b/code/modules/power/tesla/coil.dm index eb80548441..be24ea0fef 100644 --- a/code/modules/power/tesla/coil.dm +++ b/code/modules/power/tesla/coil.dm @@ -160,6 +160,14 @@ buckle_lying = FALSE buckle_requires_restraints = TRUE +/obj/machinery/power/grounding_rod/Initialize() + GLOB.grounding_rods |= src + return ..() + +/obj/machinery/power/grounding_rod/Destroy() + GLOB.grounding_rods.Remove(src) + return ..() + /obj/machinery/power/grounding_rod/default_unfasten_wrench(mob/user, obj/item/I, time = 20) . = ..() if(. == SUCCESSFUL_UNFASTEN) diff --git a/code/modules/power/tesla/energy_ball.dm b/code/modules/power/tesla/energy_ball.dm index 06e5d27f6d..89c5aa3316 100644 --- a/code/modules/power/tesla/energy_ball.dm +++ b/code/modules/power/tesla/energy_ball.dm @@ -31,6 +31,7 @@ var/produced_power var/energy_to_raise = 32 var/energy_to_lower = -20 + var/obj/machinery/power/grounding_rod/rodtarget /obj/singularity/energy_ball/Initialize(mapload, starting_energy = 50, is_miniball = FALSE) miniball = is_miniball @@ -60,11 +61,12 @@ return //don't annnounce miniballs ..() - /obj/singularity/energy_ball/process() if(!orbiting) handle_energy() + determine_containment() + move_the_basket_ball(4 + orbiting_balls.len * 1.5) playsound(src.loc, 'sound/magic/lightningbolt.ogg', 100, TRUE, extrarange = 30) @@ -87,12 +89,19 @@ if(orbiting_balls.len) . += "There are [orbiting_balls.len] mini-balls orbiting it." - /obj/singularity/energy_ball/proc/move_the_basket_ball(var/move_amount) //we face the last thing we zapped, so this lets us favor that direction a bit var/move_bias = pick(GLOB.alldirs) + var/move_dir + for(var/rod in GLOB.grounding_rods) // grounding rods pull the tesla ball, picks the nearest one + if(!rodtarget || get_dist(src,rod)= energy_to_raise) @@ -121,6 +144,10 @@ else if(orbiting_balls.len) dissipate() //sing code has a much better system. + if(energy<=0) + investigate_log("fizzled.", INVESTIGATE_SINGULO) + qdel(src) + /obj/singularity/energy_ball/proc/new_mini_ball() if(!loc) return @@ -134,7 +161,6 @@ EB.orbit(src, orbitsize, pick(FALSE, TRUE), rand(10, 25), pick(3, 4, 5, 6, 36)) - /obj/singularity/energy_ball/Bump(atom/A) dust_mobs(A) @@ -166,7 +192,6 @@ if (!QDELETED(src)) qdel(src) - /obj/singularity/energy_ball/proc/dust_mobs(atom/A) if(isliving(A)) var/mob/living/L = A @@ -329,6 +354,12 @@ else power = closest_atom.zap_act(power, zap_flags, shocked_targets) + + 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 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)