mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-07-21 13:05:36 +01:00
[MIRROR] Prevents players from getting antagonist if they can't qualify for any role beforehand. [MDB IGNORE] (#23874)
* Prevents players from getting antagonist if they can't qualify for any role beforehand. * Update job.dm --------- Co-authored-by: Watermelon914 <37270891+Watermelon914@users.noreply.github.com> Co-authored-by: Bloop <13398309+vinylspiders@users.noreply.github.com>
This commit is contained in:
@@ -24,6 +24,9 @@ SUBSYSTEM_DEF(job)
|
||||
|
||||
var/list/unassigned = list() //Players who need jobs
|
||||
var/initial_players_to_assign = 0 //used for checking against population caps
|
||||
// Whether to run DivideOccupations pure so that there are no side-effects from calling it other than
|
||||
// a player's assigned_role being set to some value.
|
||||
var/run_divide_occupation_pure = FALSE
|
||||
|
||||
var/list/prioritized_jobs = list()
|
||||
var/list/latejoin_trackers = list()
|
||||
@@ -369,11 +372,11 @@ SUBSYSTEM_DEF(job)
|
||||
* fills var "assigned_role" for all ready players.
|
||||
* This proc must not have any side effect besides of modifying "assigned_role".
|
||||
**/
|
||||
/datum/controller/subsystem/job/proc/DivideOccupations()
|
||||
/datum/controller/subsystem/job/proc/DivideOccupations(pure = FALSE, allow_all = FALSE)
|
||||
//Setup new player list and get the jobs list
|
||||
JobDebug("Running DO")
|
||||
|
||||
SEND_SIGNAL(src, COMSIG_OCCUPATIONS_DIVIDED)
|
||||
JobDebug("Running DO, allow_all = [allow_all], pure = [pure]")
|
||||
run_divide_occupation_pure = pure
|
||||
SEND_SIGNAL(src, COMSIG_OCCUPATIONS_DIVIDED, pure, allow_all)
|
||||
|
||||
//Get the players who are ready
|
||||
for(var/i in GLOB.new_player_list)
|
||||
@@ -441,8 +444,9 @@ SUBSYSTEM_DEF(job)
|
||||
|
||||
// Loop through all unassigned players
|
||||
for(var/mob/dead/new_player/player in unassigned)
|
||||
if(PopcapReached())
|
||||
RejectPlayer(player)
|
||||
if(!allow_all)
|
||||
if(PopcapReached())
|
||||
RejectPlayer(player)
|
||||
|
||||
// Loop through all jobs
|
||||
for(var/datum/job/job in shuffledoccupations) // SHUFFLE ME BABY
|
||||
@@ -480,7 +484,7 @@ SUBSYSTEM_DEF(job)
|
||||
// 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)
|
||||
HandleUnassigned(player, allow_all)
|
||||
JobDebug("DO, Ending handle unassigned.")
|
||||
|
||||
JobDebug("DO, Handle unrejectable unassigned")
|
||||
@@ -490,21 +494,23 @@ SUBSYSTEM_DEF(job)
|
||||
if(!AssignRole(player, GetJobType(overflow_role))) //If everything is already filled, make them an assistant
|
||||
JobDebug("DO, Forced antagonist could not be assigned any random job or the overflow role. DivideOccupations failed.")
|
||||
JobDebug("---------------------------------------------------")
|
||||
run_divide_occupation_pure = FALSE
|
||||
return FALSE //Living on the edge, the forced antagonist couldn't be assigned to overflow role (bans, client age) - just reroll
|
||||
JobDebug("DO, Ending handle unrejectable unassigned")
|
||||
|
||||
JobDebug("All divide occupations tasks completed.")
|
||||
JobDebug("---------------------------------------------------")
|
||||
|
||||
run_divide_occupation_pure = FALSE
|
||||
return TRUE
|
||||
|
||||
//We couldn't find a job from prefs for this guy.
|
||||
/datum/controller/subsystem/job/proc/HandleUnassigned(mob/dead/new_player/player)
|
||||
/datum/controller/subsystem/job/proc/HandleUnassigned(mob/dead/new_player/player, allow_all = FALSE)
|
||||
var/jobless_role = player.client.prefs.read_preference(/datum/preference/choiced/jobless_role)
|
||||
|
||||
if(PopcapReached())
|
||||
RejectPlayer(player)
|
||||
return
|
||||
if(!allow_all)
|
||||
if(PopcapReached())
|
||||
RejectPlayer(player)
|
||||
return
|
||||
|
||||
switch (jobless_role)
|
||||
if (BEOVERFLOW)
|
||||
@@ -698,10 +704,11 @@ SUBSYSTEM_DEF(job)
|
||||
if(PopcapReached())
|
||||
JobDebug("Popcap overflow Check observer located, Player: [player]")
|
||||
JobDebug("Player rejected :[player]")
|
||||
to_chat(player, "<span class='infoplain'><b>You have failed to qualify for any job you desired.</b></span>")
|
||||
unassigned -= player
|
||||
player.ready = PLAYER_NOT_READY
|
||||
player.client << output(player.ready, "lobby_browser:imgsrc") //SKYRAT EDIT ADDITION
|
||||
if(!run_divide_occupation_pure)
|
||||
to_chat(player, "<span class='infoplain'><b>You have failed to qualify for any job you desired.</b></span>")
|
||||
player.ready = PLAYER_NOT_READY
|
||||
player.client << output(player.ready, "lobby_browser:imgsrc") //SKYRAT EDIT ADDITION
|
||||
|
||||
|
||||
/datum/controller/subsystem/job/Recover()
|
||||
|
||||
Reference in New Issue
Block a user