From 0bdeb6c070947caaa4c5dfa8459445ea7829b88f Mon Sep 17 00:00:00 2001 From: actioninja Date: Tue, 4 Jun 2019 14:12:02 -0700 Subject: [PATCH 1/2] fixes gay baby jail --- .../modules/mob/dead/new_player/new_player.dm | 29 +++++++++++++++++++ code/modules/mob/mob_helpers.dm | 22 -------------- 2 files changed, 29 insertions(+), 22 deletions(-) diff --git a/code/modules/mob/dead/new_player/new_player.dm b/code/modules/mob/dead/new_player/new_player.dm index 780d7ca17e7..12603de7828 100644 --- a/code/modules/mob/dead/new_player/new_player.dm +++ b/code/modules/mob/dead/new_player/new_player.dm @@ -13,6 +13,9 @@ var/mob/living/new_character //for instant transfer once the round is set up + //Used to make sure someone doesn't get spammed with messages if they're ineligible for roles + var/ineligible_for_roles = FALSE + /mob/dead/new_player/Initialize() if(client && SSticker.state == GAME_STATE_STARTUP) var/obj/screen/splash/S = new(client, TRUE, TRUE) @@ -527,3 +530,29 @@ src << browse(null, "window=preferences") //closes job selection src << browse(null, "window=mob_occupation") src << browse(null, "window=latechoices") //closes late job selection + +// Used to make sure that a player has a valid job preference setup, used to knock players out of eligibility for anything if their prefs don't make sense. +// A "valid job preference setup" in this situation means at least having one job set to low, or not having "return to lobby" enabled +// Prevents "antag rolling" by setting antag prefs on, all jobs to never, and "return to lobby if preferences not availible" +// Doing so would previously allow you to roll for antag, then send you back to lobby if you didn't get an antag role +// This also does some admin notification and logging as well +/mob/dead/new_player/proc/has_valid_preferences() + if(!client) + return FALSE //Not sure how this would get run without the mob having a client, but let's just be safe. + if(client.prefs.joblessrole != RETURNTOLOBBY) + return TRUE + // If they have antags enabled, they're potentially doing this on purpose instead of by accident. Notify admins if so. + var/has_antags = FALSE + if(client.prefs.be_special.len > 0) + has_antags = TRUE + if(client.prefs.job_preferences.len == 0) + if(!ineligible_for_roles) + to_chat(src, "You have no jobs enabled, along with return to lobby if job is unavailable. This makes you ineligible for any round start role, please update your job preferences.") + ineligible_for_roles = TRUE + ready = PLAYER_NOT_READY + if(has_antags) + log_admin("[src.ckey] just got booted back to lobby with no jobs, but antags enabled.") + message_admins("[src.ckey] just got booted back to lobby with no jobs enabled, but antag rolling enabled. Likely antag rolling abuse.") + + return FALSE //This is the only case someone should actually be completely blocked from antag rolling as well + return TRUE diff --git a/code/modules/mob/mob_helpers.dm b/code/modules/mob/mob_helpers.dm index cac9ec1f3d3..04ddce7d6a8 100644 --- a/code/modules/mob/mob_helpers.dm +++ b/code/modules/mob/mob_helpers.dm @@ -498,25 +498,3 @@ It's fairly easy to fix if dealing with single letters but not so much with comp if(HAS_TRAIT(src, TRAIT_DISSECTED)) . += "This body has been dissected and analyzed. It is no longer worth experimenting on.
" - -// Used to make sure that a player has a valid job preference setup, used to knock players out of eligibility for anything if their prefs don't make sense. -// A "valid job preference setup" in this situation means at least having one job set to low, or not having "return to lobby" enabled -// Prevents "antag rolling" by setting antag prefs on, all jobs to never, and "return to lobby if preferences not availible" -// Doing so would previously allow you to roll for antag, then send you back to lobby if you didn't get an antag role -// This also does some admin notification and logging as well -/mob/proc/has_valid_preferences() - if(!client) - return FALSE //Not sure how this would get run without the mob having a client, but let's just be safe. - if(client.prefs.joblessrole != RETURNTOLOBBY) - return TRUE - // If they have antags enabled, they're potentially doing this on purpose instead of by accident. Notify admins if so. - var/has_antags = FALSE - if(client.prefs.be_special.len > 0) - has_antags = TRUE - if(client.prefs.job_preferences.len == 0) - to_chat(src, "You have no jobs enabled, along with return to lobby if job is unavailable. This makes you ineligible for any round start role, please update your job preferences.") - if(has_antags) - log_admin("[src.ckey] just got booted back to lobby with no jobs, but antags enabled.") - message_admins("[src.ckey] just got booted back to lobby with no jobs enabled, but antag rolling enabled. Likely antag rolling abuse.") - return FALSE //This is the only case someone should actually be completely blocked from antag rolling as well - return TRUE From c6193255f76ae43218cd524f880388b8e2db001a Mon Sep 17 00:00:00 2001 From: actioninja Date: Tue, 4 Jun 2019 19:41:41 -0700 Subject: [PATCH 2/2] renames the func to make it clearer it has extra logic in it --- code/controllers/subsystem/job.dm | 2 +- code/game/gamemodes/game_mode.dm | 2 +- code/modules/mob/dead/new_player/new_player.dm | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/code/controllers/subsystem/job.dm b/code/controllers/subsystem/job.dm index d59dd2b0625..bb5029aa2ce 100644 --- a/code/controllers/subsystem/job.dm +++ b/code/controllers/subsystem/job.dm @@ -241,7 +241,7 @@ SUBSYSTEM_DEF(job) //Get the players who are ready for(var/mob/dead/new_player/player in GLOB.player_list) - if(player.ready == PLAYER_READY_TO_PLAY && player.has_valid_preferences() && player.mind && !player.mind.assigned_role) + if(player.ready == PLAYER_READY_TO_PLAY && player.check_preferences() && player.mind && !player.mind.assigned_role) unassigned += player initial_players_to_assign = unassigned.len diff --git a/code/game/gamemodes/game_mode.dm b/code/game/gamemodes/game_mode.dm index affc7c4f2e6..56165b47b4e 100644 --- a/code/game/gamemodes/game_mode.dm +++ b/code/game/gamemodes/game_mode.dm @@ -360,7 +360,7 @@ // Ultimate randomizing code right here for(var/mob/dead/new_player/player in GLOB.player_list) - if(player.client && player.ready == PLAYER_READY_TO_PLAY && player.has_valid_preferences()) + if(player.client && player.ready == PLAYER_READY_TO_PLAY && player.check_preferences()) players += player // Shuffling, the players list is now ping-independent!!! diff --git a/code/modules/mob/dead/new_player/new_player.dm b/code/modules/mob/dead/new_player/new_player.dm index 12603de7828..d1d3d3a9d81 100644 --- a/code/modules/mob/dead/new_player/new_player.dm +++ b/code/modules/mob/dead/new_player/new_player.dm @@ -535,8 +535,8 @@ // A "valid job preference setup" in this situation means at least having one job set to low, or not having "return to lobby" enabled // Prevents "antag rolling" by setting antag prefs on, all jobs to never, and "return to lobby if preferences not availible" // Doing so would previously allow you to roll for antag, then send you back to lobby if you didn't get an antag role -// This also does some admin notification and logging as well -/mob/dead/new_player/proc/has_valid_preferences() +// This also does some admin notification and logging as well, as well as some extra logic to make sure things don't go wrong +/mob/dead/new_player/proc/check_preferences() if(!client) return FALSE //Not sure how this would get run without the mob having a client, but let's just be safe. if(client.prefs.joblessrole != RETURNTOLOBBY)