From 7c37cff0e32a193894ad8ad4726a19aa18d0c787 Mon Sep 17 00:00:00 2001 From: Ben <91219575+Ben10083@users.noreply.github.com> Date: Mon, 4 Sep 2023 13:21:08 -0400 Subject: [PATCH] Working Joe restriction bypass toggle (#4310) # About the pull request Adds a new flag, allowing bypasses for Working Joe spawns such as limit, entry_allowed, and if they were a Working Joe before. # Explain why it's good for the game This was requested by event staff, where they want to allow for Joes to respawn easier when they want Working Joes to interact in a manner where death is highly likely. This flag will allow them to loosen restrictions to join as a Joe (still need a WL however, no commoners allowed) for the sake of "roleplay" Considering how this is implemented, may expand to add similar flags for other roles, if needed. # Changelog :cl: admin: New toggleable flag added to bypass restrictions for Working Joe spawns as observer (excluding whitelist requirement) /:cl: --------- Co-authored-by: Zonespace <41448081+Zonespace27@users.noreply.github.com> --- code/__DEFINES/mode.dm | 1 + code/_globalvars/bitfields.dm | 1 + code/game/gamemodes/cm_initialize.dm | 6 +++--- code/modules/admin/admin_verbs.dm | 3 ++- code/modules/admin/tabs/admin_tab.dm | 13 +++++++++++++ 5 files changed, 20 insertions(+), 4 deletions(-) diff --git a/code/__DEFINES/mode.dm b/code/__DEFINES/mode.dm index bb31f4d84b1e..6ca6a142beb2 100644 --- a/code/__DEFINES/mode.dm +++ b/code/__DEFINES/mode.dm @@ -71,6 +71,7 @@ #define MODE_SHIPSIDE_SD (1<<8) /// Toggles whether Predators can big SD when not on the groundmap #define MODE_HARDCORE_PERMA (1<<9) /// Toggles Hardcore for all marines, meaning they instantly perma upon death #define MODE_DISPOSABLE_MOBS (1<<10) // Toggles if mobs fit in disposals or not. Off by default. +#define MODE_BYPASS_JOE (1<<11) // Toggles if ghosts can bypass Working Joe spawn limitations, does NOT bypass WL requirement. Off by default. #define ROUNDSTATUS_FOG_DOWN 1 #define ROUNDSTATUS_PODDOORS_OPEN 2 diff --git a/code/_globalvars/bitfields.dm b/code/_globalvars/bitfields.dm index d71125c318f6..a497f4d01dfb 100644 --- a/code/_globalvars/bitfields.dm +++ b/code/_globalvars/bitfields.dm @@ -417,6 +417,7 @@ DEFINE_BITFIELD(toggleable_flags, list( "MODE_LZ_PROTECTION" = MODE_LZ_PROTECTION, "MODE_SHIPSIDE_SD" = MODE_SHIPSIDE_SD, "MODE_DISPOSABLE_MOBS" = MODE_DISPOSABLE_MOBS, + "MODE_BYPASS_JOE" = MODE_BYPASS_JOE, )) DEFINE_BITFIELD(state, list( diff --git a/code/game/gamemodes/cm_initialize.dm b/code/game/gamemodes/cm_initialize.dm index bc6adc026b6e..36271054bb21 100644 --- a/code/game/gamemodes/cm_initialize.dm +++ b/code/game/gamemodes/cm_initialize.dm @@ -957,7 +957,7 @@ Additional game mode variables. to_chat(joe_candidate, SPAN_WARNING("You are not whitelisted! You may apply on the forums to be whitelisted as a synth.")) return - if(joe_candidate.ckey in joes) + if((joe_candidate.ckey in joes) && !MODE_HAS_TOGGLEABLE_FLAG(MODE_BYPASS_JOE)) if(show_warning) to_chat(joe_candidate, SPAN_WARNING("You already were a Working Joe this round!")) return @@ -965,12 +965,12 @@ Additional game mode variables. // council doesn't count towards this conditional. if(joe_job.get_whitelist_status(RoleAuthority.roles_whitelist, joe_candidate.client) == WHITELIST_NORMAL) var/joe_max = joe_job.total_positions - if(joe_job.current_positions >= joe_max) + if((joe_job.current_positions >= joe_max) && !MODE_HAS_TOGGLEABLE_FLAG(MODE_BYPASS_JOE)) if(show_warning) to_chat(joe_candidate, SPAN_WARNING("Only [joe_max] Working Joes may spawn per round.")) return - if(!enter_allowed) + if(!enter_allowed && !MODE_HAS_TOGGLEABLE_FLAG(MODE_BYPASS_JOE)) if(show_warning) to_chat(joe_candidate, SPAN_WARNING("There is an administrative lock from entering the game.")) return diff --git a/code/modules/admin/admin_verbs.dm b/code/modules/admin/admin_verbs.dm index 5e527e6a5442..7d9127313094 100644 --- a/code/modules/admin/admin_verbs.dm +++ b/code/modules/admin/admin_verbs.dm @@ -135,7 +135,8 @@ var/list/admin_verbs_minor_event = list( /client/proc/adminpanelweapons, /client/proc/admin_general_quarters, /client/proc/admin_biohazard_alert, - /client/proc/toggle_hardcore_perma + /client/proc/toggle_hardcore_perma, + /client/proc/toggle_bypass_joe_restriction, ) var/list/admin_verbs_major_event = list( diff --git a/code/modules/admin/tabs/admin_tab.dm b/code/modules/admin/tabs/admin_tab.dm index 1298d6150036..4f59ad7d2d3d 100644 --- a/code/modules/admin/tabs/admin_tab.dm +++ b/code/modules/admin/tabs/admin_tab.dm @@ -839,3 +839,16 @@ SSticker.mode.toggleable_flags ^= MODE_HARDCORE_PERMA message_admins("[src] has toggled Hardcore [MODE_HAS_TOGGLEABLE_FLAG(MODE_HARDCORE_PERMA) ? "on, causing all humans to instantly go perma on death" : "off, causing all humans to die like normal"].") +/client/proc/toggle_bypass_joe_restriction() + set name = "Toggle Working Joe Restrictions" + set category = "Admin.Flags" + + if(!admin_holder || !check_rights(R_EVENT, FALSE)) + return + + if(!SSticker.mode) + to_chat(usr, SPAN_WARNING("A mode hasn't been selected yet!")) + return + + SSticker.mode.toggleable_flags ^= MODE_BYPASS_JOE + message_admins("[src] has [MODE_HAS_TOGGLEABLE_FLAG(MODE_BYPASS_JOE) ? "allowed players to bypass (except whitelist)" : "prevented players from bypassing"] Working Joe spawn conditions.")