mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-01-28 10:01:58 +00:00
* [WIP] Ninja refactor and quality of life changes - [ ] Fix ninja mask being hidden by hood - [ ] Action buttons - [ ] Ninjas can be spawned with custom objectives easily * Adding the /datum/event/ghost_role subevent type * I hate events retrying with insufficient pop * OH GOD WHY * Let's just get rid of retries, it's silly * Morph now uses the ghost_role event * Operative does as well Possibility of being bugged due to inability to run age checks on the testing server, please be cautious. * Ninjas, spawning, that sort of thing Wizard diplomats now use the new ghost question system. * Code review * Don't ask ghosts if we have enough selected * Removes map notation from alien spawn * Removed comment
63 lines
2.2 KiB
Plaintext
63 lines
2.2 KiB
Plaintext
/datum/round_event/ghost_role
|
|
// We expect 0 or more /clients (or things with .key) in this list
|
|
var/list/priority_candidates = list()
|
|
var/minimum_required = 1
|
|
var/role_name = "debug rat with cancer" // Q U A L I T Y M E M E S
|
|
var/list/spawned_mobs = list()
|
|
|
|
/datum/round_event/ghost_role/start()
|
|
try_spawning()
|
|
|
|
/datum/round_event/ghost_role/proc/try_spawning(sanity = 0)
|
|
// The event does not run until the spawning has been attempted
|
|
// to prevent us from getting gc'd halfway through
|
|
processing = FALSE
|
|
|
|
var/status = spawn_role()
|
|
if(status == WAITING_FOR_SOMETHING)
|
|
message_admins("The event will not spawn a [role_name] until certain \
|
|
conditions are met. Waiting 30s and then retrying.")
|
|
spawn(300)
|
|
// I hope this doesn't end up running out of stack space
|
|
try_spawning()
|
|
return
|
|
|
|
if(status == MAP_ERROR)
|
|
message_admins("[role_name] cannot be spawned due to a map error.")
|
|
else if(status == NOT_ENOUGH_PLAYERS)
|
|
message_admins("[role_name] cannot be spawned due to lack of players \
|
|
signing up.")
|
|
else if(status == SUCCESSFUL_SPAWN)
|
|
message_admins("[role_name] spawned successfully.")
|
|
if(!spawned_mobs.len)
|
|
message_admins("No mobs found in the `spawned_mobs` list, this is \
|
|
a bug.")
|
|
else
|
|
message_admins("An attempt to spawn [role_name] returned [status], \
|
|
this is a bug.")
|
|
|
|
processing = TRUE
|
|
|
|
/datum/round_event/ghost_role/proc/spawn_role()
|
|
// Return true if role was successfully spawned, false if insufficent
|
|
// players could be found, and just runtime if anything else happens
|
|
return TRUE
|
|
|
|
/datum/round_event/ghost_role/proc/get_candidates(jobban, gametypecheck, be_special)
|
|
// Returns a list of candidates in priority order, with candidates from
|
|
// `priority_candidates` first, and ghost roles randomly shuffled and
|
|
// appended after
|
|
var/list/mob/dead/observer/regular_candidates
|
|
// don't get their hopes up
|
|
if(priority_candidates.len < minimum_required)
|
|
regular_candidates = pollCandidates("Do you wish to be considered for the special role of '[role_name]'?", jobban, gametypecheck, be_special)
|
|
else
|
|
regular_candidates = list()
|
|
|
|
shuffle(regular_candidates)
|
|
|
|
var/list/candidates = priority_candidates + regular_candidates
|
|
|
|
return candidates
|
|
|