[MIRROR] add more whitelist checks (#12038)

Co-authored-by: Kashargul <144968721+Kashargul@users.noreply.github.com>
Co-authored-by: Selis <12716288+ItsSelis@users.noreply.github.com>
This commit is contained in:
CHOMPStation2StaffMirrorBot
2025-11-27 03:18:46 -07:00
committed by GitHub
parent f28d8b9b1b
commit 03abe9a4d4
3 changed files with 27 additions and 4 deletions

View File

@@ -1,7 +1,7 @@
//Languages/species/whitelist.
GLOBAL_LIST_EMPTY_TYPED(all_species, /datum/species)
GLOBAL_LIST_EMPTY_TYPED(whitelisted_species, /datum/species) // Species that require a whitelist check.
GLOBAL_LIST_EMPTY_TYPED(playable_species, /datum/species) // A list of ALL playable species, whitelisted, latejoin or otherwise.
GLOBAL_LIST_EMPTY(whitelisted_species) // Species that require a whitelist check.
GLOBAL_LIST_EMPTY(playable_species) // A list of ALL playable species, whitelisted, latejoin or otherwise.
GLOBAL_LIST_EMPTY_TYPED(all_languages, /datum/language)
GLOBAL_LIST_INIT(language_name_conflicts, list())

View File

@@ -1016,7 +1016,7 @@ var/datum/announcement/minor/admin_min_announcer = new
set desc="Delay the game start/end"
set name="Delay"
if(!check_rights(R_SERVER|R_EVENT)) return
if(!check_rights(R_SERVER|R_EVENT|R_ADMIN|R_MOD)) return
if (SSticker.current_state >= GAME_STATE_PLAYING)
// Tell the ticker to delay/resume
SSticker.toggle_delay()

View File

@@ -379,7 +379,7 @@ GLOBAL_LIST_EMPTY(pending_discord_registrations)
real_target.dust()
return "Smite [smite_name] sent!"
#define VALID_ACTIONS list("add", "remove", "list")
#define VALID_ACTIONS list("add", "remove", "list", "help")
#define VALID_KINDS list("job", "species")
#define VALID_USAGE "whitelist \[[list2text(VALID_ACTIONS, ", ")]\] \[[list2text(VALID_KINDS, ", ")]\] <ckey> (role)"
/datum/tgs_chat_command/whitelist
@@ -438,7 +438,30 @@ GLOBAL_LIST_EMPTY(pending_discord_registrations)
// Resolve the action
switch(action)
if("help")
var/list/whitelist_jobs = list()
for(var/datum/job/our_job in job_master.occupations)
if(our_job.whitelist_only)
whitelist_jobs += our_job.title
message.text = "The following jobs and species have a whitelist:\nJobs: [english_list(whitelist_jobs)]]\nSpecies: [english_list(GLOB.whitelisted_species)]"
return message
if("add")
if(kind == "job")
var/datum/job/job = job_master.GetJob(role)
if(!job)
message.text = "Error, invalid job entered. Check spelling and capitalization."
return message
if(!job.whitelist_only)
message.text = "Error, job \"[role]\" is not a whitelist job."
return message
if(kind == "species")
if(role in GLOB.playable_species)
message.text = "Error, invalid species entered. Check spelling and capitalization."
return message
if(!(role in GLOB.whitelisted_species))
message.text = "Error, species \"[role]\" is not a whitelist species."
return message
var/datum/db_query/command_add = SSdbcore.NewQuery(
"INSERT INTO [format_table_name("whitelist")] (ckey, kind, entry) VALUES (:ckey, :kind, :entry)",
list("ckey" = ckey, "kind" = kind, "entry" = role)