create unique containment check for the tesla

it now functions as normal. it only checks for containment in a 10 tile radius (this should work fine for the default setups of Delta and Lambda).
This commit is contained in:
raspy-on-osu
2020-08-26 21:20:23 -04:00
parent 46bec76f41
commit 6fc019ebf8
+19 -3
View File
@@ -63,6 +63,7 @@
/obj/singularity/energy_ball/process()
determine_containment()
if(!orbiting)
handle_energy()
@@ -91,7 +92,6 @@
/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
contained=0
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
@@ -111,8 +111,24 @@
setDir(move_dir)
for(var/mob/living/carbon/C in loc)
dust_mobs(C)
else
contained=1
/obj/singularity/energy_ball/proc/determine_containment()
contained=0
var/found
var/tiletocheck
for(var/direction in GLOB.cardinals) // check a radius of 10 tiles around the ball for a full containment field
tiletocheck=get_step(src,direction)
for(var/tile in 1 to 10)
found=locate(/obj/machinery/field/containment) in tiletocheck
if(found)
continue
else if (!found && tile==10)
return // if one side is lacking a field it doesn't bother checking the others
tiletocheck=get_step(tiletocheck,direction)
contained=1
/obj/singularity/energy_ball/proc/handle_energy()