-
Notifications
You must be signed in to change notification settings - Fork 54
Ability to ban subsplats #116
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
base: master
Are you sure you want to change the base?
Changes from all commits
210d9fe
f10a88d
26d497a
f2de00d
3b9f4c7
f75f726
99b2247
3a19784
08a2f5c
e2ee39d
d6bcaac
b9412c6
d2cbdd2
01571f5
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -114,7 +114,7 @@ | |
| qdel(src) | ||
| return TRUE | ||
|
|
||
| /proc/get_job_unavailable_error_message(retval, jobtitle) | ||
| /proc/get_job_unavailable_error_message(retval, jobtitle, mob/player) // CRIMSON EDIT CHANGE - SUBSPLAT_BANS - original: /proc/get_job_unavailable_error_message(retval, jobtitle) | ||
| switch(retval) | ||
| if(JOB_AVAILABLE) | ||
| return "[jobtitle] is available." | ||
|
|
@@ -157,6 +157,32 @@ | |
| // CRIMSON EDIT ADD START | ||
| if(JOB_UNAVAILABLE_DONATOR) | ||
| return "You need to be a donator to have play as [jobtitle]." | ||
|
|
||
| var/datum/subsplat/vampire_clan/clan | ||
| var/datum/subsplat/werewolf/auspice/auspice | ||
| var/datum/subsplat/werewolf/tribe/tribe | ||
| var/splat_pref | ||
| var/player_splat_id | ||
| if(player) | ||
| splat_pref = player.client.prefs.read_preference(/datum/preference/choiced/splats) | ||
| if(ispath(splat_pref)) | ||
| var/datum/splat/player_splat = GLOB.splat_prototypes[splat_pref] | ||
| player_splat_id = player_splat.id | ||
| else | ||
| player_splat_id = splat_pref | ||
| clan = get_vampire_clan(player.client.prefs.read_preference(/datum/preference/choiced/subsplat/vampire_clan)) | ||
| auspice = get_fera_auspice(player.client.prefs.read_preference(/datum/preference/choiced/subsplat/fera_auspice/garou)) | ||
| tribe = get_fera_tribe(player.client.prefs.read_preference(/datum/preference/choiced/subsplat/fera_tribe/garou)) | ||
|
Comment on lines
+174
to
+175
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. hardcoding to the garou choices will become an issue when other changing breeds get tribes you will want to ban.
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. how should i go about it then? I still can't fully wrap my head around this subsplat concept. |
||
|
|
||
| switch(retval) | ||
| if(JOB_UNAVAILABLE_BANNED_SPLAT) | ||
| return "You are currently banned from the [player_splat_id ? snake_to_pascal(player_splat_id, TRUE) : "currently selected"] splat." | ||
| if(JOB_UNAVAILABLE_BANNED_CLAN) | ||
| return "You are currently banned from the [clan?.name || "currently selected"] clan." | ||
| if(JOB_UNAVAILABLE_BANNED_TRIBE) | ||
| return "You are currently banned from the [tribe?.id || "currently selected"] tribe." | ||
| if(JOB_UNAVAILABLE_BANNED_AUSPICE) | ||
| return "You are currently banned from the [auspice?.id || "currently selected"] auspice." | ||
| // CRIMSON EDIT ADD END | ||
|
|
||
|
|
||
|
|
@@ -193,7 +219,7 @@ | |
|
|
||
| var/error = IsJobUnavailable(rank) | ||
| if(error != JOB_AVAILABLE) | ||
| tgui_alert(usr, get_job_unavailable_error_message(error, rank)) | ||
| tgui_alert(usr, get_job_unavailable_error_message(error, rank, usr)) // CRIMSON EDIT CHANGE - SUBSPLAT_BANS - Original: tgui_alert(usr, get_job_unavailable_error_message(error, rank)) | ||
| return FALSE | ||
|
|
||
| if(SSshuttle.arrivals) | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,46 +1,65 @@ | ||
| .middle { | ||
| width: 80px; | ||
| width: 80px; | ||
| } | ||
|
|
||
| .right { | ||
| width: 150px; | ||
| width: 150px; | ||
| } | ||
|
|
||
| .reason { | ||
| resize: none; | ||
| min-height: 40px; | ||
| width: 340px; | ||
| resize: none; | ||
| min-height: 40px; | ||
| width: 340px; | ||
| } | ||
|
|
||
| .rolegroup { | ||
| padding: 3px; | ||
| width: 430px; | ||
| border: none; | ||
| text-align: center; | ||
| outline: none; | ||
| display: inline-block; | ||
| padding: 3px; | ||
| width: 430px; | ||
| border: none; | ||
| text-align: center; | ||
| outline: none; | ||
| display: inline-block; | ||
| } | ||
|
|
||
| .long { | ||
| width: 860px; | ||
| width: 860px; | ||
| } | ||
|
|
||
| .content { | ||
| text-align: center; | ||
| text-align: center; | ||
| } | ||
|
|
||
| .abstract { | ||
| background-color: #708090; | ||
| background-color: #708090; | ||
| } | ||
|
|
||
| .ghostandotherroles { | ||
| background-color: #5c00e6; | ||
| background-color: #5c00e6; | ||
| } | ||
|
|
||
| .antagonistpositions { | ||
| background-color: #6d3f40; | ||
| background-color: #6d3f40; | ||
| } | ||
|
|
||
| .no_department { | ||
| background-color: #111cf7; | ||
| background-color: #111cf7; | ||
| } | ||
|
|
||
| /* CRIMSON EDIT ADD START - subsplat_bans */ | ||
| .splats { | ||
| background-color: #b95447; | ||
| } | ||
|
|
||
| .clans { | ||
| background-color: #7e390a; | ||
| } | ||
|
|
||
| .tribes { | ||
| background-color: #3f2b2b; | ||
| } | ||
|
|
||
| .auspice { | ||
| background-color: #521a1a; | ||
| } | ||
|
|
||
| /* CRIMSON EDIT ADD END */ |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -33,6 +33,12 @@ | |
| job_debug("[debug_prefix] Error: [get_job_unavailable_error_message(JOB_UNAVAILABLE_SPLAT_SLOTS, possible_job.title)], Player: [player][add_job_to_log ? ", Job: [possible_job]" : ""]") | ||
| return JOB_UNAVAILABLE_SPLAT_SLOTS | ||
|
|
||
| // CRIMSON EDIT ADD START - SUBSPLAT_BANS | ||
| if(is_banned_from(player.ckey, player_splat_id)) | ||
| job_debug("[debug_prefix] Error: [get_job_unavailable_error_message(JOB_UNAVAILABLE_BANNED, player_splat_id)], Player: [player][add_job_to_log ? ", Job: [possible_job]" : ""]") | ||
| return JOB_UNAVAILABLE_BANNED_SPLAT | ||
| // CRIMSON EDIT ADD END | ||
|
Comment on lines
+36
to
+40
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I belive this runs ban checks for EVERY job it tries to assign? Likely should be moved up before job selection?
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. doesn't matter where it's moved up, itll hit it eventually because this is all a bunch of checks to see if it should decline. but im assuming you want it earlier in the chain so its the first to show, even though in tg code, bans checks do not come first. |
||
|
|
||
| /* | ||
| if(possible_job.whitelisted) | ||
| job_debug("[debug_prefix] Error: [get_job_unavailable_error_message(JOB_UNAVAILABLE_WHITELIST, possible_job.title)], Player: [player][add_job_to_log ? ", Job: [possible_job]" : ""]") | ||
|
|
@@ -76,6 +82,11 @@ | |
| if(possible_job.disallowed_clans && (clan.id in possible_job.disallowed_clans)) | ||
| job_debug("[debug_prefix] Error: [get_job_unavailable_error_message(JOB_UNAVAILABLE_KINDRED_CLAN, possible_job.title)], Player: [player][add_job_to_log ? ", Job: [possible_job]" : ""]") | ||
| return JOB_UNAVAILABLE_KINDRED_CLAN | ||
| // CRIMSON EDIT ADD START - SUBSPLAT_BANS | ||
| if(is_banned_from(player.ckey, clan.name)) | ||
| job_debug("[debug_prefix] Error: [get_job_unavailable_error_message(JOB_UNAVAILABLE_BANNED_CLAN, clan.name)], Player: [player][add_job_to_log ? ", Job: [possible_job]" : ""]") | ||
| return JOB_UNAVAILABLE_BANNED_CLAN | ||
| // CRIMSON EDIT ADD END | ||
|
|
||
| /datum/controller/subsystem/job/proc/check_garou_prefs(client/player_client, mob/dead/new_player/player, datum/job/possible_job, debug_prefix = "", add_job_to_log = FALSE) | ||
| var/datum/subsplat/werewolf/auspice/auspice = get_fera_auspice(player_client.prefs.read_preference(/datum/preference/choiced/subsplat/fera_auspice/garou)) | ||
|
|
@@ -85,6 +96,11 @@ | |
| if(possible_job.disallowed_auspice && (auspice.name in possible_job.disallowed_auspice)) | ||
| job_debug("[debug_prefix] Error: [get_job_unavailable_error_message(JOB_UNAVAILABLE_FERA_AUSPICE, possible_job.title)], Player: [player][add_job_to_log ? ", Job: [possible_job]" : ""]") | ||
| return JOB_UNAVAILABLE_FERA_AUSPICE | ||
| // CRIMSON EDIT ADD START - SUBSPLAT_BANS | ||
| if(is_banned_from(player.ckey, auspice.name)) | ||
| job_debug("[debug_prefix] Error: [get_job_unavailable_error_message(JOB_UNAVAILABLE_BANNED_AUSPICE, auspice.name)], Player: [player][add_job_to_log ? ", Job: [possible_job]" : ""]") | ||
| return JOB_UNAVAILABLE_BANNED_AUSPICE | ||
| // CRIMSON EDIT ADD END | ||
|
|
||
| var/datum/subsplat/werewolf/tribe/tribe = get_fera_tribe(player_client.prefs.read_preference(/datum/preference/choiced/subsplat/fera_tribe/garou)) | ||
| if(possible_job.allowed_tribes && !(tribe.name in possible_job.allowed_tribes)) | ||
|
|
@@ -93,3 +109,9 @@ | |
| if(possible_job.disallowed_tribes && (tribe.name in possible_job.disallowed_tribes)) | ||
| job_debug("[debug_prefix] Error: [get_job_unavailable_error_message(JOB_UNAVAILABLE_FERA_TRIBE, possible_job.title)], Player: [player][add_job_to_log ? ", Job: [possible_job]" : ""]") | ||
| return JOB_UNAVAILABLE_FERA_TRIBE | ||
| // CRIMSON EDIT ADD START - SUBSPLAT_BANS | ||
| if(is_banned_from(player.ckey, tribe.name)) | ||
| job_debug("[debug_prefix] Error: [get_job_unavailable_error_message(JOB_UNAVAILABLE_BANNED_TRIBE, tribe.name)], Player: [player][add_job_to_log ? ", Job: [possible_job]" : ""]") | ||
| return JOB_UNAVAILABLE_BANNED_TRIBE | ||
| // CRIMSON EDIT ADD END | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,44 @@ | ||
| https://github.com/Monkestation/crimson-grid/pull/116 | ||
|
|
||
| ## Subsplat Bans | ||
|
|
||
| Module ID: SUBSPLAT_BANS<!-- Uppercase, UNDERSCORE_CONNECTED name of your module, that you use to mark files. This is so people can case-sensitive search for your edits, if any. --> | ||
|
|
||
| ### Description: | ||
|
|
||
| ability to ban splats and subsplats. yes the name is misleading, no i dont wanna rename it. | ||
|
|
||
| ### TG Proc/File Changes: | ||
|
|
||
| - `code/modules/admin/sql_ban_system.dm`: added Splats, Clans, Tribes, and Auspice's to `long_job_lists` | ||
| - `code/modules/mob/dead/new_player/latejoin_menu.dm`: `/datum/latejoin_menu/ui_data` added `mob` argument to `get_job_unavailable_error_message` | ||
| - `code/modules/mob/dead/new_player/new_player.dm`: `get_job_unavailable_error_message` message additions, also the above | ||
| - `modular_darkpack/modules/jobs/code/_job_assignment.dm`: added `is_banned_from` check for everything applicable | ||
| - `tgui/packages/tgui/interfaces/PreferencesMenu/CharacterPreferences/MainPage.tsx` | ||
| - `tgui/packages/tgui/interfaces/PreferencesMenu/types.ts` | ||
|
|
||
| ### Modular Overrides: | ||
|
|
||
| - N/A | ||
| <!-- If you added a new modular override (file or code-wise) for your module, you should list it here. Code files should specify what procs they changed, in case of multiple modules using the same file. | ||
| E.g: | ||
| - `modular_nova/master_files/sound/my_cool_sound.ogg` | ||
| - `modular_nova/master_files/code/my_modular_override.dm`: `proc/overriden_proc`, `var/overriden_var` | ||
| --> | ||
|
|
||
| ### Defines: | ||
|
|
||
| - `code/__DEFINES/jobs.dm`: JOB_UNAVAILABLE_BANNED_SPLAT, JOB_UNAVAILABLE_BANNED_TRIBE, JOB_UNAVAILABLE_BANNED_CLAN, JOB_UNAVAILABLE_BANNED_AUSPICE | ||
|
|
||
| <!-- If you needed to add any defines, mention the files you added those defines in, along with the name of the defines. --> | ||
|
|
||
| ### Included files that are not contained in this module: | ||
|
|
||
| - `code/__HELPERS/~~crimson_helpers/text.dm`: `snake_to_pascal` | ||
| <!-- Likewise, be it a non-modular file or a modular one that's not contained within the folder belonging to this specific module, it should be mentioned here. Good examples are icons or sounds that are used between multiple modules, or other such edge-cases. --> | ||
|
|
||
| ### Credits: | ||
|
|
||
| <!-- Here go the credits to you, dear coder, and in case of collaborative work or ports, credits to the original source of the code. --> | ||
|
|
||
| Flleeppyy |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,22 @@ | ||
| /datum/preference_middleware/feature_bans/get_ui_static_data(mob/user) | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Seemingly no similar feature for splats (not subsplats)
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. cause species is a different kind of preference, not a feature. i hate the naming for all the preferences stuff cause like, everything is technically a feature and preference but they make it complicated to comprehend. |
||
| var/list/data = list( | ||
| "banned_features" = list() | ||
| ) | ||
| var/list/features = alist( | ||
| "auspice" = GLOB.auspices_list, | ||
| "tribe" = GLOB.tribes_list, | ||
| "vampire_clan" = GLOB.vampire_clan_list, | ||
| ) | ||
| for(var/feature in features) | ||
| for(var/creature in features[feature]) | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. +1 var names.
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. :3 |
||
| if(is_banned_from(user.ckey, creature)) | ||
| LAZYADD(data["banned_features"][feature], creature) | ||
|
|
||
| return data | ||
|
|
||
| /datum/preferences/update_preference(datum/preference/preference, preference_value) | ||
| // some subsplats do not have names and only have splat_ids so we cant represent the name in the ban message. | ||
| if(istype(preference, /datum/preference/choiced/subsplat) && (is_banned_from(parent.ckey, preference_value))) | ||
| to_chat(parent, span_warning("You are banned from selecting [preference_value] for [astype(preference, /datum/preference/choiced/subsplat).main_feature_name].")) | ||
| return FALSE | ||
| return ..() | ||
Uh oh!
There was an error while loading. Please reload this page.