Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[TM] Antagonist at lobby no more #1635

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions code/__HELPERS/_logging.dm
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,9 @@ GLOBAL_PROTECT(log_end)
/proc/log_chat_debug(text)
rustg_log_write(GLOB.chat_debug_log, "[text][GLOB.log_end]")

/proc/log_jobs(text)
rustg_log_write(GLOB.jobs_log, "[text][GLOB.log_end]")

// A logging proc that only outputs after setup is done, to
// help devs test initialization stuff that happens a lot
/proc/log_after_setup(message)
Expand Down
2 changes: 2 additions & 0 deletions code/_globalvars/logging_vars.dm
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ GLOBAL_VAR(sql_log)
GLOBAL_PROTECT(sql_log)
GLOBAL_VAR(chat_debug_log)
GLOBAL_PROTECT(chat_debug_log)
GLOBAL_VAR(jobs_log)
GLOBAL_PROTECT(jobs_log)
GLOBAL_VAR(round_id)
GLOBAL_PROTECT(round_id)

Expand Down
32 changes: 19 additions & 13 deletions code/controllers/subsystem/SSjobs.dm
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ SUBSYSTEM_DEF(jobs)

/datum/controller/subsystem/jobs/proc/Debug(text)
job_debug.Add(text)
log_jobs(text)

/datum/controller/subsystem/jobs/proc/GetJob(rank)
if(!length(occupations))
Expand Down Expand Up @@ -213,9 +214,10 @@ SUBSYSTEM_DEF(jobs)
probability_of_antag_role_restriction /= 10
if((job.current_positions < job.spawn_positions) || job.spawn_positions == -1)
Debug("GRJ Random job given, Player: [player], Job: [job]")
AssignRole(player, job.title)
unassigned -= player
break
var role_assigned = AssignRole(player, job.title)
if(role_assigned)
unassigned -= player
break

/datum/controller/subsystem/jobs/proc/ResetOccupations()
for(var/mob/new_player/player in GLOB.player_list)
Expand Down Expand Up @@ -405,20 +407,20 @@ SUBSYSTEM_DEF(jobs)
probability_of_antag_role_restriction /= 10
Debug("DO pass, Player: [player], Level:[level], Job:[job.title]")
Debug(" - Job Flag: [job.flag] Job Department: [player.client.prefs.active_character.GetJobDepartment(job, level)] Job Current Pos: [job.current_positions] Job Spawn Positions = [job.spawn_positions]")
AssignRole(player, job.title)
unassigned -= player
break
var role_assigned = AssignRole(player, job.title)
if(role_assigned)
unassigned -= player
break

Debug("DO, Standard Check end")
Debug("DO, Running Alternate Check")

// 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/new_player/player in unassigned)
if(player.client.prefs.active_character.alternate_option == GET_RANDOM_JOB)
GiveRandomJob(player)

Debug("DO, Standard Check end")

Debug("DO, Running AC2")

// Antags, who have to get in, come first
for(var/mob/new_player/player in unassigned)
if(player.mind.special_role)
Expand All @@ -434,10 +436,14 @@ SUBSYSTEM_DEF(jobs)

// Then we assign what we can to everyone else.
for(var/mob/new_player/player in unassigned)
if(player.client.prefs.active_character.alternate_option == BE_ASSISTANT)
Debug("AC2 Assistant located, Player: [player]")
if(player.client.prefs.active_character.alternate_option != RETURN_TO_LOBBY)
Debug("AC unemployed located, assigning assistant, Player: [player]")
AssignRole(player, "Assistant")
else if(player.client.prefs.active_character.alternate_option == RETURN_TO_LOBBY)
else if(player.mind.special_role)
Debug("AC unemployed antagonist located, force assigning assistant, Player: [player]")
AssignRole(player, "Assistant")
else
Debug("AC unemployed located, return to lobby, Player: [player]")
player.ready = FALSE
unassigned -= player

Expand Down
2 changes: 2 additions & 0 deletions code/game/world.dm
Original file line number Diff line number Diff line change
Expand Up @@ -260,6 +260,7 @@ GLOBAL_LIST_EMPTY(world_topic_handlers)
GLOB.http_log = "[GLOB.log_directory]/http.log"
GLOB.sql_log = "[GLOB.log_directory]/sql.log"
GLOB.chat_debug_log = "[GLOB.log_directory]/chat_debug.log"
GLOB.jobs_log = "[GLOB.log_directory]/jobs_log.log"
start_log(GLOB.world_game_log)
start_log(GLOB.world_href_log)
start_log(GLOB.world_runtime_log)
Expand All @@ -268,6 +269,7 @@ GLOBAL_LIST_EMPTY(world_topic_handlers)
start_log(GLOB.http_log)
start_log(GLOB.sql_log)
start_log(GLOB.chat_debug_log)
start_log(GLOB.jobs_log)

#ifdef REFERENCE_TRACKING
GLOB.gc_log = "[GLOB.log_directory]/gc_debug.log"
Expand Down
Loading