mirror of
https://github.com/ParadiseSS13/Paradise.git
synced 2026-01-01 05:02:33 +00:00
* Makes the prison break use INVOKE_ASYNC for the (win)doors * Add documentation * Refactors the whole event system to not use spawns and be async * relative proc path * keep timing Co-authored-by: joep van der velden <15887760+farie82@users.noreply.github.com>
49 lines
1.7 KiB
Plaintext
49 lines
1.7 KiB
Plaintext
/datum/event/spawn_slaughter
|
|
var/key_of_slaughter
|
|
|
|
/datum/event/spawn_slaughter/proc/get_slaughter()
|
|
var/list/candidates = SSghost_spawns.poll_candidates("Do you want to play as a slaughter demon?", ROLE_DEMON, TRUE, source = /mob/living/simple_animal/slaughter)
|
|
if(!length(candidates))
|
|
kill()
|
|
return
|
|
|
|
var/mob/C = pick(candidates)
|
|
key_of_slaughter = C.key
|
|
|
|
if(!key_of_slaughter)
|
|
kill()
|
|
return
|
|
|
|
var/datum/mind/player_mind = new /datum/mind(key_of_slaughter)
|
|
player_mind.active = TRUE
|
|
var/list/spawn_locs = list()
|
|
for(var/thing in GLOB.landmarks_list)
|
|
var/obj/effect/landmark/L = thing
|
|
if(isturf(L.loc))
|
|
switch(L.name)
|
|
if("revenantspawn")
|
|
spawn_locs += L.loc
|
|
if(!spawn_locs) //If we can't find any revenant spawns, try the carp spawns
|
|
for(var/thing in GLOB.landmarks_list)
|
|
var/obj/effect/landmark/L = thing
|
|
if(isturf(L.loc))
|
|
switch(L.name)
|
|
if("carpspawn")
|
|
spawn_locs += L.loc
|
|
if(!spawn_locs) //If we can't find either, just spawn the revenant at the player's location
|
|
spawn_locs += get_turf(player_mind.current)
|
|
if(!spawn_locs) //If we can't find THAT, then just retry
|
|
kill()
|
|
return
|
|
var/obj/effect/dummy/slaughter/holder = new /obj/effect/dummy/slaughter(pick(spawn_locs))
|
|
var/mob/living/simple_animal/slaughter/S = new /mob/living/simple_animal/slaughter/(holder)
|
|
S.holder = holder
|
|
player_mind.transfer_to(S)
|
|
player_mind.assigned_role = "Slaughter Demon"
|
|
player_mind.special_role = SPECIAL_ROLE_SLAUGHTER_DEMON
|
|
message_admins("[key_name_admin(S)] has been made into a Slaughter Demon by an event.")
|
|
log_game("[key_name_admin(S)] was spawned as a Slaughter Demon by an event.")
|
|
|
|
/datum/event/spawn_slaughter/start()
|
|
INVOKE_ASYNC(src, .proc/get_slaughter)
|