mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-08-30 00:29:02 +01:00
this was godawful inefficient why'd nobody call me on it
This commit is contained in:
@@ -404,15 +404,20 @@
|
||||
return
|
||||
if(disabled)
|
||||
visible_message("<span class='warning'>The writhing tendrils return to the gemstone, which begins to glow with power!</span>")
|
||||
flick("[initial(icon_state)]_recharged", src)
|
||||
flick("interdiction_lens_recharged", src)
|
||||
disabled = FALSE
|
||||
toggle(0)
|
||||
else
|
||||
var/successfulprocess = FALSE
|
||||
var/power_drained = 0
|
||||
var/list/atoms_to_test = list()
|
||||
for(var/atom/movable/M in urange(interdiction_range, src))
|
||||
atoms_to_test |= M
|
||||
for(var/A in spiral_range_turfs(interdiction_range, src))
|
||||
var/turf/T = A
|
||||
for(var/M in T)
|
||||
atoms_to_test |= M
|
||||
|
||||
CHECK_TICK
|
||||
|
||||
for(var/M in atoms_to_test)
|
||||
if(istype(M, /obj/machinery/power/apc))
|
||||
var/obj/machinery/power/apc/A = M
|
||||
@@ -451,6 +456,9 @@
|
||||
var/datum/effect_system/spark_spread/spks = new(get_turf(R))
|
||||
spks.set_up(3, 0, get_turf(R))
|
||||
spks.start()
|
||||
|
||||
CHECK_TICK
|
||||
|
||||
if(!return_power(power_drained) || power_drained < 50) //failed to return power drained or too little power to return
|
||||
successfulprocess = FALSE
|
||||
if(try_use_power(disrupt_cost) && total_accessable_power() >= disrupt_cost) //if we can disable at least one object
|
||||
@@ -479,7 +487,7 @@
|
||||
if(!try_use_power(disrupt_cost))
|
||||
break
|
||||
O.emp_act(1)
|
||||
else //there's probably not another radio in that radio, right?
|
||||
else if(isliving(M) || istype(M, /obj/structure/closet) || istype(M, /obj/item/weapon/storage)) //other things may have radios in them but we don't care
|
||||
var/atom/movable/A = M
|
||||
for(var/obj/item/device/radio/O in A.GetAllContents())
|
||||
successfulprocess = TRUE
|
||||
@@ -488,10 +496,13 @@
|
||||
if(!try_use_power(disrupt_cost))
|
||||
break
|
||||
O.emp_act(1)
|
||||
|
||||
CHECK_TICK
|
||||
|
||||
if(!successfulprocess)
|
||||
visible_message("<span class='warning'>The gemstone suddenly turns horribly dark, writhing tendrils covering it!</span>")
|
||||
recharging = world.time + recharge_time
|
||||
flick("[initial(icon_state)]_discharged", src)
|
||||
flick("interdiction_lens_discharged", src)
|
||||
icon_state = "interdiction_lens_inactive"
|
||||
SetLuminosity(2,1)
|
||||
disabled = TRUE
|
||||
|
||||
Reference in New Issue
Block a user