mirror of
https://github.com/ParadiseSS13/Paradise.git
synced 2025-12-30 20:22:32 +00:00
* Squashed commit of the following: commit 979fe5287c3dd33cd5d69bdd968beae245984f2e Author: hal9000PR <charliesteeples@outlook.com> Date: Sat Jul 9 23:40:53 2022 +0100 guts the old system * refactors spell cooldowns into a handler * charge datum * garbage collection * cleanup, renames cooldown var * review changes * boo cooldown fix * styling Co-authored-by: Sirryan2002 <80364400+Sirryan2002@users.noreply.github.com> Co-authored-by: Sirryan2002 <80364400+Sirryan2002@users.noreply.github.com>
65 lines
2.3 KiB
Plaintext
65 lines
2.3 KiB
Plaintext
/obj/effect/proc_holder/spell/aoe_turf/conjure
|
|
desc = "This spell conjures objs of the specified types in range."
|
|
|
|
var/list/summon_type = list() //determines what exactly will be summoned
|
|
//should be text, like list("/mob/simple_animal/bot/ed209")
|
|
|
|
var/summon_lifespan = 0 // 0=permanent, any other time in deciseconds
|
|
var/summon_amt = 1 //amount of objects summoned
|
|
var/summon_ignore_density = 0 //if set to 1, adds dense tiles to possible spawn places
|
|
var/summon_ignore_prev_spawn_points = 0 //if set to 1, each new object is summoned on a new spawn point
|
|
|
|
var/list/newVars = list() //vars of the summoned objects will be replaced with those where they meet
|
|
//should have format of list("emagged" = 1,"name" = "Wizard's Justicebot"), for example
|
|
var/delay = 1//Go Go Gadget Inheritance
|
|
|
|
var/cast_sound = 'sound/items/welder.ogg'
|
|
|
|
/obj/effect/proc_holder/spell/aoe_turf/conjure/cast(list/targets,mob/living/user = usr)
|
|
playsound(get_turf(user), cast_sound, 50,1)
|
|
for(var/turf/T in targets)
|
|
if(T.density && !summon_ignore_density)
|
|
targets -= T
|
|
playsound(get_turf(src), cast_sound, 50, 1)
|
|
|
|
if(do_after(user, delay, target = user))
|
|
for(var/i=0,i<summon_amt,i++)
|
|
if(!targets.len)
|
|
break
|
|
var/summoned_object_type = pick(summon_type)
|
|
var/spawn_place = pick(targets)
|
|
if(summon_ignore_prev_spawn_points)
|
|
targets -= spawn_place
|
|
if(ispath(summoned_object_type,/turf))
|
|
var/turf/O = spawn_place
|
|
var/N = summoned_object_type
|
|
O.ChangeTurf(N)
|
|
else
|
|
var/atom/summoned_object = new summoned_object_type(spawn_place)
|
|
|
|
for(var/varName in newVars)
|
|
if(varName in summoned_object.vars)
|
|
summoned_object.vars[varName] = newVars[varName]
|
|
summoned_object.admin_spawned = TRUE
|
|
|
|
if(summon_lifespan)
|
|
QDEL_IN(summoned_object, summon_lifespan)
|
|
else
|
|
cooldown_handler.start_recharge(0.5 SECONDS)
|
|
|
|
|
|
return
|
|
|
|
/obj/effect/proc_holder/spell/aoe_turf/conjure/summonEdSwarm //test purposes
|
|
name = "Dispense Wizard Justice"
|
|
desc = "This spell dispenses wizard justice."
|
|
|
|
summon_type = list(/mob/living/simple_animal/bot/ed209)
|
|
summon_amt = 10
|
|
newVars = list("emagged" = 1,"name" = "Wizard's Justicebot")
|
|
|
|
/obj/effect/proc_holder/spell/aoe_turf/conjure/summonEdSwarm/create_new_targeting()
|
|
var/datum/spell_targeting/aoe/turf/T = new()
|
|
T.range = 3
|
|
return T
|