Fix for infinite boo

This commit is contained in:
Citinited
2019-05-18 13:02:06 +01:00
parent 86d5b4b070
commit da51a3315c
2 changed files with 14 additions and 6 deletions
+13 -6
View File
@@ -62,6 +62,7 @@ var/list/spells = typesof(/obj/effect/proc_holder/spell) //needed for the badmin
var/charge_type = "recharge" //can be recharge or charges, see charge_max and charge_counter descriptions; can also be based on the holder's vars now, use "holder_var" for that
var/charge_max = 100 //recharge time in deciseconds if charge_type = "recharge" or starting charges if charge_type = "charges"
var/starts_charged = TRUE //Does this spell start ready to go?
var/charge_counter = 0 //can only cast spells if it equals recharge, ++ each decisecond if charge_type = "recharge" or -- each cast if charge_type = "charges"
var/still_recharging_msg = "<span class='notice'>The spell is still recharging.</span>"
@@ -193,9 +194,11 @@ var/list/spells = typesof(/obj/effect/proc_holder/spell) //needed for the badmin
/obj/effect/proc_holder/spell/New()
..()
action = new(src)
still_recharging_msg = "<span class='notice'>[name] is still recharging.</span>"
charge_counter = charge_max
if(starts_charged)
charge_counter = charge_max
else
start_recharge()
/obj/effect/proc_holder/spell/Destroy()
QDEL_NULL(action)
@@ -212,10 +215,14 @@ var/list/spells = typesof(/obj/effect/proc_holder/spell) //needed for the badmin
/obj/effect/proc_holder/spell/proc/start_recharge()
if(action)
action.UpdateButtonIcon()
while(charge_counter < charge_max)
sleep(1)
charge_counter++
if(action)
addtimer(CALLBACK(src, .add_charge), 10)
/obj/effect/proc_holder/spell/proc/add_charge()
charge_counter += 10
if(charge_counter < charge_max) //Needs to charge some more
addtimer(CALLBACK(src, .add_charge), 10)
return
if(action) //We got this far, it's charged
action.UpdateButtonIcon()
/obj/effect/proc_holder/spell/proc/perform(list/targets, recharge = 1, mob/user = usr) //if recharge is started is important for the trigger spells