diff --git a/code/__HELPERS/_logging.dm b/code/__HELPERS/_logging.dm index 48e2baac6e50..4289fd5ad0bf 100644 --- a/code/__HELPERS/_logging.dm +++ b/code/__HELPERS/_logging.dm @@ -131,6 +131,10 @@ /proc/log_query_debug(text) WRITE_LOG(GLOB.query_debug_log, "SQL: [text]") +/proc/log_job_debug(text) + if (CONFIG_GET(flag/log_job_debug)) + WRITE_LOG(GLOB.world_job_debug_log, "JOB: [text]") + /* Log to both DD and the logfile. */ /proc/log_world(text) WRITE_LOG(GLOB.world_runtime_log, text) diff --git a/code/_globalvars/logging.dm b/code/_globalvars/logging.dm index e00e4775ac65..2951ddf16545 100644 --- a/code/_globalvars/logging.dm +++ b/code/_globalvars/logging.dm @@ -22,6 +22,8 @@ GLOBAL_VAR(world_manifest_log) GLOBAL_PROTECT(world_manifest_log) GLOBAL_VAR(query_debug_log) GLOBAL_PROTECT(query_debug_log) +GLOBAL_VAR(world_job_debug_log) +GLOBAL_PROTECT(world_job_debug_log) GLOBAL_LIST_EMPTY(bombers) GLOBAL_PROTECT(bombers) diff --git a/code/controllers/configuration/entries/general.dm b/code/controllers/configuration/entries/general.dm index efa7e45b0496..5f9954b884c5 100644 --- a/code/controllers/configuration/entries/general.dm +++ b/code/controllers/configuration/entries/general.dm @@ -55,6 +55,8 @@ /datum/config_entry/flag/log_manifest // log crew manifest to seperate file +/datum/config_entry/flag/log_job_debug // log roundstart divide occupations debug information to a file + /datum/config_entry/flag/allow_admin_ooccolor // Allows admins with relevant permissions to have their own ooc colour /datum/config_entry/flag/allow_vote_restart // allow votes to restart diff --git a/code/controllers/subsystem/job.dm b/code/controllers/subsystem/job.dm index 9a0028be4056..8a87d8cae22f 100644 --- a/code/controllers/subsystem/job.dm +++ b/code/controllers/subsystem/job.dm @@ -7,7 +7,6 @@ SUBSYSTEM_DEF(job) var/list/name_occupations = list() //Dict of all jobs, keys are titles var/list/type_occupations = list() //Dict of all jobs, keys are types var/list/unassigned = list() //Players who need jobs - var/list/job_debug = list() //Debug info var/initial_players_to_assign = 0 //used for checking against population caps var/list/prioritized_jobs = list() @@ -36,6 +35,7 @@ SUBSYSTEM_DEF(job) old_overflow.spawn_positions = initial(old_overflow.spawn_positions) old_overflow.total_positions = initial(old_overflow.total_positions) overflow_role = new_overflow_role + JobDebug("Overflow role set to : [new_overflow_role]") /datum/controller/subsystem/job/proc/SetupOccupations(faction = "Station") occupations = list() @@ -62,13 +62,6 @@ SUBSYSTEM_DEF(job) return 1 -/datum/controller/subsystem/job/proc/Debug(text) - if(!GLOB.Debug2) - return 0 - job_debug.Add(text) - return 1 - - /datum/controller/subsystem/job/proc/GetJob(rank) if(!occupations.len) SetupOccupations() @@ -80,7 +73,7 @@ SUBSYSTEM_DEF(job) return type_occupations[jobtype] /datum/controller/subsystem/job/proc/AssignRole(mob/dead/new_player/player, rank, latejoin = FALSE) - Debug("Running AR, Player: [player], Rank: [rank], LJ: [latejoin]") + JobDebug("Running AR, Player: [player], Rank: [rank], LJ: [latejoin]") if(player && player.mind && rank) var/datum/job/job = GetJob(rank) if(!job) @@ -94,33 +87,33 @@ SUBSYSTEM_DEF(job) var/position_limit = job.total_positions if(!latejoin) position_limit = job.spawn_positions - Debug("Player: [player] is now Rank: [rank], JCP:[job.current_positions], JPL:[position_limit]") + JobDebug("Player: [player] is now Rank: [rank], JCP:[job.current_positions], JPL:[position_limit]") player.mind.assigned_role = rank unassigned -= player job.current_positions++ return TRUE - Debug("AR has failed, Player: [player], Rank: [rank]") + JobDebug("AR has failed, Player: [player], Rank: [rank]") return FALSE /datum/controller/subsystem/job/proc/FindOccupationCandidates(datum/job/job, level, flag) - Debug("Running FOC, Job: [job], Level: [level], Flag: [flag]") + JobDebug("Running FOC, Job: [job], Level: [level], Flag: [flag]") var/list/candidates = list() for(var/mob/dead/new_player/player in unassigned) if(jobban_isbanned(player, job.title) || QDELETED(player)) - Debug("FOC isbanned failed, Player: [player]") + JobDebug("FOC isbanned failed, Player: [player]") continue if(!job.player_old_enough(player.client)) - Debug("FOC player not old enough, Player: [player]") + JobDebug("FOC player not old enough, Player: [player]") continue if(job.required_playtime_remaining(player.client)) - Debug("FOC player not enough xp, Player: [player]") + JobDebug("FOC player not enough xp, Player: [player]") continue if(flag && (!(flag in player.client.prefs.be_special))) - Debug("FOC flag failed, Player: [player], Flag: [flag], ") + JobDebug("FOC flag failed, Player: [player], Flag: [flag], ") continue if(player.mind && job.title in player.mind.restricted_roles) - Debug("FOC incompatible with antagonist role, Player: [player]") + JobDebug("FOC incompatible with antagonist role, Player: [player]") continue // yogs start - Donor features, quiet round if(((job.title in GLOB.command_positions) || (job.title in GLOB.nonhuman_positions)) && (player.client.prefs.toggles & QUIET_ROUND)) @@ -128,12 +121,12 @@ SUBSYSTEM_DEF(job) continue // yogs end if(player.client.prefs.GetJobDepartment(job, level) & job.flag) - Debug("FOC pass, Player: [player], Level:[level]") + JobDebug("FOC pass, Player: [player], Level:[level]") candidates += player return candidates /datum/controller/subsystem/job/proc/GiveRandomJob(mob/dead/new_player/player) - Debug("GRJ Giving random job, Player: [player]") + JobDebug("GRJ Giving random job, Player: [player]") . = FALSE for(var/datum/job/job in shuffle(occupations)) if(!job) @@ -147,29 +140,30 @@ SUBSYSTEM_DEF(job) if(jobban_isbanned(player, job.title) || QDELETED(player)) if(QDELETED(player)) - Debug("GRJ isbanned failed, Player deleted") + JobDebug("GRJ isbanned failed, Player deleted") break - Debug("GRJ isbanned failed, Player: [player], Job: [job.title]") + JobDebug("GRJ isbanned failed, Player: [player], Job: [job.title]") continue if(!job.player_old_enough(player.client)) - Debug("GRJ player not old enough, Player: [player]") + JobDebug("GRJ player not old enough, Player: [player]") continue if(job.required_playtime_remaining(player.client)) - Debug("GRJ player not enough xp, Player: [player]") + JobDebug("GRJ player not enough xp, Player: [player]") continue if(player.mind && job.title in player.mind.restricted_roles) - Debug("GRJ incompatible with antagonist role, Player: [player], Job: [job.title]") + JobDebug("GRJ incompatible with antagonist role, Player: [player], Job: [job.title]") continue if((job.current_positions < job.spawn_positions) || job.spawn_positions == -1) - Debug("GRJ Random job given, Player: [player], Job: [job]") + JobDebug("GRJ Random job given, Player: [player], Job: [job]") if(AssignRole(player, job.title)) return TRUE /datum/controller/subsystem/job/proc/ResetOccupations() + JobDebug("Occupations reset.") for(var/mob/dead/new_player/player in GLOB.player_list) if((player) && (player.mind)) player.mind.assigned_role = null @@ -239,7 +233,7 @@ SUBSYSTEM_DEF(job) **/ /datum/controller/subsystem/job/proc/DivideOccupations() //Setup new player list and get the jobs list - Debug("Running DO") + JobDebug("Running DO") //Holder for Triumvirate is stored in the SSticker, this just processes it if(SSticker.triai) @@ -255,7 +249,7 @@ SUBSYSTEM_DEF(job) initial_players_to_assign = unassigned.len - Debug("DO, Len: [unassigned.len]") + JobDebug("DO, Len: [unassigned.len]") if(unassigned.len == 0) return 0 @@ -276,28 +270,28 @@ SUBSYSTEM_DEF(job) HandleFeedbackGathering() //People who wants to be the overflow role, sure, go on. - Debug("DO, Running Overflow Check 1") + JobDebug("DO, Running Overflow Check 1") var/datum/job/overflow = GetJob(SSjob.overflow_role) var/list/overflow_candidates = FindOccupationCandidates(overflow, 3) - Debug("AC1, Candidates: [overflow_candidates.len]") + JobDebug("AC1, Candidates: [overflow_candidates.len]") for(var/mob/dead/new_player/player in overflow_candidates) - Debug("AC1 pass, Player: [player]") + JobDebug("AC1 pass, Player: [player]") AssignRole(player, SSjob.overflow_role) overflow_candidates -= player - Debug("DO, AC1 end") + JobDebug("DO, AC1 end") //Select one head - Debug("DO, Running Head Check") + JobDebug("DO, Running Head Check") FillHeadPosition() - Debug("DO, Head Check end") + JobDebug("DO, Head Check end") //Check for an AI - Debug("DO, Running AI Check") + JobDebug("DO, Running AI Check") FillAIPosition() - Debug("DO, AI Check end") + JobDebug("DO, AI Check end") //Other jobs are now checked - Debug("DO, Running Standard Check") + JobDebug("DO, Running Standard Check") // New job giving system by Donkie @@ -321,45 +315,42 @@ SUBSYSTEM_DEF(job) continue if(jobban_isbanned(player, job.title)) - Debug("DO isbanned failed, Player: [player], Job:[job.title]") + JobDebug("DO isbanned failed, Player: [player], Job:[job.title]") continue if(QDELETED(player)) - Debug("DO player deleted during job ban check") + JobDebug("DO player deleted during job ban check") break if(!job.player_old_enough(player.client)) - Debug("DO player not old enough, Player: [player], Job:[job.title]") + JobDebug("DO player not old enough, Player: [player], Job:[job.title]") continue if(job.required_playtime_remaining(player.client)) - Debug("DO player not enough xp, Player: [player], Job:[job.title]") + JobDebug("DO player not enough xp, Player: [player], Job:[job.title]") continue if(player.mind && job.title in player.mind.restricted_roles) - Debug("DO incompatible with antagonist role, Player: [player], Job:[job.title]") + JobDebug("DO incompatible with antagonist role, Player: [player], Job:[job.title]") continue // If the player wants that job on this level, then try give it to him. if(player.client.prefs.GetJobDepartment(job, level) & job.flag) - // If the job isn't filled if((job.current_positions < job.spawn_positions) || job.spawn_positions == -1) - Debug("DO pass, Player: [player], Level:[level], Job:[job.title]") + JobDebug("DO pass, Player: [player], Level:[level], Job:[job.title]") AssignRole(player, job.title) unassigned -= player break + JobDebug("DO, Handling unassigned.") // Hand out random jobs to the people who didn't get any in the last check // Also makes sure that they got their preference correct for(var/mob/dead/new_player/player in unassigned) HandleUnassigned(player) - Debug("DO, Standard Check end") - - Debug("DO, Running AC2") - + JobDebug("DO, Handling unrejectable unassigned") //Mop up people who can't leave. for(var/mob/dead/new_player/player in unassigned) //Players that wanted to back out but couldn't because they're antags (can you feel the edge case?) if(!GiveRandomJob(player)) @@ -385,6 +376,7 @@ SUBSYSTEM_DEF(job) RejectPlayer(player) else //Something gone wrong if we got here. var/message = "DO: [player] fell through handling unassigned" + JobDebug(message) log_game(message) message_admins(message) RejectPlayer(player) @@ -463,7 +455,7 @@ SUBSYSTEM_DEF(job) if(ssc > 0) if(J.spawn_positions > 0) var/officer_positions = min(12, max(J.spawn_positions, round(unassigned.len / ssc))) //Scale between configured minimum and 12 officers - Debug("Setting open security officer positions to [officer_positions]") + JobDebug("Setting open security officer positions to [officer_positions]") J.total_positions = officer_positions J.spawn_positions = officer_positions @@ -535,7 +527,8 @@ SUBSYSTEM_DEF(job) if(player.mind && player.mind.special_role) return if(PopcapReached()) - Debug("Popcap overflow Check observer located, Player: [player]") + JobDebug("Popcap overflow Check observer located, Player: [player]") + JobDebug("Player rejected :[player]") to_chat(player, "You have failed to qualify for any job you desired.") unassigned -= player player.ready = PLAYER_NOT_READY @@ -640,3 +633,6 @@ SUBSYSTEM_DEF(job) for(var/mob/living/carbon/human/player in GLOB.carbon_list) if(player.mind && (player.mind.assigned_role in GLOB.security_positions)) . |= player.mind + +/datum/controller/subsystem/job/proc/JobDebug(message) + log_job_debug(message) \ No newline at end of file diff --git a/code/game/world.dm b/code/game/world.dm index 23cc891f164d..571e65155743 100644 --- a/code/game/world.dm +++ b/code/game/world.dm @@ -11,7 +11,7 @@ GLOBAL_PROTECT(security_mode) SetupExternalRSC() - GLOB.config_error_log = GLOB.world_manifest_log = GLOB.world_pda_log = GLOB.sql_error_log = GLOB.world_href_log = GLOB.world_runtime_log = GLOB.world_attack_log = GLOB.world_game_log = "data/logs/config_error.log" //temporary file used to record errors with loading config, moved to log directory once logging is set bl + GLOB.config_error_log = GLOB.world_manifest_log = GLOB.world_pda_log = GLOB.world_job_debug_log = GLOB.sql_error_log = GLOB.world_href_log = GLOB.world_runtime_log = GLOB.world_attack_log = GLOB.world_game_log = "data/logs/config_error.log" //temporary file used to record errors with loading config, moved to log directory once logging is set bl CheckSecurityMode() @@ -96,6 +96,7 @@ GLOBAL_PROTECT(security_mode) GLOB.world_qdel_log = "[GLOB.log_directory]/qdel.log" GLOB.world_runtime_log = "[GLOB.log_directory]/runtime.log" GLOB.query_debug_log = "[GLOB.log_directory]/query_debug.log" + GLOB.world_job_debug_log = "[GLOB.log_directory]/job_debug.log" #ifdef UNIT_TESTS GLOB.test_log = file("[GLOB.log_directory]/tests.log") @@ -108,6 +109,7 @@ GLOBAL_PROTECT(security_mode) start_log(GLOB.world_href_log) start_log(GLOB.world_qdel_log) start_log(GLOB.world_runtime_log) + start_log(GLOB.world_job_debug_log) GLOB.changelog_hash = md5('html/changelog.html') //for telling if the changelog has changed recently if(fexists(GLOB.config_error_log)) diff --git a/code/modules/admin/secrets.dm b/code/modules/admin/secrets.dm index 0213e7ea446b..5d28e8ed3b42 100644 --- a/code/modules/admin/secrets.dm +++ b/code/modules/admin/secrets.dm @@ -7,7 +7,6 @@ dat +={" General Secrets

- Show Job Debug
Admin Log
Show Admin List

@@ -107,17 +106,6 @@ dat += "No-one has done anything this round!" usr << browse(dat, "window=admin_log") - if("list_job_debug") - var/dat = "Job Debug info.
" - for(var/line in SSjob.job_debug) - dat += "[line]
" - dat+= "*******

" - for(var/datum/job/job in SSjob.occupations) - if(!job) - continue - dat += "job: [job.title], current_positions: [job.current_positions], total_positions: [job.total_positions]
" - usr << browse(dat, "window=jobdebug;size=600x500") - if("show_admins") var/dat = "Current admins:
" if(GLOB.admin_datums) diff --git a/config/config.txt b/config/config.txt index e1d46f675da1..22885b0e8b1b 100644 --- a/config/config.txt +++ b/config/config.txt @@ -118,6 +118,9 @@ LOG_LAW ## log crew manifest to seperate file LOG_MANIFEST +## log job divide debugging information +#LOG_JOB_DEBUG + ## log all world.Topic() calls # LOG_WORLD_TOPIC