diff --git a/code/game/antagonist/antagonist_build.dm b/code/game/antagonist/antagonist_build.dm index ab768121ac..31a531b558 100644 --- a/code/game/antagonist/antagonist_build.dm +++ b/code/game/antagonist/antagonist_build.dm @@ -69,7 +69,9 @@ id.registered_name = player.real_name /datum/antagonist/proc/random_spawn() - return attempt_spawn(null,null,(flags & (ANTAG_OVERRIDE_MOB|ANTAG_OVERRIDE_JOB))) + create_global_objectives() + attempt_spawn(flags & (ANTAG_OVERRIDE_MOB|ANTAG_OVERRIDE_JOB)) + finalize() /datum/antagonist/proc/create_id(var/assignment, var/mob/living/carbon/human/player) diff --git a/code/game/antagonist/antagonist_helpers.dm b/code/game/antagonist/antagonist_helpers.dm index 9e1fe2b999..92556a817a 100644 --- a/code/game/antagonist/antagonist_helpers.dm +++ b/code/game/antagonist/antagonist_helpers.dm @@ -27,15 +27,3 @@ if(antag_type == id || antag_type == role_text) return 1 return 0 - -/datum/antagonist/proc/get_candidates(var/ghosts_only) - - candidates = list() // Clear. - candidates = ticker.mode.get_players_for_role(role_type, id) - - // Prune restricted jobs and status. - for(var/datum/mind/player in candidates) - if((ghosts_only && !istype(player.current, /mob/dead)) || (player.assigned_role in restricted_jobs)) - candidates -= player - - return candidates \ No newline at end of file diff --git a/code/game/antagonist/antagonist_spawn.dm b/code/game/antagonist/antagonist_spawn.dm index 9e9ec4ae2f..3418d356d8 100644 --- a/code/game/antagonist/antagonist_spawn.dm +++ b/code/game/antagonist/antagonist_spawn.dm @@ -12,7 +12,7 @@ place_mob(player.current) return -/datum/antagonist/proc/update_cur_max(var/lower_count, var/upper_count) +/datum/antagonist/proc/update_cur_max() candidates = list() var/main_type @@ -26,16 +26,15 @@ if(ticker.mode.antag_scaling_coeff) cur_max = Clamp((ticker.mode.num_players()/ticker.mode.antag_scaling_coeff), 1, cur_max) -/datum/antagonist/proc/attempt_spawn(var/lower_count, var/upper_count, var/ghosts_only) +/datum/antagonist/proc/attempt_spawn(var/ghosts_only) - world << "Attempting to spawn." // Get the raw list of potential players. - update_cur_max(lower_count, upper_count) + update_cur_max() candidates = get_candidates(ghosts_only) // Update our boundaries. if(!candidates.len) - world << "No candidates." + world << "Somehow there are no antagonist candidates." return 0 //Grab candidates randomly until we have enough. @@ -47,7 +46,6 @@ if(flags & ANTAG_OVERRIDE_JOB) player.assigned_role = "MODE" candidates -= player - world << "Done." return 1 /datum/antagonist/proc/place_mob(var/mob/living/mob) @@ -75,4 +73,14 @@ update_icons_removed(player) BITSET(player.current.hud_updateflag, SPECIALROLE_HUD) return 1 - return 0 \ No newline at end of file + return 0 + +/datum/antagonist/proc/get_candidates(var/ghosts_only) + + candidates = list() // Clear. + candidates = ticker.mode.get_players_for_role(role_type, id) + // Prune restricted jobs and status. + for(var/datum/mind/player in candidates) + if((ghosts_only && !istype(player.current, /mob/dead)) || (player.assigned_role in restricted_jobs)) + candidates -= player + return candidates \ No newline at end of file diff --git a/code/game/antagonist/station/monkey.dm b/code/game/antagonist/station/monkey.dm index 6b1629c1e6..6409ccf855 100644 --- a/code/game/antagonist/station/monkey.dm +++ b/code/game/antagonist/station/monkey.dm @@ -1,9 +1,13 @@ +// Notes towards a monkey mode to reduce snowflakes for downstream. Will not compile. + /datum/antagonist/monkey role_text = "Rabid Monkey" role_text_plural = "Rabid Monkeys" + mob_type = /mob/living/carbon/monkey id = MODE_MONKEY + flags = ANTAG_OVERRIDE_JOB | ANTAG_OVERRIDE_MOB - // Notes towards a monkey mode to reduce snowflakes for downstream. Will not compile. +/datum/antagonist/monkey/apply(var/datum/mind/player) for(var/datum/disease/D in M.viruses) if(istype(D, /datum/disease/jungle_fever)) diff --git a/code/game/gamemodes/game_mode.dm b/code/game/gamemodes/game_mode.dm index 2883864594..57da1ed701 100644 --- a/code/game/gamemodes/game_mode.dm +++ b/code/game/gamemodes/game_mode.dm @@ -258,6 +258,14 @@ var/global/list/additional_antag_types = list() return 1 else return 1 + + // Attempt to mark folks down as ready to go. Don't finalize until post setup. + var/datum/antagonist/main_antags = antag_templates[1] + var/list/candidates = main_antags.get_candidates() + if(candidates.len >= required_enemies) + for(var/datum/antagonist/antag in antag_templates) + antag.attempt_spawn() + return 1 return 0 /datum/game_mode/proc/refresh_event_modifiers() @@ -286,7 +294,6 @@ var/global/list/additional_antag_types = list() if(antag_templates && antag_templates.len) for(var/datum/antagonist/antag in antag_templates) - antag.attempt_spawn(required_enemies) antag.finalize() if(emergency_shuttle && auto_recall_shuttle) diff --git a/code/modules/admin/verbs/striketeam.dm b/code/modules/admin/verbs/striketeam.dm index 7ba359af68..c12d76b68d 100644 --- a/code/modules/admin/verbs/striketeam.dm +++ b/code/modules/admin/verbs/striketeam.dm @@ -52,4 +52,4 @@ var/const/commandos_possible = 6 //if more Commandos are needed in the future usr << "Looks like someone beat you to it." return - team.attempt_spawn(1,commandos_possible) + team.attempt_spawn(1)