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

Working Joe restriction bypass toggle #4310

Merged
merged 2 commits into from
Sep 4, 2023
Merged
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
1 change: 1 addition & 0 deletions code/__DEFINES/mode.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions code/_globalvars/bitfields.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
6 changes: 3 additions & 3 deletions code/game/gamemodes/cm_initialize.dm
Original file line number Diff line number Diff line change
Expand Up @@ -957,20 +957,20 @@ 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

// 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
Expand Down
3 changes: 2 additions & 1 deletion code/modules/admin/admin_verbs.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
13 changes: 13 additions & 0 deletions code/modules/admin/tabs/admin_tab.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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.")