Skip to content

Commit

Permalink
feat(prefs): add become midround antag pref
Browse files Browse the repository at this point in the history
  • Loading branch information
No-Tips committed Nov 29, 2023
1 parent 09dc7fe commit e9e48f8
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
11 changes: 11 additions & 0 deletions code/game/antagonist/antagonist.dm
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,17 @@
if(config.game.use_age_restriction_for_antags && player.current.client.player_age < min_player_age)
log_debug_verbose("[key_name(player)] is not eligible to become a [role_text]: Is only [player.current.client.player_age] day\s old, has to be [min_player_age] day\s!")
return FALSE
if(player.current.client.get_preference_value(/datum/client_preference/become_midround_antag) != GLOB.PREF_YES && GAME_STATE >= RUNLEVEL_GAME)
log_debug("[key_name(player)] set their preference to disable becoming midround antag!")
switch(player.current.client.get_preference_value(/datum/client_preference/become_midround_antag))
if(GLOB.PREF_NO)
return FALSE
if(GLOB.PREF_AS_GHOST)
if(!isghostmind(player))
return FALSE
if(GLOB.PREF_AS_LIVING)
if(isghostmind(player))
return FALSE
if(player.special_role)
log_debug_verbose("[key_name(player)] is not eligible to become a [role_text]: They already have a special role ([player.special_role])!")
return FALSE
Expand Down
9 changes: 9 additions & 0 deletions code/modules/client/preference_setup/global/preferences.dm
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ GLOBAL_VAR_CONST(PREF_DARK, "Dark")
GLOBAL_VAR_CONST(PREF_LOW, "Low")
GLOBAL_VAR_CONST(PREF_MED, "Medium")
GLOBAL_VAR_CONST(PREF_HIGH, "High")
GLOBAL_VAR_CONST(PREF_AS_GHOST, "Only as ghost")
GLOBAL_VAR_CONST(PREF_AS_LIVING, "Only when alive")

var/global/list/_client_preferences
var/global/list/_client_preferences_by_key
Expand Down Expand Up @@ -93,6 +95,13 @@ var/global/list/_client_preferences_by_type
/*********************
* Player Preferences *
*********************/

/datum/client_preference/become_midround_antag
description = "Become Midround Antag"
key = "GAME_MIDROUND_ANTAG"
options = list(GLOB.PREF_YES, GLOB.PREF_NO, GLOB.PREF_AS_GHOST, GLOB.PREF_AS_LIVING)
default_value = GLOB.PREF_YES

/datum/client_preference/runechat
description = "Show Runechat (Above-Head-Speech)"
key = "CHAT_RUNECHAT"
Expand Down

0 comments on commit e9e48f8

Please sign in to comment.