Skip to content
Open
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
4 changes: 4 additions & 0 deletions code/__DEFINES/jobs.dm
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,10 @@
// CRIMSON EDIT ADD START

#define JOB_UNAVAILABLE_DONATOR 18
#define JOB_UNAVAILABLE_BANNED_SPLAT 19
#define JOB_UNAVAILABLE_BANNED_TRIBE 20
#define JOB_UNAVAILABLE_BANNED_CLAN 21
#define JOB_UNAVAILABLE_BANNED_AUSPICE 22

// CRIMSON EDIT ADD END

Expand Down
14 changes: 14 additions & 0 deletions code/__HELPERS/~~crimson_helpers/text.dm
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,17 @@
if(isnull(http_regex))
http_regex = new("^https?://")
return findtext(text, http_regex)

// example: my_ass_hurts -> MyAssHurts or My Ass Hurts (with underscore_as_space)
/// Snakecake to pascalcase
/proc/snake_to_pascal(text, underscore_as_space = FALSE)
var/list/parts = splittext(text, "_")
var/result = ""

for (var/part in parts)
if (underscore_as_space)
if (result)
result += " "
result += uppertext(copytext(part, 1, 2)) + copytext(part, 2)

return result
49 changes: 47 additions & 2 deletions code/modules/admin/sql_ban_system.dm
Original file line number Diff line number Diff line change
Expand Up @@ -362,6 +362,14 @@
"}
break_counter++
output += "</div></div>"
// CRIMSON EDIT ADD START - SUBSPLAT_BANS
var/list/clan_list = list()
for(var/key in GLOB.vampire_clan_list)
var/datum/subsplat/vampire_clan/clan = GLOB.vampire_clan_list[key]
if(clan)
clan_list += clan.name
// CRIMSON EDIT END

