mirror of
https://github.com/ParadiseSS13/Paradise.git
synced 2026-08-22 19:47:22 +01:00
Fix for infinite boo
This commit is contained in:
+13
-6
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user