Skip to content

Commit

Permalink
Working Joe restriction bypass toggle (#4310)
Browse files Browse the repository at this point in the history
# 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 <[email protected]>
  • Loading branch information
Ben10083 and Zonespace27 committed Sep 4, 2023
1 parent 0742198 commit 7c37cff
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 4 deletions.
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.")

0 comments on commit 7c37cff

Please sign in to comment.