-
Notifications
You must be signed in to change notification settings - Fork 64
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* PLEASE * remove the remnants of the fallen state * we should improve this somewhat * Apply suggestions from code review * Apply suggestions from code review * Update code/modules/jobs/job_types/_job.dm * Update code/datums/brain_damage/creepy_trauma.dm * me when * Typo * Skyrat defines->nova defines * Revert "Skyrat defines->nova defines" This reverts commit 46f5fd5ab97edd58aac59d0fdbdcd48bebc54f95. * Update tgstation.dme * Revert "Update tgstation.dme" This reverts commit 1f5bc9672bba5b28e7d08c47eac695222ee36d67. * Update tgstation.dme * Update tgstation.dme * fix config * awarfgh * this should work? * ill finish this later * okay * arggh * well, at least it can be lazy * agshj * lil fixy * config * tis is a g ood change * guess who forgot to push a commit * Apply suggestions from code review * lets just safeguard * move maroon to rr * Trigger CI * awagga * 2nd debug code * lets fix compile * respect the be antag switch * i need to push this shit already * ok --------- Co-authored-by: nikothedude <[email protected]> Co-authored-by: Bloop <[email protected]> Co-authored-by: Iajret <[email protected]>
- Loading branch information
1 parent
09859ae
commit 6f3fbc0
Showing
23 changed files
with
589 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
//defines for antag opt in objective checking | ||
//objectives check for all players with a value equal or greater than the 'threat' level of an objective then pick from that list | ||
//command + sec roles are always opted in regardless of opt in status | ||
|
||
/// For temporary or otherwise 'inconvenient' objectives like kidnapping or theft | ||
#define OPT_IN_YES_TEMP 1 | ||
/// Cool with being killed or otherwise occupied but not removed from the round | ||
#define OPT_IN_YES_KILL 2 | ||
/// Fine with being round removed. | ||
#define OPT_IN_YES_ROUND_REMOVE 3 | ||
|
||
#define OPT_IN_YES_TEMP_STRING "Yes - Temporary/Inconvenience" | ||
#define OPT_IN_YES_KILL_STRING "Yes - Kill" | ||
#define OPT_IN_YES_ROUND_REMOVE_STRING "Yes - Round Remove" | ||
#define OPT_IN_NOT_TARGET_STRING "No" | ||
|
||
/// Assoc list of stringified opt_in_## define to the front-end string to show users as a representation of the setting. | ||
GLOBAL_LIST_INIT(antag_opt_in_strings, list( | ||
"0" = OPT_IN_NOT_TARGET_STRING, | ||
"1" = OPT_IN_YES_TEMP_STRING, | ||
"2" = OPT_IN_YES_KILL_STRING, | ||
"3" = OPT_IN_YES_ROUND_REMOVE_STRING, | ||
)) | ||
|
||
/// Assoc list of stringified opt_in_## define to the color associated with it. | ||
GLOBAL_LIST_INIT(antag_opt_in_colors, list( | ||
OPT_IN_NOT_TARGET_STRING = COLOR_GRAY, | ||
OPT_IN_YES_TEMP_STRING = COLOR_EMERALD, | ||
OPT_IN_YES_KILL_STRING = COLOR_ORANGE, | ||
OPT_IN_YES_ROUND_REMOVE_STRING = COLOR_RED | ||
)) | ||
|
||
/// Prefers not to be a target. Will still be a potential target if playing sec or command. | ||
#define OPT_IN_NOT_TARGET 0 | ||
|
||
/// The minimum opt-in level for people playing sec. | ||
#define SECURITY_OPT_IN_LEVEL OPT_IN_YES_KILL | ||
/// The minimum opt-in level for people playing command. | ||
#define COMMAND_OPT_IN_LEVEL OPT_IN_YES_KILL | ||
|
||
/// The default opt in level for preferences and mindless mobs. | ||
#define OPT_IN_DEFAULT_LEVEL OPT_IN_NOT_TARGET | ||
|
||
/// If the player has any non-ghost role antags enabled, they are forced to use a minimum of this. | ||
#define OPT_IN_ANTAG_ENABLED_LEVEL OPT_IN_YES_TEMP |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
/datum/config_entry/flag/disable_antag_opt_in_preferences | ||
default = FALSE |
33 changes: 33 additions & 0 deletions
33
modular_nova/modules/antag_opt_in/code/antag_optin_preferences.dm
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
/datum/preference/choiced/antag_opt_in_status | ||
category = PREFERENCE_CATEGORY_NON_CONTEXTUAL | ||
savefile_identifier = PREFERENCE_CHARACTER | ||
savefile_key = "antag_opt_in_status_pref" | ||
|
||
/datum/preference/choiced/antag_opt_in_status/init_possible_values() | ||
return list(OPT_IN_YES_TEMP, OPT_IN_YES_KILL, OPT_IN_YES_ROUND_REMOVE, OPT_IN_NOT_TARGET) | ||
|
||
/datum/preference/choiced/antag_opt_in_status/create_default_value() | ||
return OPT_IN_DEFAULT_LEVEL | ||
|
||
/datum/preference/choiced/antag_opt_in_status/is_accessible(datum/preferences/preferences) | ||
if (!..(preferences)) | ||
return FALSE | ||
|
||
return !(CONFIG_GET(flag/disable_antag_opt_in_preferences)) | ||
|
||
/datum/preference/choiced/antag_opt_in_status/deserialize(input, datum/preferences/preferences) | ||
if(CONFIG_GET(flag/disable_antag_opt_in_preferences)) | ||
return OPT_IN_DEFAULT_LEVEL | ||
|
||
return ..() | ||
|
||
/datum/preference/choiced/antag_opt_in_status/apply_to_human(mob/living/carbon/human/target, value, datum/preferences/preferences) | ||
return FALSE | ||
|
||
/datum/preference/choiced/antag_opt_in_status/compile_constant_data() | ||
var/list/data = ..() | ||
|
||
// An assoc list of values to display names so we don't show players numbers in their settings! | ||
data[CHOICED_PREFERENCE_DISPLAY_NAMES] = GLOB.antag_opt_in_strings | ||
|
||
return data |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
/datum/job | ||
/// The minimum antag opt-in any holder of this job must use. If null, will defer to the mind's opt in level. | ||
var/minimum_opt_in_level | ||
/// Can this job be targetted as a heretic sacrifice target? | ||
var/heretic_sac_target | ||
/// Is this job targetable by contractors? | ||
var/contractable | ||
|
||
/// Updates [minimum_opt_in_level] [heretic_sac_target] and [contractable]. | ||
/datum/job/proc/update_opt_in_vars() | ||
if(CONFIG_GET(flag/disable_antag_opt_in_preferences)) | ||
return | ||
|
||
if(isnull(minimum_opt_in_level)) | ||
minimum_opt_in_level = get_initial_opt_in_level() | ||
if(isnull(heretic_sac_target)) | ||
heretic_sac_target = initialize_heretic_target_status() | ||
if(isnull(contractable)) | ||
contractable = initialize_contractable_status() | ||
|
||
update_opt_in_desc_suffix() | ||
|
||
/// Returns this job's initial opt in level, taking into account departmental bitflags. | ||
/datum/job/proc/get_initial_opt_in_level() | ||
if (departments_bitflags & (DEPARTMENT_BITFLAG_SECURITY)) | ||
return SECURITY_OPT_IN_LEVEL | ||
if (departments_bitflags & (DEPARTMENT_BITFLAG_COMMAND)) | ||
return COMMAND_OPT_IN_LEVEL | ||
|
||
/// Determines if this job should be sacrificable by heretics. | ||
/datum/job/proc/initialize_heretic_target_status() | ||
if (departments_bitflags & (DEPARTMENT_BITFLAG_SECURITY | DEPARTMENT_BITFLAG_COMMAND)) | ||
return TRUE | ||
|
||
return FALSE | ||
|
||
/// Determines if this job should be targetable by contractors. | ||
/datum/job/proc/initialize_contractable_status() | ||
if (departments_bitflags & (DEPARTMENT_BITFLAG_SECURITY | DEPARTMENT_BITFLAG_COMMAND)) | ||
return TRUE | ||
|
||
return FALSE | ||
|
||
/// Generates and sets a suffix appended to our description detailing our opt-in variables. | ||
/datum/job/proc/update_opt_in_desc_suffix() | ||
var/list/suffixes = list() | ||
|
||
if (minimum_opt_in_level) | ||
suffixes += " Forces a minimum of [GLOB.antag_opt_in_strings["[minimum_opt_in_level]"]] antag opt-in." | ||
if (contractable) | ||
suffixes += " Targetable by contractors." | ||
if (heretic_sac_target) | ||
suffixes += " Targetable by heretics." | ||
if (length(suffixes)) | ||
var/suffix = jointext(suffixes, "") | ||
set_opt_in_desc_suffix(suffix) | ||
|
||
/// Setter for [new_suffix]. Resets desc then appends the new suffix. | ||
/datum/job/proc/set_opt_in_desc_suffix(new_suffix) | ||
description = initial(description) | ||
|
||
if (new_suffix) | ||
description += new_suffix | ||
|
||
/datum/controller/subsystem/job/SetupOccupations() | ||
. = ..() | ||
|
||
if(CONFIG_GET(flag/disable_antag_opt_in_preferences)) | ||
return | ||
|
||
for(var/datum/job/job as anything in all_occupations) | ||
job.update_opt_in_vars() |
Oops, something went wrong.