Reverts #5773 and adds debug messages for Antag Selection (#5777)

See title. Extended was running 24/7 for some reason and I would like to know why.

Fixes #5776
This commit is contained in:
BurgerLUA
2018-12-16 20:05:35 +02:00
committed by Erki
parent f26d1ccbdd
commit b1c1eaf2b3
3 changed files with 78 additions and 6 deletions
+21 -2
View File
@@ -974,6 +974,8 @@ var/list/gamemode_cache = list()
return gamemode_cache["extended"]
/datum/configuration/proc/get_runnable_modes(secret_type = ROUNDTYPE_STR_SECRET)
log_debug("GAMEMODE: Checking runnable modes with secret_type set to [secret_type]...")
var/list/probabilities = config.probabilities_secret
if (secret_type == ROUNDTYPE_STR_MIXED_SECRET)
@@ -987,8 +989,25 @@ var/list/gamemode_cache = list()
var/list/runnable_modes = list()
for(var/game_mode in gamemode_cache)
var/datum/game_mode/M = gamemode_cache[game_mode]
if(M && M.can_start() == GAME_FAILURE_NONE && probabilities[M.config_tag] && probabilities[M.config_tag] > 0)
runnable_modes |= M
if(!M)
log_debug("GAMEMODE: ERROR: [M] does not exist!")
continue
var/can_start = M.can_start()
if(can_start != GAME_FAILURE_NONE)
log_debug("GAMEMODE: [M.name] cannot start! Reason: [can_start]")
continue
if(!probabilities[M.config_tag])
log_debug("GAMEMODE: ERROR: [M.name] does not have a config associated with it!")
continue
if(probabilities[M.config_tag] <= 0)
log_debug("GAMEMODE: ERROR: [M.name] has a probability equal or less than 0!")
continue
runnable_modes |= M
return runnable_modes
/datum/configuration/proc/post_load()
+20 -4
View File
@@ -146,7 +146,9 @@ var/global/list/additional_antag_types = list()
///can_start()
///Checks to see if the game can be setup and ran with the current number of players or whatnot.
/datum/game_mode/proc/can_start(var/do_not_spawn)
/datum/game_mode/proc/can_start()
log_debug("GAMEMODE: Checking gamemode possibility selection for: [name]...")
var/returning = GAME_FAILURE_NONE
@@ -155,19 +157,26 @@ var/global/list/additional_antag_types = list()
if(player.client && player.ready)
playerC++
log_debug("GAMEMODE: [playerC] players checked and readied.")
if(required_players && playerC < required_players)
log_debug("GAMEMODE: There aren't enough players ([playerC]/[required_players]) to start [name]!")
returning |= GAME_FAILURE_NO_PLAYERS
if(max_players && playerC > max_players)
log_debug("GAMEMODE: There are too many players ([playerC]/[max_players]) to start [name]!")
returning |= GAME_FAILURE_TOO_MANY_PLAYERS
var/total_enemy_count = 0
if(antag_templates && antag_templates.len)
log_debug("GAMEMODE: Checking antag templates...")
if(antag_tags && antag_tags.len)
log_debug("GAMEMODE: Checking antag tags...")
var/total_enemy_count = 0
for(var/antag_tag in antag_tags)
var/datum/antagonist/antag = all_antag_types[antag_tag]
if(!antag)
continue
log_debug("GAMEMODE: Checking antag tag: [antag.role_text]...")
var/list/potential = list() //List of potential players to spawn as antagonists
if(antag.flags & ANTAG_OVERRIDE_JOB)
potential = antag.pending_antagonists
@@ -175,12 +184,19 @@ var/global/list/additional_antag_types = list()
potential = antag.candidates
if(islist(potential))
if(potential.len)
log_debug("GAMEMODE: Found [potential.len] potential antagonists for [antag.role_text].")
total_enemy_count += potential.len
if(antag.initial_spawn_req && require_all_templates && potential.len < antag.initial_spawn_req)
log_debug("GAMEMODE: There are not enough antagonists ([potential.len]/[antag.initial_spawn_req]) for the role [antag.role_text]!")
returning |= GAME_FAILURE_NO_ANTAGS
if(required_enemies && total_enemy_count < required_enemies)
returning |= GAME_FAILURE_NO_ANTAGS
log_debug("GAMEMODE: Found [total_enemy_count] total enemies for [name].")
if(required_enemies && total_enemy_count < required_enemies)
log_debug("GAMEMODE: There are not enough total antagonists ([total_enemy_count]/[required_enemies]) to start [name]!")
returning |= GAME_FAILURE_NO_ANTAGS
log_debug("GAMEMODE: Finished gamemode checking. [name] returned [returning].")
return returning
+37
View File
@@ -0,0 +1,37 @@
################################
# Example Changelog File
#
# Note: This file, and files beginning with ".", and files that don't end in ".yml" will not be read. If you change this file, you will look really dumb.
#
# Your changelog will be merged with a master changelog. (New stuff added only, and only on the date entry for the day it was merged.)
# When it is, any changes listed below will disappear.
#
# Valid Prefixes:
# bugfix
# wip (For works in progress)
# tweak
# soundadd
# sounddel
# rscadd (general adding of nice things)
# rscdel (general deleting of nice things)
# imageadd
# imagedel
# maptweak
# spellcheck (typo fixes)
# experiment
# balance
#################################
# Your name.
author: BurgerBB
# Optional: Remove this file after generating master changelog. Useful for PR changelogs that won't get used again.
delete-after: True
# Any changes you've made. See valid prefix list above.
# INDENT WITH TWO SPACES. NOT TABS. SPACES.
# SCREW THIS UP AND IT WON'T WORK.
# Also, all entries are changed into a single [] after a master changelog generation. Just remove the brackets when you add new entries.
# Please surround your changes in double quotes ("), as certain characters otherwise screws up compiling. The quotes will not show up in the changelog.
changes:
- bugfix: "Fixed an issue that would only allow extended to be chosen in secret. I hope you all enjoyed your RP."