Resolving bugs with the game mode refactor.

This commit is contained in:
Zuhayr
2015-03-21 11:08:21 +10:30
parent 98da191ac3
commit d79af13a2c
7 changed files with 28 additions and 18 deletions
@@ -2,6 +2,7 @@ var/datum/antagonist/xenos/xenomorphs
/datum/antagonist/xenos
id = MODE_XENOMORPH
role_type = BE_ALIEN
role_text = "Xenomorph"
role_text_plural = "Xenomorphs"
mob_path = /mob/living/carbon/alien/larva
+13 -1
View File
@@ -154,11 +154,14 @@ var/global/list/antag_names_to_ids = list()
/datum/antagonist/proc/attempt_spawn(var/lower_count, var/upper_count, var/ghosts_only)
world << "Attempting to spawn [id]."
var/main_type
if(ticker && ticker.mode)
if(ticker.mode.antag_tag && ticker.mode.antag_tag == id)
main_type = 1
else
world << "Ticker uninitialized, failed."
return 0
var/cur_max = (main_type ? max_antags_round : max_antags)
@@ -166,6 +169,7 @@ var/global/list/antag_names_to_ids = list()
cur_max = Clamp((ticker.mode.num_players()/ticker.mode.antag_scaling_coeff), 1, cur_max)
if(get_antag_count() >= cur_max)
world << "Antag count: [get_antag_count()] greater than [cur_max], failed."
return 0
// Sanity.
@@ -188,15 +192,22 @@ var/global/list/antag_names_to_ids = list()
// Get the raw list of potential players.
var/req_num = 0
var/list/candidates = ticker.mode.get_players_for_role(role_type)
var/list/candidates = ticker.mode.get_players_for_role(role_type, id)
if(!candidates) candidates = list()
world << "Candidate count is [candidates.len]."
// 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))
world << "Removing [player.name]."
candidates -= player
world << "Candidate count is now [candidates.len]."
// Update our boundaries.
if((!candidates.len) || candidates.len < lower_count)
world << "[candidates.len] not set or below [lower_count], failed."
return 0
else if(candidates.len < upper_count)
req_num = candidates.len
@@ -229,6 +240,7 @@ var/global/list/antag_names_to_ids = list()
else
command_announcement.Announce("[spawn_announcement]", "[spawn_announcement_title ? spawn_announcement_title : "Priority Alert"]")
world << "Success."
return 1
/datum/antagonist/proc/apply(var/datum/mind/player)
@@ -2,6 +2,7 @@ var/datum/antagonist/deathsquad/deathsquad
/datum/antagonist/deathsquad
id = MODE_DEATHSQUAD
role_type = BE_OPERATIVE
role_text = "Death Commando"
role_text_plural = "Death Commandos"
welcome_text = "You work in the service of Central Command Asset Protection, answering directly to the Board of Directors."
@@ -3,6 +3,7 @@ var/datum/antagonist/ert/ert
/datum/antagonist/ert
id = MODE_ERT
bantype = "Emergency Response Team"
role_type = BE_OPERATIVE
role_text = "Emergency Responder"
role_text_plural = "Emergency Responders"
welcome_text = "As member of the Emergency Response Team, you answer only to your leader and CentComm officials."
@@ -35,7 +35,7 @@ var/datum/antagonist/rogue_ai/malf
/datum/antagonist/rogue_ai/attempt_spawn()
var/list/candidates = ticker.mode.get_players_for_role(role_type)
var/list/candidates = ticker.mode.get_players_for_role(role_type, id)
for(var/datum/mind/player in candidates)
if(player.assigned_role != "AI")
candidates -= player
+10 -15
View File
@@ -241,12 +241,11 @@ var/global/list/additional_antag_types = list()
playerC++
if(master_mode=="secret")
if(playerC >= required_players_secret)
return 1
if(playerC < required_players_secret)
return 0
else
if(playerC >= required_players)
return 1
return 0
if(playerC < required_players)
return 0
// Ensure we can spawn at least the voted roundtype main antagonist type after scaling the max antag counts.
// If we can, -try- to spawn the other voted antagonist types. It doesn't really matter if we can't.
@@ -255,9 +254,9 @@ var/global/list/additional_antag_types = list()
if(main_antags.attempt_spawn(required_enemies))
for(var/datum/antagonist/antag in (antag_templates-main_antags))
antag.attempt_spawn()
else
return 0
return 1
return 1
return 0
///pre_setup()
///Attempts to select players for special roles the mode might have.
@@ -560,15 +559,11 @@ var/global/list/additional_antag_types = list()
comm.messagetext.Add(intercepttext)
world << sound('sound/AI/commandreport.ogg')
/datum/game_mode/proc/get_players_for_role(var/role, override_jobbans=0)
/datum/game_mode/proc/get_players_for_role(var/role, var/antag_id)
var/list/players = list()
var/list/candidates = list()
var/datum/antagonist/antag_template
for(var/datum/antagonist/antag in all_antag_types)
if(antag.role_type == role)
antag_template = antag
break
var/datum/antagonist/antag_template = all_antag_types[antag_id]
if(!antag_template)
return candidates
@@ -584,7 +579,7 @@ var/global/list/additional_antag_types = list()
// Get a list of all the people who want to be the antagonist for this round
for(var/mob/new_player/player in players)
if(player.client.prefs.be_special & role)
if(!role || (player.client.prefs.be_special & role))
log_debug("[player.key] had [roletext] enabled, so we are drafting them.")
candidates += player.mind
players -= player
+1 -1
View File
@@ -3,7 +3,7 @@
round_description = "There is a SPACE WIZARD on the station. You can't let them achieve their objectives!"
extended_round_description = "A powerful entity capable of manipulating the elements around him, most commonly referred to as a 'wizard', has infiltrated the station. They have a wide variety of powers and spells available to them that makes your own simple moral self tremble with fear and excitement. Ultimately, their purpose is unknown. However, it is up to you and your crew to decide if their powers can be used for good or if their arrival foreshadows the destruction of the entire station."
config_tag = "wizard"
required_players = 2
required_players = 1
required_players_secret = 10
required_enemies = 1
uplink_welcome = "Wizardly Uplink Console:"