var/list/long_job_lists = list(
"Ghost and Other Roles" = list(
ROLE_PAI,
Expand Down Expand Up @@ -405,14 +413,51 @@
ROLE_VOIDWALKER,
ROLE_WIZARD,
),
// CRIMSON EDIT ADD START - SUBSPLAT_BANS
// SPLAT_* and VAMPIRE_* defines are in snake_case, so below we'll have the label converted with snake_to_pascal
"Splats" = list(
SPLAT_KINDRED,
SPLAT_GHOUL,
SPLAT_KINFOLK,
SPLAT_GAROU,
SPLAT_CORAX,
),
Comment thread
flleeppyy marked this conversation as resolved.
"Clans" = clan_list,
"Tribes" = list(
TRIBE_RONIN,
TRIBE_BLACK_FURIES,
TRIBE_BONE_GNAWERS,
TRIBE_CHILDREN_OF_GAIA,
TRIBE_FIANNA,
TRIBE_GALESTALKERS,
TRIBE_GET_OF_FENRIS,
TRIBE_UKTENA,
TRIBE_GLASS_WALKERS,
TRIBE_RED_TALONS,
TRIBE_SHADOW_LORDS,
TRIBE_SILENT_STRIDERS,
TRIBE_SILVER_FANGS,
TRIBE_STARGAZERS,
TRIBE_BLACK_SPIRAL_DANCERS,
),
"Auspice" = list( // body wash cant block odor for 16 hours
AUSPICE_NONE,
AUSPICE_RAGABASH,
AUSPICE_THEURGE,
AUSPICE_PHILODOX,
AUSPICE_AHROUN,
AUSPICE_GALLIARD,
)
// CRIMSON EDIT ADD END
)
for(var/department in long_job_lists)
output += "<div class='column'><label class='rolegroup long [ckey(department)]'><input type='checkbox' name='[department]' class='hidden' onClick='header_click_all_checkboxes(this)'>[department]</label><div class='content'>"
break_counter = 0
for(var/job in long_job_lists[department])
if(break_counter > 0 && (break_counter % 10 == 0))
output += "<br>"
output += {"<label class='inputlabel checkbox'>[job]
// CRIMSON EDIT BELOW - SUBSPLAT_BANS - Original: output += {"<label class='inputlabel checkbox'>[job]
output += {"<label class='inputlabel checkbox'>[(department == "Splats" || department == "Clans") ? snake_to_pascal(replacetext(job, "splat_", ""), TRUE) : job]
<input type='checkbox' name='[job]' class='[department]' value='1'>
<div class='inputbox[(job in banned_from) ? " banned" : ""]'></div></label>
"}
Expand Down Expand Up @@ -526,7 +571,7 @@
if("server")
roles_to_ban += "Server"
if("role")
href_list.Remove("Command", "Security", "Engineering", "Medical", "Science", "Supply", "Silicon", "Abstract", "Service", "Ghost and Other Roles", "Antagonist Positions") //remove the role banner hidden input values
href_list.Remove("Command", "Security", "Engineering", "Medical", "Science", "Supply", "Silicon", "Abstract", "Service", "Ghost and Other Roles", "Antagonist Positions", "Darkpack Ban Options", "Splats", "Clans", "Auspices", "Tribes") //remove the role banner hidden input values // CRIMSON EDIT ADDITION - SUBSPLAT_BANS : "Darkpack Ban Options", "Splats", "Clans"
var/delimiter_pos = href_list.Find("roleban_delimiter")
if(href_list.len == delimiter_pos)
error_state += "Role ban was selected but no roles to ban were selected."
Expand Down
5 changes: 5 additions & 0 deletions code/modules/client/preferences.dm
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,7 @@ GLOBAL_LIST_EMPTY(preferences_datums)
data["window"] = current_window

data["content_unlocked"] = unlock_content
data["see_own_notes"] = CONFIG_GET(flag/see_own_notes) // CRIMSON EDIT ADD - SUBSPLAT_BANS

for (var/datum/preference_middleware/preference_middleware as anything in middleware)
data += preference_middleware.get_ui_static_data(user)
Expand Down Expand Up @@ -317,6 +318,10 @@ GLOBAL_LIST_EMPTY(preferences_datums)

return TRUE
// DARKPACK EDIT ADD END
// CRIMSON EDIT ADD START - SUBSPLAT_BANS
if ("show_notes")
browse_messages(null, usr.ckey, null, TRUE)
// CRIMSON EDIT ADD END

for (var/datum/preference_middleware/preference_middleware as anything in middleware)
var/delegation = preference_middleware.action_delegations[action]
Expand Down
2 changes: 1 addition & 1 deletion code/modules/mob/dead/new_player/latejoin_menu.dm
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ GLOBAL_DATUM_INIT(latejoin_menu, /datum/latejoin_menu, new)
if(job_availability != JOB_AVAILABLE)
if (job_datum.job_flags & JOB_HIDE_WHEN_EMPTY)
continue
job_data["unavailable_reason"] = get_job_unavailable_error_message(job_availability, job_datum.title)
job_data["unavailable_reason"] = get_job_unavailable_error_message(job_availability, job_datum.title, user) // CRIMSON EDIT CHANGE - SUBSPLAT_BANS - original: job_data["unavailable_reason"] = get_job_unavailable_error_message(job_availability, job_datum.title)

if(job_datum.total_positions < 0)
department_data["open_slots"] = "∞"
Expand Down
30 changes: 28 additions & 2 deletions code/modules/mob/dead/new_player/new_player.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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."
Expand Down Expand Up @@ -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

Copy link
Copy Markdown

Choose a reason for hiding this comment

The 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.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The 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


Expand Down Expand Up @@ -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)
Expand Down
53 changes: 36 additions & 17 deletions html/admin/banpanel.css
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 */
22 changes: 22 additions & 0 deletions modular_darkpack/modules/jobs/code/_job_assignment.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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

Copy link
Copy Markdown

Choose a reason for hiding this comment

The 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?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The 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]" : ""]")
Expand Down Expand Up @@ -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))
Expand All @@ -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))
Expand All @@ -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

44 changes: 44 additions & 0 deletions modular_vcg/modules/subsplat_bans/README.md
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
22 changes: 22 additions & 0 deletions modular_vcg/modules/subsplat_bans/code/bans.dm
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)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seemingly no similar feature for splats (not subsplats)

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The 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])

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1 var names.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The 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 ..()
1 change: 1 addition & 0 deletions tgstation.dme
Original file line number Diff line number Diff line change
Expand Up @@ -8325,6 +8325,7 @@
#include "modular_vcg\modules\powers\code\discipline\fortitude\fortitude.dm"
#include "modular_vcg\modules\powers\code\discipline\potence\potence.dm"
#include "modular_vcg\modules\relays\code\relays.dm"
#include "modular_vcg\modules\subsplat_bans\code\bans.dm"
#include "modular_vcg\modules\toggle_looc\code\looc_toggle.dm"
#include "modular_vcg\modules\weapons\code\guns.dm"
#include "modular_vcg\modules\weapons\code\melee.dm"
Expand Down
Loading