From 5f899922d2fd8ad04a22832e2da264659e1d9bb0 Mon Sep 17 00:00:00 2001
From: harryob <55142896+harryob@users.noreply.github.com>
Date: Fri, 17 Nov 2023 19:42:02 +0000
Subject: [PATCH 01/27] initial commit
---
code/__DEFINES/mode.dm | 20 +-
code/datums/emergency_calls/clf.dm | 2 +-
code/datums/emergency_calls/cmb.dm | 2 +-
code/datums/emergency_calls/contractor.dm | 4 +-
code/datums/emergency_calls/inspection.dm | 2 +-
code/datums/emergency_calls/pmc.dm | 2 +-
code/datums/emergency_calls/upp.dm | 2 +-
code/datums/emergency_calls/xeno_cultists.dm | 2 +-
code/datums/entities/player.dm | 31 +-
code/game/gamemodes/cm_initialize.dm | 12 +-
code/game/gamemodes/extended/infection.dm | 2 +-
code/game/jobs/job/antag/other/pred.dm | 11 +-
.../jobs/job/civilians/support/synthetic.dm | 8 +-
code/game/jobs/job/command/cic/captain.dm | 8 +-
code/game/jobs/job/job.dm | 7 +-
code/game/jobs/role_authority.dm | 9 +-
code/game/jobs/whitelist.dm | 7 +-
code/game/verbs/records.dm | 12 +-
code/modules/admin/NewBan.dm | 12 +
code/modules/admin/admin_verbs.dm | 12 +-
code/modules/admin/holder2.dm | 1 -
code/modules/admin/tabs/admin_tab.dm | 6 +
code/modules/admin/tabs/debug_tab.dm | 9 -
code/modules/admin/topic/topic.dm | 12 +
code/modules/clans/client.dm | 4 +-
code/modules/client/client_procs.dm | 35 +-
code/modules/client/preferences.dm | 30 +-
code/modules/mob/dead/observer/observer.dm | 9 +-
.../mob/new_player/preferences_setup.dm | 18 +-
maps/map_files/USS_Runtime/USS_Runtime.dmm | 298 ++++++++++++++++++
30 files changed, 465 insertions(+), 124 deletions(-)
diff --git a/code/__DEFINES/mode.dm b/code/__DEFINES/mode.dm
index 854da7a52b4c..895e26094aed 100644
--- a/code/__DEFINES/mode.dm
+++ b/code/__DEFINES/mode.dm
@@ -156,6 +156,7 @@ var/global/list/ROLES_WO = list(JOB_WO_CO, JOB_WO_XO, JOB_WO_CORPORATE_LIAISON,
var/global/list/whitelist_hierarchy = list(WHITELIST_NORMAL, WHITELIST_COUNCIL, WHITELIST_LEADER)
//=================================================
+
#define WHITELIST_YAUTJA (1<<0)
///Old holders of YAUTJA_ELDER
#define WHITELIST_YAUTJA_LEGACY (1<<1)
@@ -186,7 +187,24 @@ var/global/list/whitelist_hierarchy = list(WHITELIST_NORMAL, WHITELIST_COUNCIL,
#define WHITELIST_EVERYTHING (WHITELISTS_GENERAL|WHITELISTS_COUNCIL|WHITELISTS_LEADER)
-#define isCouncil(A) (RoleAuthority.roles_whitelist[A.ckey] & WHITELIST_YAUTJA_COUNCIL) || (RoleAuthority.roles_whitelist[A.ckey] & WHITELIST_SYNTHETIC_COUNCIL) || (RoleAuthority.roles_whitelist[A.ckey] & WHITELIST_COMMANDER_COUNCIL)
+#define isCouncil(A) (A.check_whitelist_status(WHITELISTS_COUNCIL))
+
+DEFINE_BITFIELD(whitelist_status, list(
+ "WHITELIST_YAUTJA" = WHITELIST_YAUTJA,
+ "WHITELIST_YAUTJA_LEGACY" = WHITELIST_YAUTJA_LEGACY,
+ "WHITELIST_YAUTJA_COUNCIL" = WHITELIST_YAUTJA_COUNCIL,
+ "WHITELIST_YAUTJA_COUNCIL_LEGACY" = WHITELIST_YAUTJA_COUNCIL_LEGACY,
+ "WHITELIST_YAUTJA_LEADER" = WHITELIST_YAUTJA_LEADER,
+ "WHITELIST_COMMANDER" = WHITELIST_COMMANDER,
+ "WHITELIST_COMMANDER_COUNCIL" = WHITELIST_COMMANDER_COUNCIL,
+ "WHITELIST_COMMANDER_COUNCIL_LEGACY" = WHITELIST_COMMANDER_COUNCIL_LEGACY,
+ "WHITELIST_JOE" = WHITELIST_JOE,
+ "WHITELIST_SYNTHETIC" = WHITELIST_SYNTHETIC,
+ "WHITELIST_SYNTHETIC_COUNCIL" = WHITELIST_SYNTHETIC_COUNCIL,
+ "WHITELIST_SYNTHETIC_COUNCIL_LEGACY" = WHITELIST_SYNTHETIC_COUNCIL_LEGACY,
+ "WHITELIST_SYNTHETIC_LEADER" = WHITELIST_SYNTHETIC_LEADER,
+ "WHITELIST_MENTOR" = WHITELIST_MENTOR,
+))
//=================================================
diff --git a/code/datums/emergency_calls/clf.dm b/code/datums/emergency_calls/clf.dm
index 0a5f09e2a2f2..a803472fcc74 100644
--- a/code/datums/emergency_calls/clf.dm
+++ b/code/datums/emergency_calls/clf.dm
@@ -45,7 +45,7 @@
leader = H
to_chat(H, SPAN_ROLE_HEADER("You are a Cell Leader of the local resistance group, the Colonial Liberation Front!"))
arm_equipment(H, /datum/equipment_preset/clf/leader, TRUE, TRUE)
- else if(synths < max_synths && HAS_FLAG(H.client.prefs.toggles_ert, PLAY_SYNTH) && RoleAuthority.roles_whitelist[H.ckey] & WHITELIST_SYNTHETIC)
+ else if(synths < max_synths && HAS_FLAG(H.client.prefs.toggles_ert, PLAY_SYNTH) && H.client.check_whitelist_status(WHITELIST_SYNTHETIC))
synths++
to_chat(H, SPAN_ROLE_HEADER("You are a Multi-Purpose Synthetic for the local resistance group, the Colonial Liberation Front!"))
arm_equipment(H, /datum/equipment_preset/clf/synth, TRUE, TRUE)
diff --git a/code/datums/emergency_calls/cmb.dm b/code/datums/emergency_calls/cmb.dm
index a49c0a4ce273..56b8b169b313 100644
--- a/code/datums/emergency_calls/cmb.dm
+++ b/code/datums/emergency_calls/cmb.dm
@@ -35,7 +35,7 @@
leader = mob
to_chat(mob, SPAN_ROLE_HEADER("You are the Colonial Marshal!"))
arm_equipment(mob, /datum/equipment_preset/cmb/leader, TRUE, TRUE)
- else if(synths < max_synths && HAS_FLAG(mob?.client.prefs.toggles_ert, PLAY_SYNTH) && RoleAuthority.roles_whitelist[mob.ckey] & WHITELIST_SYNTHETIC)
+ else if(synths < max_synths && HAS_FLAG(mob?.client.prefs.toggles_ert, PLAY_SYNTH) && mob.client.check_whitelist_status(WHITELIST_SYNTHETIC))
synths++
to_chat(mob, SPAN_ROLE_HEADER("You are a CMB Investigative Synthetic!"))
arm_equipment(mob, /datum/equipment_preset/cmb/synth, TRUE, TRUE)
diff --git a/code/datums/emergency_calls/contractor.dm b/code/datums/emergency_calls/contractor.dm
index a5d6c2d7e80f..1f2ebc8df021 100644
--- a/code/datums/emergency_calls/contractor.dm
+++ b/code/datums/emergency_calls/contractor.dm
@@ -29,7 +29,7 @@
leader = mob
to_chat(mob, SPAN_ROLE_HEADER("You are a Contractor Team Leader of Vanguard's Arrow Incorporated!"))
arm_equipment(mob, /datum/equipment_preset/contractor/duty/leader, TRUE, TRUE)
- else if(synths < max_synths && HAS_FLAG(mob.client.prefs.toggles_ert, PLAY_SYNTH) && RoleAuthority.roles_whitelist[mob.ckey] & WHITELIST_SYNTHETIC)
+ else if(synths < max_synths && HAS_FLAG(mob.client.prefs.toggles_ert, PLAY_SYNTH) && mob.client.check_whitelist_status(WHITELIST_SYNTHETIC))
synths++
to_chat(mob, SPAN_ROLE_HEADER("You are a Contractor Support Synthetic of Vanguard's Arrow Incorporated!"))
arm_equipment(mob, /datum/equipment_preset/contractor/duty/synth, TRUE, TRUE)
@@ -123,7 +123,7 @@
leader = H
to_chat(H, SPAN_ROLE_HEADER("You are a Covert Contractor Team Leader of Vanguard's Arrow Incorporated!"))
arm_equipment(H, /datum/equipment_preset/contractor/covert/leader, TRUE, TRUE)
- else if(synths < max_synths && HAS_FLAG(H.client.prefs.toggles_ert, PLAY_SYNTH) && RoleAuthority.roles_whitelist[H.ckey] & WHITELIST_SYNTHETIC)
+ else if(synths < max_synths && HAS_FLAG(H.client.prefs.toggles_ert, PLAY_SYNTH) && H.client.check_whitelist_status(WHITELIST_SYNTHETIC))
synths++
to_chat(H, SPAN_ROLE_HEADER("You are a Contractor Support Synthetic of Vanguard's Arrow Incorporated!"))
arm_equipment(H, /datum/equipment_preset/contractor/covert/synth, TRUE, TRUE)
diff --git a/code/datums/emergency_calls/inspection.dm b/code/datums/emergency_calls/inspection.dm
index ad0200339952..f0400528ac31 100644
--- a/code/datums/emergency_calls/inspection.dm
+++ b/code/datums/emergency_calls/inspection.dm
@@ -202,7 +202,7 @@
leader = mob
to_chat(mob, SPAN_ROLE_HEADER("You are the Colonial Marshal!"))
arm_equipment(mob, /datum/equipment_preset/cmb/leader, TRUE, TRUE)
- else if(synths < max_synths && HAS_FLAG(mob?.client.prefs.toggles_ert, PLAY_SYNTH) && RoleAuthority.roles_whitelist[mob.ckey] & WHITELIST_SYNTHETIC)
+ else if(synths < max_synths && HAS_FLAG(mob?.client.prefs.toggles_ert, PLAY_SYNTH) && mob.client.check_whitelist_status(WHITELIST_SYNTHETIC))
synths++
to_chat(mob, SPAN_ROLE_HEADER("You are a CMB Investigative Synthetic!"))
arm_equipment(mob, /datum/equipment_preset/cmb/synth, TRUE, TRUE)
diff --git a/code/datums/emergency_calls/pmc.dm b/code/datums/emergency_calls/pmc.dm
index a06b0cc0c02e..7d66911f489d 100644
--- a/code/datums/emergency_calls/pmc.dm
+++ b/code/datums/emergency_calls/pmc.dm
@@ -34,7 +34,7 @@
leader = mob
to_chat(mob, SPAN_ROLE_HEADER("You are a Weyland-Yutani PMC Squad Leader!"))
arm_equipment(mob, /datum/equipment_preset/pmc/pmc_leader, TRUE, TRUE)
- else if(synths < max_synths && HAS_FLAG(mob.client.prefs.toggles_ert, PLAY_SYNTH) && RoleAuthority.roles_whitelist[mob.ckey] & WHITELIST_SYNTHETIC)
+ else if(synths < max_synths && HAS_FLAG(mob.client.prefs.toggles_ert, PLAY_SYNTH) && mob.client.check_whitelist_status(WHITELIST_SYNTHETIC))
synths++
to_chat(mob, SPAN_ROLE_HEADER("You are a Weyland-Yutani PMC Support Synthetic!"))
arm_equipment(mob, /datum/equipment_preset/pmc/synth, TRUE, TRUE)
diff --git a/code/datums/emergency_calls/upp.dm b/code/datums/emergency_calls/upp.dm
index 562dac3fe154..c075c4be25db 100644
--- a/code/datums/emergency_calls/upp.dm
+++ b/code/datums/emergency_calls/upp.dm
@@ -61,7 +61,7 @@
leader = H
arm_equipment(H, /datum/equipment_preset/upp/leader, TRUE, TRUE)
to_chat(H, SPAN_ROLE_HEADER("You are an Officer of the Union of Progressive People, a powerful socialist state that rivals the United Americas!"))
- else if(synths < max_synths && HAS_FLAG(H.client.prefs.toggles_ert, PLAY_SYNTH) && RoleAuthority.roles_whitelist[H.ckey] & WHITELIST_SYNTHETIC)
+ else if(synths < max_synths && HAS_FLAG(H.client.prefs.toggles_ert, PLAY_SYNTH) && H.client.check_whitelist_status(WHITELIST_SYNTHETIC))
synths++
to_chat(H, SPAN_ROLE_HEADER("You are a Combat Synthetic of the Union of Progressive People, a powerful socialist state that rivals the United Americas!"))
arm_equipment(H, /datum/equipment_preset/upp/synth, TRUE, TRUE)
diff --git a/code/datums/emergency_calls/xeno_cultists.dm b/code/datums/emergency_calls/xeno_cultists.dm
index e5ebf089a9c2..f112511b5e22 100644
--- a/code/datums/emergency_calls/xeno_cultists.dm
+++ b/code/datums/emergency_calls/xeno_cultists.dm
@@ -25,7 +25,7 @@
leader = H
to_chat(H, SPAN_ROLE_HEADER("You are the leader of this xeno cult! Bring glory to Queen Mother!"))
arm_equipment(H, /datum/equipment_preset/other/xeno_cultist/leader, TRUE, TRUE)
- else if(synths < max_synths && HAS_FLAG(H.client.prefs.toggles_ert, PLAY_SYNTH) && RoleAuthority.roles_whitelist[H.ckey] & WHITELIST_SYNTHETIC)
+ else if(synths < max_synths && HAS_FLAG(H.client.prefs.toggles_ert, PLAY_SYNTH) && H.client.check_whitelist_status(WHITELIST_SYNTHETIC))
synths++
to_chat(H, SPAN_ROLE_HEADER("You are the xeno cult's synthetic! Tend to the Hive and the captured hosts, make sure the Hive grows!"))
arm_equipment(H, /datum/equipment_preset/synth/survivor/cultist_synth, TRUE, TRUE)
diff --git a/code/datums/entities/player.dm b/code/datums/entities/player.dm
index febeb1fc73a9..bb737eefdec1 100644
--- a/code/datums/entities/player.dm
+++ b/code/datums/entities/player.dm
@@ -5,6 +5,9 @@
var/last_known_ip
var/last_known_cid
+ var/whitelist_status
+ var/whitelist_flags
+
var/discord_link_id
var/last_login
@@ -63,6 +66,7 @@ BSQL_PROTECT_DATUM(/datum/entity/player)
"is_permabanned" = DB_FIELDTYPE_INT,
"permaban_reason" = DB_FIELDTYPE_STRING_MAX,
"permaban_date" = DB_FIELDTYPE_STRING_LARGE,
+ "whitelist_status" = DB_FIELDTYPE_STRING_MAX,
"discord_link_id" = DB_FIELDTYPE_BIGINT,
"permaban_admin_id" = DB_FIELDTYPE_BIGINT,
"is_time_banned" = DB_FIELDTYPE_INT,
@@ -321,20 +325,6 @@ BSQL_PROTECT_DATUM(/datum/entity/player)
value.delete()
job_bans -= value
-/datum/entity/player/proc/load_refs()
- if(refs_loaded)
- return
- while(!notes_loaded || !jobbans_loaded)
- stoplag()
- for(var/key in job_bans)
- var/datum/entity/player_job_ban/value = job_bans[key]
- if(istype(value))
- value.load_refs()
- for(var/datum/entity/player_note/note in notes)
- if(istype(note))
- note.load_refs()
- refs_loaded = TRUE
-
/datum/entity_meta/player/on_read(datum/entity/player/player)
player.job_bans = list()
player.notes = list()
@@ -391,7 +381,12 @@ BSQL_PROTECT_DATUM(/datum/entity/player)
if(discord_link_id)
discord_link = DB_ENTITY(/datum/entity/discord_link, discord_link_id)
+ if(whitelist_status)
+ var/list/whitelists = splittext(whitelist_status, "|")
+ for(var/whitelist in whitelists)
+ if(whitelist in GLOB.bitfields["whitelist_status"])
+ whitelist_flags |= GLOB.bitfields["whitelist_status"]["[whitelist]"]
/datum/entity/player/proc/on_read_notes(list/datum/entity/player_note/_notes)
notes_loaded = TRUE
@@ -657,6 +652,12 @@ BSQL_PROTECT_DATUM(/datum/entity/player)
stat.stat_number += num
stat.save()
+/datum/entity/player/proc/check_whitelist_status(flag_to_check)
+ if(whitelist_flags & flag_to_check)
+ return TRUE
+
+ return FALSE
+
/datum/entity_link/player_to_banning_admin
parent_entity = /datum/entity/player
child_entity = /datum/entity/player
@@ -685,6 +686,7 @@ BSQL_PROTECT_DATUM(/datum/entity/player)
var/last_known_cid
var/last_known_ip
var/discord_link_id
+ var/whitelist_status
/datum/entity_view_meta/players
root_record_type = /datum/entity/player
@@ -702,4 +704,5 @@ BSQL_PROTECT_DATUM(/datum/entity/player)
"last_known_ip",
"last_known_cid",
"discord_link_id",
+ "whitelist_status"
)
diff --git a/code/game/gamemodes/cm_initialize.dm b/code/game/gamemodes/cm_initialize.dm
index effd3325f887..7cb1065acf6c 100644
--- a/code/game/gamemodes/cm_initialize.dm
+++ b/code/game/gamemodes/cm_initialize.dm
@@ -149,7 +149,7 @@ Additional game mode variables.
else
if(!istype(player,/mob/dead)) continue //Otherwise we just want to grab the ghosts.
- if(RoleAuthority.roles_whitelist[player.ckey] & WHITELIST_PREDATOR) //Are they whitelisted?
+ if(player?.client.check_whitelist_status(WHITELIST_PREDATOR)) //Are they whitelisted?
if(!player.client.prefs)
player.client.prefs = new /datum/preferences(player.client) //Somehow they don't have one.
@@ -182,7 +182,7 @@ Additional game mode variables.
if(show_warning) to_chat(pred_candidate, SPAN_WARNING("Something went wrong!"))
return
- if(!(RoleAuthority.roles_whitelist[pred_candidate.ckey] & WHITELIST_PREDATOR))
+ if(!(pred_candidate?.client.check_whitelist_status(WHITELIST_PREDATOR)))
if(show_warning) to_chat(pred_candidate, SPAN_WARNING("You are not whitelisted! You may apply on the forums to be whitelisted as a predator."))
return
@@ -195,9 +195,9 @@ Additional game mode variables.
to_chat(pred_candidate, SPAN_WARNING("You already were a Yautja! Give someone else a chance."))
return
- if(show_warning && tgui_alert(pred_candidate, "Confirm joining the hunt. You will join as \a [lowertext(J.get_whitelist_status(RoleAuthority.roles_whitelist, pred_candidate.client))] predator", "Confirmation", list("Yes", "No"), 10 SECONDS) != "Yes")
+ if(show_warning && tgui_alert(pred_candidate, "Confirm joining the hunt. You will join as \a [lowertext(J.get_whitelist_status(pred_candidate.client))] predator", "Confirmation", list("Yes", "No"), 10 SECONDS) != "Yes")
return
- if(J.get_whitelist_status(RoleAuthority.roles_whitelist, pred_candidate.client) == WHITELIST_NORMAL)
+ if(J.get_whitelist_status(pred_candidate.client) == WHITELIST_NORMAL)
var/pred_max = calculate_pred_max
if(pred_current_num >= pred_max)
if(show_warning) to_chat(pred_candidate, SPAN_WARNING("Only [pred_max] predators may spawn this round, but Councillors and Ancients do not count."))
@@ -960,7 +960,7 @@ Additional game mode variables.
to_chat(joe_candidate, SPAN_WARNING("Something went wrong!"))
return
- if(!(RoleAuthority.roles_whitelist[joe_candidate.ckey] & WHITELIST_JOE))
+ if(!(joe_candidate.client.check_whitelist_status(WHITELIST_JOE)))
if(show_warning)
to_chat(joe_candidate, SPAN_WARNING("You are not whitelisted! You may apply on the forums to be whitelisted as a synth."))
return
@@ -971,7 +971,7 @@ Additional game mode variables.
return
// council doesn't count towards this conditional.
- if(joe_job.get_whitelist_status(RoleAuthority.roles_whitelist, joe_candidate.client) == WHITELIST_NORMAL)
+ if(joe_job.get_whitelist_status(joe_candidate.client) == WHITELIST_NORMAL)
var/joe_max = joe_job.total_positions
if((joe_job.current_positions >= joe_max) && !MODE_HAS_TOGGLEABLE_FLAG(MODE_BYPASS_JOE))
if(show_warning)
diff --git a/code/game/gamemodes/extended/infection.dm b/code/game/gamemodes/extended/infection.dm
index a6b909022aef..983c73857ab4 100644
--- a/code/game/gamemodes/extended/infection.dm
+++ b/code/game/gamemodes/extended/infection.dm
@@ -61,7 +61,7 @@
possible_synth_survivors -= A
continue
- if(RoleAuthority.roles_whitelist[ckey(A.key)] & WHITELIST_SYNTHETIC)
+ if(A.current.client?.check_whitelist_status(WHITELIST_SYNTHETIC))
if(A in possible_survivors)
continue //they are already applying to be a survivor
else
diff --git a/code/game/jobs/job/antag/other/pred.dm b/code/game/jobs/job/antag/other/pred.dm
index a8bcec788c44..9fe174d9a39c 100644
--- a/code/game/jobs/job/antag/other/pred.dm
+++ b/code/game/jobs/job/antag/other/pred.dm
@@ -31,11 +31,7 @@
SSticker.mode.attempt_to_join_as_predator(player)
-/datum/job/antag/predator/get_whitelist_status(list/roles_whitelist, client/player) // Might be a problem waiting here, but we've got no choice
- . = ..()
- if(!.)
- return
-
+/datum/job/antag/predator/get_whitelist_status(client/player) // Might be a problem waiting here, but we've got no choice
if(!player.clan_info)
return CLAN_RANK_BLOODED
@@ -49,10 +45,7 @@
if(!("[JOB_PREDATOR][rank]" in gear_preset_whitelist))
return CLAN_RANK_BLOODED
- if(\
- (roles_whitelist[player.ckey] & (WHITELIST_YAUTJA_LEADER|WHITELIST_YAUTJA_COUNCIL|WHITELIST_YAUTJA_COUNCIL_LEGACY)) &&\
- get_desired_status(player.prefs.yautja_status, WHITELIST_COUNCIL) == WHITELIST_NORMAL\
- )
+ if(player.check_whitelist_status(WHITELIST_YAUTJA_LEADER|WHITELIST_YAUTJA_COUNCIL|WHITELIST_YAUTJA_COUNCIL_LEGACY) && get_desired_status(player.prefs.yautja_status, WHITELIST_COUNCIL) == WHITELIST_NORMAL)
return CLAN_RANK_BLOODED
return rank
diff --git a/code/game/jobs/job/civilians/support/synthetic.dm b/code/game/jobs/job/civilians/support/synthetic.dm
index 70060fb36a15..12e50ef6c809 100644
--- a/code/game/jobs/job/civilians/support/synthetic.dm
+++ b/code/game/jobs/job/civilians/support/synthetic.dm
@@ -19,16 +19,16 @@
"[JOB_SYNTH][WHITELIST_LEADER]" = /datum/equipment_preset/synth/uscm/councillor
)
-/datum/job/civilian/synthetic/get_whitelist_status(list/roles_whitelist, client/player)
+/datum/job/civilian/synthetic/get_whitelist_status(client/player)
. = ..()
if(!.)
return
- if(roles_whitelist[player.ckey] & WHITELIST_SYNTHETIC_LEADER)
+ if(player.check_whitelist_status(WHITELIST_SYNTHETIC_LEADER))
return get_desired_status(player.prefs.synth_status, WHITELIST_LEADER)
- else if(roles_whitelist[player.ckey] & (WHITELIST_SYNTHETIC_COUNCIL|WHITELIST_SYNTHETIC_COUNCIL_LEGACY))
+ if(player.check_whitelist_status(WHITELIST_SYNTHETIC_COUNCIL|WHITELIST_SYNTHETIC_COUNCIL_LEGACY))
return get_desired_status(player.prefs.synth_status, WHITELIST_COUNCIL)
- else if(roles_whitelist[player.ckey] & WHITELIST_SYNTHETIC)
+ if(player.check_whitelist_status(WHITELIST_SYNTHETIC))
return get_desired_status(player.prefs.synth_status, WHITELIST_NORMAL)
/datum/job/civilian/synthetic/set_spawn_positions(count)
diff --git a/code/game/jobs/job/command/cic/captain.dm b/code/game/jobs/job/command/cic/captain.dm
index 72f861351912..9f3f5d06bebd 100644
--- a/code/game/jobs/job/command/cic/captain.dm
+++ b/code/game/jobs/job/command/cic/captain.dm
@@ -19,16 +19,16 @@
entry_message_body = "You are the Commanding Officer of the [MAIN_SHIP_NAME] as well as the operation. Your goal is to lead the Marines on their mission as well as protect and command the ship and her crew. Your job involves heavy roleplay and requires you to behave like a high-ranking officer and to stay in character at all times. As the Commanding Officer your only superior is High Command itself. You must abide by the Commanding Officer Code of Conduct . Failure to do so may result in punitive action against you. Godspeed."
return ..()
-/datum/job/command/commander/get_whitelist_status(list/roles_whitelist, client/player)
+/datum/job/command/commander/get_whitelist_status(client/player)
. = ..()
if(!.)
return
- if(roles_whitelist[player.ckey] & WHITELIST_COMMANDER_LEADER)
+ if(player.check_whitelist_status(WHITELIST_COMMANDER_LEADER))
return get_desired_status(player.prefs.commander_status, WHITELIST_LEADER)
- else if(roles_whitelist[player.ckey] & (WHITELIST_COMMANDER_COUNCIL|WHITELIST_COMMANDER_COUNCIL_LEGACY))
+ if(player.check_whitelist_status(WHITELIST_COMMANDER_COUNCIL|WHITELIST_COMMANDER_COUNCIL_LEGACY))
return get_desired_status(player.prefs.commander_status, WHITELIST_COUNCIL)
- else if(roles_whitelist[player.ckey] & WHITELIST_COMMANDER)
+ if(player.check_whitelist_status(WHITELIST_COMMANDER))
return get_desired_status(player.prefs.commander_status, WHITELIST_NORMAL)
/datum/job/command/commander/announce_entry_message(mob/living/carbon/human/H)
diff --git a/code/game/jobs/job/job.dm b/code/game/jobs/job/job.dm
index 48ad372e1f33..b221d9b88f02 100644
--- a/code/game/jobs/job/job.dm
+++ b/code/game/jobs/job/job.dm
@@ -66,10 +66,7 @@
return ""
return "[CONFIG_GET(string/wikiarticleurl)]/[replacetext(title, " ", "_")]"
-/datum/job/proc/get_whitelist_status(list/roles_whitelist, client/player)
- if(!roles_whitelist)
- return FALSE
-
+/datum/job/proc/get_whitelist_status(client/player)
return WHITELIST_NORMAL
/datum/timelock
@@ -274,7 +271,7 @@
var/mob/living/carbon/human/human = M
var/job_whitelist = title
- var/whitelist_status = get_whitelist_status(RoleAuthority.roles_whitelist, human.client)
+ var/whitelist_status = get_whitelist_status(human.client)
if(whitelist_status)
job_whitelist = "[title][whitelist_status]"
diff --git a/code/game/jobs/role_authority.dm b/code/game/jobs/role_authority.dm
index dc9865f8d6e6..aca8ba7a919d 100644
--- a/code/game/jobs/role_authority.dm
+++ b/code/game/jobs/role_authority.dm
@@ -37,7 +37,6 @@ var/global/players_preassigned = 0
var/list/roles_by_path //Master list generated when role aithority is created, listing every role by path, including variable roles. Great for manually equipping with.
var/list/roles_by_name //Master list generated when role authority is created, listing every default role by name, including those that may not be regularly selected.
var/list/roles_for_mode //Derived list of roles only for the game mode, generated when the round starts.
- var/list/roles_whitelist //Associated list of lists, by ckey. Checks to see if a person is whitelisted for a specific role.
var/list/castes_by_path //Master list generated when role aithority is created, listing every caste by path.
var/list/castes_by_name //Master list generated when role authority is created, listing every default caste by name.
@@ -117,8 +116,9 @@ var/global/players_preassigned = 0
squads += S
squads_by_type[S.type] = S
- load_whitelist()
+/* TODO: delete this
+ load_whitelist()
/datum/authority/branch/role/proc/load_whitelist(filename = "config/role_whitelist.txt")
var/L[] = file2list(filename)
@@ -167,6 +167,7 @@ var/global/players_preassigned = 0
W[ckey] = role
roles_whitelist = W
+*/
//#undef FACTION_TO_JOIN
@@ -413,7 +414,7 @@ I hope it's easier to tell what the heck this proc is even doing, unlike previou
return FALSE
if(!J.can_play_role(M.client))
return FALSE
- if(J.flags_startup_parameters & ROLE_WHITELISTED && !(roles_whitelist[M.ckey] & J.flags_whitelist))
+ if(J.flags_startup_parameters & ROLE_WHITELISTED && !(M.client.check_whitelist_status(J.flags_whitelist)))
return FALSE
if(J.total_positions != -1 && J.get_total_positions(latejoin) <= J.current_positions)
return FALSE
@@ -516,7 +517,7 @@ I hope it's easier to tell what the heck this proc is even doing, unlike previou
new_job.handle_job_options(new_human.client.prefs.pref_special_job_options[new_job.title])
var/job_whitelist = new_job.title
- var/whitelist_status = new_job.get_whitelist_status(roles_whitelist, new_human.client)
+ var/whitelist_status = new_job.get_whitelist_status(new_human.client)
if(whitelist_status)
job_whitelist = "[new_job.title][whitelist_status]"
diff --git a/code/game/jobs/whitelist.dm b/code/game/jobs/whitelist.dm
index 05f530348029..0b21249c012b 100644
--- a/code/game/jobs/whitelist.dm
+++ b/code/game/jobs/whitelist.dm
@@ -42,11 +42,12 @@ GLOBAL_LIST_FILE_LOAD(alien_whitelist, "config/alienwhitelist.txt")
/// returns a list of strings containing the whitelists held by a specific ckey
/proc/get_whitelisted_roles(ckey)
- if(RoleAuthority.roles_whitelist[ckey] & WHITELIST_PREDATOR)
+ var/datum/entity/player/player = get_player_from_key(ckey)
+ if(player.check_whitelist_status(WHITELIST_YAUTJA))
LAZYADD(., "predator")
- if(RoleAuthority.roles_whitelist[ckey] & WHITELIST_COMMANDER)
+ if(player.check_whitelist_status(WHITELIST_COMMANDER))
LAZYADD(., "commander")
- if(RoleAuthority.roles_whitelist[ckey] & WHITELIST_SYNTHETIC)
+ if(player.check_whitelist_status(WHITELIST_SYNTHETIC))
LAZYADD(., "synthetic")
#undef WHITELISTFILE
diff --git a/code/game/verbs/records.dm b/code/game/verbs/records.dm
index 18ed35ee6321..ecf9c7579b6f 100644
--- a/code/game/verbs/records.dm
+++ b/code/game/verbs/records.dm
@@ -97,13 +97,13 @@
return
target = ckey(target)
- if(RoleAuthority.roles_whitelist[src.ckey] & WHITELIST_COMMANDER_COUNCIL)
+ if(check_whitelist_status(WHITELIST_COMMANDER_COUNCIL))
options |= "Commanding Officer"
edit_C = TRUE
- if(RoleAuthority.roles_whitelist[src.ckey] & WHITELIST_SYNTHETIC_COUNCIL)
+ if(check_whitelist_status(WHITELIST_SYNTHETIC_COUNCIL))
options |= "Synthetic"
edit_S = TRUE
- if(RoleAuthority.roles_whitelist[src.ckey] & WHITELIST_YAUTJA_COUNCIL)
+ if(check_whitelist_status(WHITELIST_YAUTJA_COUNCIL))
options |= "Yautja"
edit_Y = TRUE
@@ -116,17 +116,17 @@
if("Merit")
show_other_record(NOTE_MERIT, choice, target, TRUE)
if("Commanding Officer")
- if(MA || (RoleAuthority.roles_whitelist[src.ckey] & WHITELIST_COMMANDER_LEADER))
+ if(MA || check_whitelist_status(WHITELIST_COMMANDER_LEADER))
show_other_record(NOTE_COMMANDER, choice, target, TRUE, TRUE)
else
show_other_record(NOTE_COMMANDER, choice, target, edit_C)
if("Synthetic")
- if(MA || (RoleAuthority.roles_whitelist[src.ckey] & WHITELIST_SYNTHETIC_LEADER))
+ if(MA || check_whitelist_status(WHITELIST_SYNTHETIC_LEADER))
show_other_record(NOTE_SYNTHETIC, choice, target, TRUE, TRUE)
else
show_other_record(NOTE_SYNTHETIC, choice, target, edit_S)
if("Yautja")
- if(MA || (RoleAuthority.roles_whitelist[src.ckey] & WHITELIST_YAUTJA_LEADER))
+ if(MA || check_whitelist_status(WHITELIST_YAUTJA_LEADER))
show_other_record(NOTE_YAUTJA, choice, target, TRUE, TRUE)
else
show_other_record(NOTE_YAUTJA, choice, target, edit_Y)
diff --git a/code/modules/admin/NewBan.dm b/code/modules/admin/NewBan.dm
index b64b1e4682fd..50a92fddb45b 100644
--- a/code/modules/admin/NewBan.dm
+++ b/code/modules/admin/NewBan.dm
@@ -189,6 +189,18 @@ var/savefile/Banlist
dat_header += " - Ban Listing
[dat]"
show_browser(usr, dat_header, "Unban Panel", "unbanp", "size=875x400")
+/datum/admins/proc/whitelist_panel()
+ var/data = "Whitelists: Add Whitelist "
+
+ var/list/datum/view_record/players/players_view = DB_VIEW(/datum/view_record/players, DB_COMP("whitelist_status", DB_NOTEQUAL, ""))
+
+ for(var/datum/view_record/players/whitelistee in players_view)
+ data += " (CHANGE) Key: [whitelistee.ckey] Whitelists: [whitelistee.whitelist_status] "
+
+ data += "
"
+
+ show_browser(usr, data, "Whitelist Panel", "whitelist_panel", "size=857x400")
+
//////////////////////////////////// DEBUG ////////////////////////////////////
/proc/CreateBans()
diff --git a/code/modules/admin/admin_verbs.dm b/code/modules/admin/admin_verbs.dm
index 7d9127313094..b867f5d5c87e 100644
--- a/code/modules/admin/admin_verbs.dm
+++ b/code/modules/admin/admin_verbs.dm
@@ -190,7 +190,6 @@ var/list/admin_verbs_debug = list(
/client/proc/cmd_admin_delete,
/client/proc/cmd_debug_del_all,
/client/proc/reload_admins,
- /client/proc/reload_whitelist,
/client/proc/restart_controller,
/client/proc/debug_controller,
/client/proc/cmd_debug_toggle_should_check_for_win,
@@ -244,7 +243,8 @@ var/list/admin_verbs_possess = list(
)
var/list/admin_verbs_permissions = list(
- /client/proc/ToRban
+ /client/proc/ToRban,
+ /client/proc/whitelist_panel,
)
var/list/admin_verbs_color = list(
@@ -342,15 +342,9 @@ var/list/roundstart_mod_verbs = list(
add_verb(src, admin_verbs_sounds)
if(CLIENT_HAS_RIGHTS(src, R_SPAWN))
add_verb(src, admin_verbs_spawn)
- if(RoleAuthority && (RoleAuthority.roles_whitelist[ckey] & WHITELIST_YAUTJA_LEADER))
+ if(RoleAuthority && check_whitelist_status(WHITELIST_YAUTJA_LEADER))
add_verb(src, clan_verbs)
-/client/proc/add_admin_whitelists()
- if(CLIENT_IS_MENTOR(src))
- RoleAuthority.roles_whitelist[ckey] |= WHITELIST_MENTOR
- if(CLIENT_IS_STAFF(src))
- RoleAuthority.roles_whitelist[ckey] |= WHITELIST_JOE
-
/client/proc/remove_admin_verbs()
remove_verb(src, list(
admin_verbs_default,
diff --git a/code/modules/admin/holder2.dm b/code/modules/admin/holder2.dm
index e7559f3aa4fd..a9e7cc5f8128 100644
--- a/code/modules/admin/holder2.dm
+++ b/code/modules/admin/holder2.dm
@@ -47,7 +47,6 @@ GLOBAL_PROTECT(href_token)
owner = C
owner.admin_holder = src
owner.add_admin_verbs()
- owner.add_admin_whitelists()
owner.tgui_say.load()
owner.update_special_keybinds()
GLOB.admins |= C
diff --git a/code/modules/admin/tabs/admin_tab.dm b/code/modules/admin/tabs/admin_tab.dm
index e0a8c540ea85..4c208356ff15 100644
--- a/code/modules/admin/tabs/admin_tab.dm
+++ b/code/modules/admin/tabs/admin_tab.dm
@@ -53,6 +53,12 @@
admin_holder.unbanpanel()
return
+/client/proc/whitelist_panel()
+ set name = "Whitelist Panel"
+ set category = "Admin.Panels"
+
+ admin_holder?.whitelist_panel()
+
/client/proc/player_panel_new()
set name = "Player Panel"
set category = "Admin.Panels"
diff --git a/code/modules/admin/tabs/debug_tab.dm b/code/modules/admin/tabs/debug_tab.dm
index d8187abe3714..3196819dde1c 100644
--- a/code/modules/admin/tabs/debug_tab.dm
+++ b/code/modules/admin/tabs/debug_tab.dm
@@ -161,15 +161,6 @@
message_admins("[usr.ckey] manually reloaded admins.")
load_admins()
-/client/proc/reload_whitelist()
- set name = "Reload Whitelist"
- set category = "Debug"
- if(alert("Are you sure you want to do this?",, "Yes", "No") != "Yes") return
- if(!check_rights(R_SERVER) || !RoleAuthority) return
-
- message_admins("[usr.ckey] manually reloaded the role whitelist.")
- RoleAuthority.load_whitelist()
-
/client/proc/bulk_fetcher()
set name = "Bulk Fetch Items"
set category = "Debug"
diff --git a/code/modules/admin/topic/topic.dm b/code/modules/admin/topic/topic.dm
index d60377123c49..b6c3f7f0d116 100644
--- a/code/modules/admin/topic/topic.dm
+++ b/code/modules/admin/topic/topic.dm
@@ -39,6 +39,18 @@
show_player_panel(M)
return
+ if(href_list["change_whitelist"])
+ var/target_ckey = href_list["change_whitelist"]
+ if(target_ckey == TRUE)
+ target_ckey = ckey(tgui_input_text(usr, "Which CKEY do you want to edit?", "Select CKEY"))
+
+ if(!target_ckey || target_ckey == TRUE)
+ return
+
+ var/datum/entity/player/player = get_player_from_key(target_ckey)
+
+ var/flags = input_bitfield(usr, "Select Flags", "whitelist_status", player.whitelist_flags)
+
if(href_list["editrights"])
if(!check_rights(R_PERMISSIONS))
message_admins("[key_name_admin(usr)] attempted to edit the admin permissions without sufficient rights.")
diff --git a/code/modules/clans/client.dm b/code/modules/clans/client.dm
index d1f403c08300..b3d5316155d9 100644
--- a/code/modules/clans/client.dm
+++ b/code/modules/clans/client.dm
@@ -5,11 +5,11 @@
set waitfor = FALSE
. = ..()
- if(RoleAuthority && (RoleAuthority.roles_whitelist[ckey] & WHITELIST_PREDATOR))
+ if(RoleAuthority && check_whitelist_status(WHITELIST_PREDATOR))
clan_info = GET_CLAN_PLAYER(player.id)
clan_info.sync()
- if(RoleAuthority.roles_whitelist[ckey] & WHITELIST_YAUTJA_LEADER)
+ if(check_whitelist_status(WHITELIST_YAUTJA_LEADER))
clan_info.clan_rank = clan_ranks_ordered[CLAN_RANK_ADMIN]
clan_info.permissions |= CLAN_PERMISSION_ALL
else
diff --git a/code/modules/client/client_procs.dm b/code/modules/client/client_procs.dm
index 9268cd3aadba..cfd21026502c 100644
--- a/code/modules/client/client_procs.dm
+++ b/code/modules/client/client_procs.dm
@@ -306,12 +306,9 @@ GLOBAL_LIST_INIT(whitelisted_client_procs, list(
player_entity = setup_player_entity(ckey)
- if(!CONFIG_GET(flag/no_localhost_rank))
- var/static/list/localhost_addresses = list("127.0.0.1", "::1")
- if(isnull(address) || (address in localhost_addresses))
- var/datum/admins/admin = new("!localhost!", RL_HOST, ckey)
- admin.associate(src)
- RoleAuthority.roles_whitelist[ckey] = WHITELIST_EVERYTHING
+ if(check_localhost_status())
+ var/datum/admins/admin = new("!localhost!", RL_HOST, ckey)
+ admin.associate(src)
//Admin Authorisation
admin_holder = admin_datums[ckey]
@@ -792,3 +789,29 @@ GLOBAL_LIST_INIT(whitelisted_client_procs, list(
xeno_prefix = "XX"
if(!xeno_postfix || xeno_name_ban)
xeno_postfix = ""
+
+/client/proc/check_whitelist_status(flag_to_check)
+ if(check_localhost_status())
+ return TRUE
+
+ if((flag_to_check & WHITELIST_MENTOR) && CLIENT_IS_MENTOR(src))
+ return TRUE
+
+ if((flag_to_check & WHITELIST_JOE) && CLIENT_IS_STAFF(src))
+ return TRUE
+
+ var/datum/entity/player/player = get_player_from_key(ckey)
+ if(!player)
+ return FALSE
+
+ return player.check_whitelist_status(flag_to_check)
+
+/client/proc/check_localhost_status()
+ if(CONFIG_GET(flag/no_localhost_rank))
+ return FALSE
+
+ var/static/list/localhost_addresses = list("127.0.0.1", "::1")
+ if(isnull(address) || (address in localhost_addresses))
+ return TRUE
+
+ return FALSE
diff --git a/code/modules/client/preferences.dm b/code/modules/client/preferences.dm
index 04b82628e3c6..05c054b4d11b 100644
--- a/code/modules/client/preferences.dm
+++ b/code/modules/client/preferences.dm
@@ -306,13 +306,13 @@ var/const/MAX_SAVE_SLOTS = 10
dat += ""
dat += "Human - "
dat += "Xenomorph - "
- if(RoleAuthority.roles_whitelist[user.ckey] & WHITELIST_COMMANDER)
+ if(owner.check_whitelist_status(WHITELIST_COMMANDER))
dat += "Commanding Officer - "
- if(RoleAuthority.roles_whitelist[user.ckey] & WHITELIST_SYNTHETIC)
+ if(owner.check_whitelist_status(WHITELIST_SYNTHETIC))
dat += "Synthetic - "
- if(RoleAuthority.roles_whitelist[user.ckey] & WHITELIST_PREDATOR)
+ if(owner.check_whitelist_status(WHITELIST_PREDATOR))
dat += "Yautja - "
- if(RoleAuthority.roles_whitelist[user.ckey] & WHITELIST_MENTOR)
+ if(owner.check_whitelist_status(WHITELIST_MENTOR))
dat += "Mentor - "
dat += "Settings - "
dat += "Special Roles "
@@ -482,7 +482,7 @@ var/const/MAX_SAVE_SLOTS = 10
n++
if(MENU_CO)
- if(RoleAuthority.roles_whitelist[user.ckey] & WHITELIST_COMMANDER)
+ if(owner.check_whitelist_status(WHITELIST_COMMANDER))
dat += ""
dat += "
Commander Settings: "
dat += "
Commander Whitelist Status: [commander_status] "
@@ -492,7 +492,7 @@ var/const/MAX_SAVE_SLOTS = 10
else
dat += "
You do not have the whitelist for this role. "
if(MENU_SYNTHETIC)
- if(RoleAuthority.roles_whitelist[user.ckey] & WHITELIST_SYNTHETIC)
+ if(owner.check_whitelist_status(WHITELIST_SYNTHETIC))
dat += "
"
dat += "
Synthetic Settings: "
dat += "
Synthetic Name: [synthetic_name] "
@@ -502,7 +502,7 @@ var/const/MAX_SAVE_SLOTS = 10
else
dat += "
You do not have the whitelist for this role. "
if(MENU_YAUTJA)
- if(RoleAuthority.roles_whitelist[user.ckey] & WHITELIST_PREDATOR)
+ if(owner.check_whitelist_status(WHITELIST_PREDATOR))
dat += "
"
dat += "
Yautja Information: "
dat += "
Yautja Name: [predator_name] "
@@ -516,7 +516,7 @@ var/const/MAX_SAVE_SLOTS = 10
dat += "
"
@@ -682,7 +682,7 @@ var/const/MAX_SAVE_SLOTS = 10
if(jobban_isbanned(user, job.title))
HTML += "
[job.disp_title]BANNED "
continue
- else if(job.flags_startup_parameters & ROLE_WHITELISTED && !(RoleAuthority.roles_whitelist[user.ckey] & job.flags_whitelist))
+ else if(job.flags_startup_parameters & ROLE_WHITELISTED && !user.client.check_whitelist_status(job.flags_whitelist))
HTML += "
[job.disp_title]WHITELISTED "
continue
else if(!job.can_play_role(user.client))
@@ -794,7 +794,7 @@ var/const/MAX_SAVE_SLOTS = 10
if(jobban_isbanned(user, job.title))
HTML += "
[job.disp_title]BANNED "
continue
- else if(job.flags_startup_parameters & ROLE_WHITELISTED && !(RoleAuthority.roles_whitelist[user.ckey] & job.flags_whitelist))
+ else if(job.flags_startup_parameters & ROLE_WHITELISTED && !user.client.check_whitelist_status(job.flags_whitelist))
HTML += "
[job.disp_title]WHITELISTED "
continue
else if(!job.can_play_role(user.client))
@@ -960,7 +960,9 @@ var/const/MAX_SAVE_SLOTS = 10
pref_job_slots[J.title] = JOB_SLOT_CURRENT_SLOT
/datum/preferences/proc/process_link(mob/user, list/href_list)
- var/whitelist_flags = RoleAuthority.roles_whitelist[user.ckey]
+ var/datum/entity/player/player = get_player_from_key(user.ckey)
+
+ var/whitelist_flags = player.whitelist_flags
switch(href_list["preference"])
if("job")
@@ -1284,7 +1286,7 @@ var/const/MAX_SAVE_SLOTS = 10
predator_caster_material = new_pred_caster_mat
if("pred_cape_type")
var/datum/job/J = RoleAuthority.roles_by_name[JOB_PREDATOR]
- var/whitelist_status = clan_ranks_ordered[J.get_whitelist_status(RoleAuthority.roles_whitelist, owner)]
+ var/whitelist_status = clan_ranks_ordered[J.get_whitelist_status(owner)]
var/list/options = list("None" = "None")
for(var/cape_name in GLOB.all_yautja_capes)
diff --git a/code/modules/mob/dead/observer/observer.dm b/code/modules/mob/dead/observer/observer.dm
index da0560e151e9..45f40f789b76 100644
--- a/code/modules/mob/dead/observer/observer.dm
+++ b/code/modules/mob/dead/observer/observer.dm
@@ -135,8 +135,6 @@
var/datum/action/observer_action/new_action = new path()
new_action.give_to(src)
- RegisterSignal(SSdcs, COMSIG_GLOB_PREDATOR_ROUND_TOGGLED, PROC_REF(toggle_predator_action))
-
if(SSticker.mode && SSticker.mode.flags_round_type & MODE_PREDATOR)
addtimer(CALLBACK(GLOBAL_PROC, GLOBAL_PROC_REF(to_chat), src, "
This is a PREDATOR ROUND ! If you are whitelisted, you may Join the Hunt! "), 2 SECONDS)
@@ -319,7 +317,9 @@
/mob/dead/observer/Login()
..()
- toggle_predator_action()
+ if(client.check_whitelist_status(WHITELIST_PREDATOR))
+ RegisterSignal(SSdcs, COMSIG_GLOB_PREDATOR_ROUND_TOGGLED, PROC_REF(toggle_predator_action))
+ toggle_predator_action()
client.move_delay = MINIMAL_MOVEMENT_INTERVAL
@@ -1259,9 +1259,6 @@ This is the proc mobs get to turn into a ghost. Forked from ghostize due to comp
if(!key_to_use)
return
- if(!(RoleAuthority.roles_whitelist[key_to_use] & WHITELIST_PREDATOR))
- return
-
if(!SSticker.mode)
SSticker.OnRoundstart(CALLBACK(src, PROC_REF(toggle_predator_action)))
return
diff --git a/code/modules/mob/new_player/preferences_setup.dm b/code/modules/mob/new_player/preferences_setup.dm
index fb4dbac3c160..60418faa4eb6 100644
--- a/code/modules/mob/new_player/preferences_setup.dm
+++ b/code/modules/mob/new_player/preferences_setup.dm
@@ -237,10 +237,8 @@
if(JOB_SQUAD_TEAM_LEADER)
return /datum/equipment_preset/uscm/tl_equipped
if(JOB_CO)
- if(length(RoleAuthority.roles_whitelist))
- var/datum/job/J = RoleAuthority.roles_by_name[JOB_CO]
- return J.gear_preset_whitelist["[JOB_CO][J.get_whitelist_status(RoleAuthority.roles_whitelist, owner)]"]
- return /datum/equipment_preset/uscm_ship/commander
+ var/datum/job/J = RoleAuthority.roles_by_name[JOB_CO]
+ return J.gear_preset_whitelist["[JOB_CO][J.get_whitelist_status(owner)]"]
if(JOB_SO)
return /datum/equipment_preset/uscm_ship/so
if(JOB_XO)
@@ -258,10 +256,8 @@
if(JOB_COMBAT_REPORTER)
return /datum/equipment_preset/uscm_ship/reporter
if(JOB_SYNTH)
- if(length(RoleAuthority.roles_whitelist))
- var/datum/job/J = RoleAuthority.roles_by_name[JOB_SYNTH]
- return J.gear_preset_whitelist["[JOB_SYNTH][J.get_whitelist_status(RoleAuthority.roles_whitelist, owner)]"]
- return /datum/equipment_preset/synth/uscm
+ var/datum/job/J = RoleAuthority.roles_by_name[JOB_SYNTH]
+ return J.gear_preset_whitelist["[JOB_SYNTH][J.get_whitelist_status(owner)]"]
if(JOB_WORKING_JOE)
return /datum/equipment_preset/synth/working_joe
if(JOB_POLICE)
@@ -307,10 +303,8 @@
return pick(SSmapping.configs[GROUND_MAP].CO_survivor_types)
return /datum/equipment_preset/uscm_ship/commander
if(JOB_PREDATOR)
- if(length(RoleAuthority.roles_whitelist))
- var/datum/job/J = RoleAuthority.roles_by_name[JOB_PREDATOR]
- return J.gear_preset_whitelist["[JOB_PREDATOR][J.get_whitelist_status(RoleAuthority.roles_whitelist, owner)]"]
- return /datum/equipment_preset/yautja/blooded
+ var/datum/job/J = RoleAuthority.roles_by_name[JOB_PREDATOR]
+ return J.gear_preset_whitelist["[JOB_PREDATOR][J.get_whitelist_status(owner)]"]
return /datum/equipment_preset/uscm/private_equipped
diff --git a/maps/map_files/USS_Runtime/USS_Runtime.dmm b/maps/map_files/USS_Runtime/USS_Runtime.dmm
index aec89c5882dd..ccd5bbca9cc3 100644
--- a/maps/map_files/USS_Runtime/USS_Runtime.dmm
+++ b/maps/map_files/USS_Runtime/USS_Runtime.dmm
@@ -25,6 +25,12 @@
icon_state = "plating"
},
/area/event)
+"f" = (
+/turf/closed/wall/almayer,
+/area/almayer/command/cic)
+"g" = (
+/turf/open/space/basic,
+/area/space)
"h" = (
/obj/effect/landmark/start/police,
/turf/open/floor/almayer{
@@ -115,6 +121,9 @@
icon_state = "plating"
},
/area/event)
+"E" = (
+/turf/open/floor,
+/area/almayer/command/cic)
"F" = (
/obj/effect/landmark/start/marine/tl,
/turf/open/floor/almayer{
@@ -482,3 +491,292 @@ a
a
a
"}
+
+(1,1,2) = {"
+g
+g
+g
+g
+g
+g
+g
+g
+g
+g
+g
+g
+g
+g
+g
+g
+"}
+(2,1,2) = {"
+f
+f
+f
+f
+f
+f
+f
+f
+f
+f
+f
+f
+f
+f
+g
+g
+"}
+(3,1,2) = {"
+f
+E
+E
+E
+E
+E
+E
+E
+E
+E
+E
+E
+E
+f
+g
+g
+"}
+(4,1,2) = {"
+f
+E
+E
+E
+E
+E
+E
+E
+E
+E
+E
+E
+E
+f
+g
+g
+"}
+(5,1,2) = {"
+f
+E
+E
+E
+E
+E
+E
+E
+E
+E
+E
+E
+E
+f
+g
+g
+"}
+(6,1,2) = {"
+f
+E
+E
+E
+E
+E
+E
+E
+E
+E
+E
+E
+E
+f
+g
+g
+"}
+(7,1,2) = {"
+f
+E
+E
+E
+E
+E
+E
+E
+E
+E
+E
+E
+E
+f
+g
+g
+"}
+(8,1,2) = {"
+f
+E
+E
+E
+E
+E
+E
+E
+E
+E
+E
+E
+E
+f
+g
+g
+"}
+(9,1,2) = {"
+f
+E
+E
+E
+E
+E
+E
+E
+E
+E
+E
+E
+E
+f
+g
+g
+"}
+(10,1,2) = {"
+f
+E
+E
+E
+E
+E
+E
+E
+E
+E
+E
+E
+E
+f
+g
+g
+"}
+(11,1,2) = {"
+f
+E
+E
+E
+E
+E
+E
+E
+E
+E
+E
+E
+E
+f
+g
+g
+"}
+(12,1,2) = {"
+f
+E
+E
+E
+E
+E
+E
+E
+E
+E
+E
+E
+E
+f
+g
+g
+"}
+(13,1,2) = {"
+f
+E
+E
+E
+E
+E
+E
+E
+E
+E
+E
+E
+E
+f
+g
+g
+"}
+(14,1,2) = {"
+f
+E
+E
+E
+E
+E
+E
+E
+E
+E
+E
+E
+E
+f
+g
+g
+"}
+(15,1,2) = {"
+f
+f
+f
+f
+f
+f
+f
+f
+f
+f
+f
+f
+f
+f
+g
+g
+"}
+(16,1,2) = {"
+g
+g
+g
+g
+g
+g
+g
+g
+g
+g
+g
+g
+g
+g
+g
+g
+"}
From 66ad03b8d7a672a20d6ec5fbf05773b580fc41cd Mon Sep 17 00:00:00 2001
From: harryob
Date: Sat, 25 Nov 2023 10:48:24 +0000
Subject: [PATCH 02/27] whitelist panel and changes
---
code/__DEFINES/mode.dm | 6 ++++++
code/datums/entities/player.dm | 11 ++++++++++
code/game/jobs/whitelist.dm | 21 +++++++++++++++++++
code/modules/admin/NewBan.dm | 12 -----------
code/modules/admin/admin_verbs.dm | 2 +-
code/modules/admin/tabs/admin_tab.dm | 6 ------
code/modules/admin/topic/topic.dm | 12 -----------
code/modules/client/client_procs.dm | 31 ++++++++++++++++++++++++----
code/modules/client/preferences.dm | 5 +++--
9 files changed, 69 insertions(+), 37 deletions(-)
diff --git a/code/__DEFINES/mode.dm b/code/__DEFINES/mode.dm
index 895e26094aed..02a6d459c305 100644
--- a/code/__DEFINES/mode.dm
+++ b/code/__DEFINES/mode.dm
@@ -189,6 +189,12 @@ var/global/list/whitelist_hierarchy = list(WHITELIST_NORMAL, WHITELIST_COUNCIL,
#define isCouncil(A) (A.check_whitelist_status(WHITELISTS_COUNCIL))
+GLOBAL_LIST_INIT_TYPED(whitelist_permissions, /list, list(
+ WHITELIST_SYNTHETIC_LEADER = list(WHITELIST_SYNTHETIC_COUNCIL, WHITELIST_SYNTHETIC_COUNCIL_LEGACY, WHITELIST_SYNTHETIC),
+ WHITELIST_YAUTJA_LEADER = list(WHITELIST_YAUTJA_COUNCIL, WHITELIST_YAUTJA_COUNCIL_LEGACY, WHITELIST_YAUTJA),
+ WHITELIST_COMMANDER_LEADER = list(WHITELIST_COMMANDER_COUNCIL, WHITELIST_COMMANDER_COUNCIL_LEGACY, WHITELIST_COMMANDER),
+ ))
+
DEFINE_BITFIELD(whitelist_status, list(
"WHITELIST_YAUTJA" = WHITELIST_YAUTJA,
"WHITELIST_YAUTJA_LEGACY" = WHITELIST_YAUTJA_LEGACY,
diff --git a/code/datums/entities/player.dm b/code/datums/entities/player.dm
index bb737eefdec1..99967d8e8103 100644
--- a/code/datums/entities/player.dm
+++ b/code/datums/entities/player.dm
@@ -658,6 +658,17 @@ BSQL_PROTECT_DATUM(/datum/entity/player)
return FALSE
+/datum/entity/player/proc/set_whitelist_status(field_to_set)
+ whitelist_flags = field_to_set
+
+ var/list/output = list()
+ for(var/bitfield in GLOB.bitfields["whitelist_status"])
+ if(field_to_set & GLOB.bitfields["whitelist_status"]["[bitfield]"])
+ output += bitfield
+ whitelist_status = output.Join("|")
+
+ save()
+
/datum/entity_link/player_to_banning_admin
parent_entity = /datum/entity/player
child_entity = /datum/entity/player
diff --git a/code/game/jobs/whitelist.dm b/code/game/jobs/whitelist.dm
index 0b21249c012b..1aee5c7f7648 100644
--- a/code/game/jobs/whitelist.dm
+++ b/code/game/jobs/whitelist.dm
@@ -50,4 +50,25 @@ GLOBAL_LIST_FILE_LOAD(alien_whitelist, "config/alienwhitelist.txt")
if(player.check_whitelist_status(WHITELIST_SYNTHETIC))
LAZYADD(., "synthetic")
+/client/proc/whitelist_panel()
+ set name = "Whitelist Panel"
+ set category = "Admin.Panels"
+
+ var/data = "Whitelists: Add Whitelist "
+
+ var/list/datum/view_record/players/players_view = DB_VIEW(/datum/view_record/players, DB_COMP("whitelist_status", DB_NOTEQUAL, ""))
+
+ for(var/datum/view_record/players/whitelistee in players_view)
+ data += " (CHANGE) Key: [whitelistee.ckey] Whitelists: [whitelistee.whitelist_status] "
+
+ data += "
"
+
+ show_browser(usr, data, "Whitelist Panel", "whitelist_panel", "size=857x400")
+
+/client/load_player_data_info(datum/entity/player/player)
+ . = ..()
+
+ if(WHITELISTS_LEADER & player.whitelist_flags)
+ add_verb(src, /client/proc/whitelist_panel)
+
#undef WHITELISTFILE
diff --git a/code/modules/admin/NewBan.dm b/code/modules/admin/NewBan.dm
index 50a92fddb45b..b64b1e4682fd 100644
--- a/code/modules/admin/NewBan.dm
+++ b/code/modules/admin/NewBan.dm
@@ -189,18 +189,6 @@ var/savefile/Banlist
dat_header += " - Ban Listing [dat]"
show_browser(usr, dat_header, "Unban Panel", "unbanp", "size=875x400")
-/datum/admins/proc/whitelist_panel()
- var/data = "Whitelists: Add Whitelist "
-
- var/list/datum/view_record/players/players_view = DB_VIEW(/datum/view_record/players, DB_COMP("whitelist_status", DB_NOTEQUAL, ""))
-
- for(var/datum/view_record/players/whitelistee in players_view)
- data += " (CHANGE) Key: [whitelistee.ckey] Whitelists: [whitelistee.whitelist_status] "
-
- data += "
"
-
- show_browser(usr, data, "Whitelist Panel", "whitelist_panel", "size=857x400")
-
//////////////////////////////////// DEBUG ////////////////////////////////////
/proc/CreateBans()
diff --git a/code/modules/admin/admin_verbs.dm b/code/modules/admin/admin_verbs.dm
index b867f5d5c87e..d79ab0610c42 100644
--- a/code/modules/admin/admin_verbs.dm
+++ b/code/modules/admin/admin_verbs.dm
@@ -342,7 +342,7 @@ var/list/roundstart_mod_verbs = list(
add_verb(src, admin_verbs_sounds)
if(CLIENT_HAS_RIGHTS(src, R_SPAWN))
add_verb(src, admin_verbs_spawn)
- if(RoleAuthority && check_whitelist_status(WHITELIST_YAUTJA_LEADER))
+ if(check_whitelist_status(WHITELIST_YAUTJA_LEADER))
add_verb(src, clan_verbs)
/client/proc/remove_admin_verbs()
diff --git a/code/modules/admin/tabs/admin_tab.dm b/code/modules/admin/tabs/admin_tab.dm
index 4c208356ff15..e0a8c540ea85 100644
--- a/code/modules/admin/tabs/admin_tab.dm
+++ b/code/modules/admin/tabs/admin_tab.dm
@@ -53,12 +53,6 @@
admin_holder.unbanpanel()
return
-/client/proc/whitelist_panel()
- set name = "Whitelist Panel"
- set category = "Admin.Panels"
-
- admin_holder?.whitelist_panel()
-
/client/proc/player_panel_new()
set name = "Player Panel"
set category = "Admin.Panels"
diff --git a/code/modules/admin/topic/topic.dm b/code/modules/admin/topic/topic.dm
index b6c3f7f0d116..d60377123c49 100644
--- a/code/modules/admin/topic/topic.dm
+++ b/code/modules/admin/topic/topic.dm
@@ -39,18 +39,6 @@
show_player_panel(M)
return
- if(href_list["change_whitelist"])
- var/target_ckey = href_list["change_whitelist"]
- if(target_ckey == TRUE)
- target_ckey = ckey(tgui_input_text(usr, "Which CKEY do you want to edit?", "Select CKEY"))
-
- if(!target_ckey || target_ckey == TRUE)
- return
-
- var/datum/entity/player/player = get_player_from_key(target_ckey)
-
- var/flags = input_bitfield(usr, "Select Flags", "whitelist_status", player.whitelist_flags)
-
if(href_list["editrights"])
if(!check_rights(R_PERMISSIONS))
message_admins("[key_name_admin(usr)] attempted to edit the admin permissions without sufficient rights.")
diff --git a/code/modules/client/client_procs.dm b/code/modules/client/client_procs.dm
index cfd21026502c..f78c601604d8 100644
--- a/code/modules/client/client_procs.dm
+++ b/code/modules/client/client_procs.dm
@@ -208,6 +208,28 @@ GLOBAL_LIST_INIT(whitelisted_client_procs, list(
var/datum/entity/player/P = get_player_from_key(key)
P.remove_note(index)
+ if(href_list["change_whitelist"])
+ if(!CLIENT_HAS_RIGHTS(src, R_PERMISSIONS) && !check_whitelist_status(WHITELISTS_LEADER))
+ return
+
+ var/target_ckey = href_list["change_whitelist"]
+ if(target_ckey == "[TRUE]")
+ target_ckey = ckey(tgui_input_text(usr, "Which CKEY do you want to edit?", "Select CKEY"))
+
+ if(!target_ckey || target_ckey == TRUE)
+ return
+
+ var/datum/entity/player/player = get_player_from_key(ckey)
+ var/can_edit = list()
+ for(var/bitfield in GLOB.whitelist_permissions)
+ if(player.whitelist_flags & bitfield)
+ can_edit += GLOB.whitelist_permissions[bitfield]
+ if(!length(can_edit))
+ can_edit = null
+
+ var/flags = input_bitfield(usr, "Select Flags", "whitelist_status", player.whitelist_flags, allowed_edit_list = can_edit)
+ player.set_whitelist_status(flags)
+
switch(href_list["_src_"])
if("admin_holder")
hsrc = admin_holder
@@ -800,16 +822,17 @@ GLOBAL_LIST_INIT(whitelisted_client_procs, list(
if((flag_to_check & WHITELIST_JOE) && CLIENT_IS_STAFF(src))
return TRUE
- var/datum/entity/player/player = get_player_from_key(ckey)
- if(!player)
- return FALSE
+ if(!player_data)
+ load_player_data()
- return player.check_whitelist_status(flag_to_check)
+ return player_data.check_whitelist_status(flag_to_check)
/client/proc/check_localhost_status()
if(CONFIG_GET(flag/no_localhost_rank))
return FALSE
+ deadmin()
+
var/static/list/localhost_addresses = list("127.0.0.1", "::1")
if(isnull(address) || (address in localhost_addresses))
return TRUE
diff --git a/code/modules/client/preferences.dm b/code/modules/client/preferences.dm
index 05c054b4d11b..e55696baad29 100644
--- a/code/modules/client/preferences.dm
+++ b/code/modules/client/preferences.dm
@@ -960,9 +960,7 @@ var/const/MAX_SAVE_SLOTS = 10
pref_job_slots[J.title] = JOB_SLOT_CURRENT_SLOT
/datum/preferences/proc/process_link(mob/user, list/href_list)
- var/datum/entity/player/player = get_player_from_key(user.ckey)
- var/whitelist_flags = player.whitelist_flags
switch(href_list["preference"])
if("job")
@@ -1198,6 +1196,9 @@ var/const/MAX_SAVE_SLOTS = 10
if ("all")
randomize_appearance()
if("input")
+ var/datum/entity/player/player = get_player_from_key(user.ckey)
+ var/whitelist_flags = player.whitelist_flags
+
switch(href_list["preference"])
if("name")
if(human_name_ban)
From 6fd3603531691ad2506c10bd0cbe4dd7fed01736 Mon Sep 17 00:00:00 2001
From: forest2001
Date: Sun, 7 Jan 2024 18:58:10 +0000
Subject: [PATCH 03/27] fixes
more
more
almost
Final fix
---
code/modules/admin/admin_verbs.dm | 8 ++--
code/modules/clans/client.dm | 4 +-
code/modules/client/client_procs.dm | 47 +++++++++++++++++++
code/modules/client/preferences.dm | 4 +-
.../mob/new_player/preferences_setup.dm | 6 +--
5 files changed, 58 insertions(+), 11 deletions(-)
diff --git a/code/modules/admin/admin_verbs.dm b/code/modules/admin/admin_verbs.dm
index 56d7567a736f..c95cf55b1d3b 100644
--- a/code/modules/admin/admin_verbs.dm
+++ b/code/modules/admin/admin_verbs.dm
@@ -241,10 +241,10 @@ GLOBAL_LIST_INIT(admin_verbs_possess, list(
/client/proc/release
))
-var/list/admin_verbs_permissions = list(
+GLOBAL_LIST_INIT(admin_verbs_permissions, list(
/client/proc/ToRban,
/client/proc/whitelist_panel,
-)
+))
GLOBAL_LIST_INIT(admin_verbs_color, list(
/client/proc/set_ooc_color_self
@@ -344,9 +344,9 @@ GLOBAL_LIST_INIT(roundstart_mod_verbs, list(
if(CLIENT_HAS_RIGHTS(src, R_SOUNDS))
add_verb(src, GLOB.admin_verbs_sounds)
if(CLIENT_HAS_RIGHTS(src, R_SPAWN))
- add_verb(src, admin_verbs_spawn)
+ add_verb(src, GLOB.admin_verbs_spawn)
if(check_whitelist_status(WHITELIST_YAUTJA_LEADER))
- add_verb(src, clan_verbs)
+ add_verb(src, GLOB.clan_verbs)
/client/proc/remove_admin_verbs()
remove_verb(src, list(
diff --git a/code/modules/clans/client.dm b/code/modules/clans/client.dm
index 31e0e597cac6..c4948b2a6923 100644
--- a/code/modules/clans/client.dm
+++ b/code/modules/clans/client.dm
@@ -5,12 +5,12 @@
set waitfor = FALSE
. = ..()
- if(RoleAuthority && check_whitelist_status(WHITELIST_PREDATOR))
+ if(GLOB.RoleAuthority && check_whitelist_status(WHITELIST_PREDATOR))
clan_info = GET_CLAN_PLAYER(player.id)
clan_info.sync()
if(check_whitelist_status(WHITELIST_YAUTJA_LEADER))
- clan_info.clan_rank = clan_ranks_ordered[CLAN_RANK_ADMIN]
+ clan_info.clan_rank = GLOB.clan_ranks_ordered[CLAN_RANK_ADMIN]
clan_info.permissions |= CLAN_PERMISSION_ALL
else
clan_info.permissions &= ~CLAN_PERMISSION_ADMIN_MANAGER // Only the leader can manage the ancients
diff --git a/code/modules/client/client_procs.dm b/code/modules/client/client_procs.dm
index 5de219d6acf7..8d79d0e9c0b5 100644
--- a/code/modules/client/client_procs.dm
+++ b/code/modules/client/client_procs.dm
@@ -822,6 +822,53 @@ GLOBAL_LIST_INIT(whitelisted_client_procs, list(
if(!xeno_postfix || xeno_name_ban)
xeno_postfix = ""
+/// playtime for all castes
+/client/proc/get_total_xeno_playtime(skip_cache = FALSE)
+ if(cached_xeno_playtime && !skip_cache)
+ return cached_xeno_playtime
+
+ var/total_xeno_playtime = 0
+
+ for(var/caste in GLOB.RoleAuthority.castes_by_name)
+ total_xeno_playtime += get_job_playtime(src, caste)
+
+ total_xeno_playtime += get_job_playtime(src, JOB_XENOMORPH)
+
+ if(player_entity)
+ var/past_xeno_playtime = player_entity.get_playtime(STATISTIC_XENO)
+ if(past_xeno_playtime)
+ total_xeno_playtime += past_xeno_playtime
+
+
+ cached_xeno_playtime = total_xeno_playtime
+
+ return total_xeno_playtime
+
+/// playtime for drone and drone evolution castes
+/client/proc/get_total_drone_playtime()
+ var/total_drone_playtime = 0
+
+ var/list/drone_evo_castes = list(XENO_CASTE_DRONE, XENO_CASTE_CARRIER, XENO_CASTE_BURROWER, XENO_CASTE_HIVELORD, XENO_CASTE_QUEEN)
+
+ for(var/caste in GLOB.RoleAuthority.castes_by_name)
+ if(!(caste in drone_evo_castes))
+ continue
+ total_drone_playtime += get_job_playtime(src, caste)
+
+ return total_drone_playtime
+
+/// playtime for t3 castes and queen
+/client/proc/get_total_t3_playtime()
+ var/total_t3_playtime = 0
+ var/datum/caste_datum/caste
+ for(var/caste_name in GLOB.RoleAuthority.castes_by_name)
+ caste = GLOB.RoleAuthority.castes_by_name[caste_name]
+ if(caste.tier < 3)
+ continue
+ total_t3_playtime += get_job_playtime(src, caste_name)
+
+ return total_t3_playtime
+
/client/proc/check_whitelist_status(flag_to_check)
if(check_localhost_status())
return TRUE
diff --git a/code/modules/client/preferences.dm b/code/modules/client/preferences.dm
index e74d6b7a6589..f9b0960ff6fd 100644
--- a/code/modules/client/preferences.dm
+++ b/code/modules/client/preferences.dm
@@ -1288,8 +1288,8 @@ GLOBAL_LIST_INIT(bgstate_options, list(
return
predator_caster_material = new_pred_caster_mat
if("pred_cape_type")
- var/datum/job/J = RoleAuthority.roles_by_name[JOB_PREDATOR]
- var/whitelist_status = clan_ranks_ordered[J.get_whitelist_status(owner)]
+ var/datum/job/J = GLOB.RoleAuthority.roles_by_name[JOB_PREDATOR]
+ var/whitelist_status = GLOB.clan_ranks_ordered[J.get_whitelist_status(owner)]
var/list/options = list("None" = "None")
for(var/cape_name in GLOB.all_yautja_capes)
diff --git a/code/modules/mob/new_player/preferences_setup.dm b/code/modules/mob/new_player/preferences_setup.dm
index 477ea7e2f351..7e8439cee244 100644
--- a/code/modules/mob/new_player/preferences_setup.dm
+++ b/code/modules/mob/new_player/preferences_setup.dm
@@ -247,7 +247,7 @@
if(JOB_SQUAD_TEAM_LEADER)
return /datum/equipment_preset/uscm/tl_equipped
if(JOB_CO)
- var/datum/job/J = RoleAuthority.roles_by_name[JOB_CO]
+ var/datum/job/J = GLOB.RoleAuthority.roles_by_name[JOB_CO]
return J.gear_preset_whitelist["[JOB_CO][J.get_whitelist_status(owner)]"]
if(JOB_SO)
return /datum/equipment_preset/uscm_ship/so
@@ -266,7 +266,7 @@
if(JOB_COMBAT_REPORTER)
return /datum/equipment_preset/uscm_ship/reporter
if(JOB_SYNTH)
- var/datum/job/J = RoleAuthority.roles_by_name[JOB_SYNTH]
+ var/datum/job/J = GLOB.RoleAuthority.roles_by_name[JOB_SYNTH]
return J.gear_preset_whitelist["[JOB_SYNTH][J.get_whitelist_status(owner)]"]
if(JOB_WORKING_JOE)
return /datum/equipment_preset/synth/working_joe
@@ -313,7 +313,7 @@
return pick(SSmapping.configs[GROUND_MAP].CO_survivor_types)
return /datum/equipment_preset/uscm_ship/commander
if(JOB_PREDATOR)
- var/datum/job/J = RoleAuthority.roles_by_name[JOB_PREDATOR]
+ var/datum/job/J = GLOB.RoleAuthority.roles_by_name[JOB_PREDATOR]
return J.gear_preset_whitelist["[JOB_PREDATOR][J.get_whitelist_status(owner)]"]
return /datum/equipment_preset/uscm/private_equipped
From ff81084ad73ade04556a8ce398a6224e78af6782 Mon Sep 17 00:00:00 2001
From: forest2001
Date: Sun, 7 Jan 2024 18:58:22 +0000
Subject: [PATCH 04/27] Nuke Alien Whitelist
---
code/game/jobs/whitelist.dm | 22 -----------
code/modules/admin/topic/topic.dm | 7 +---
code/modules/mob/new_player/new_player.dm | 48 -----------------------
3 files changed, 1 insertion(+), 76 deletions(-)
diff --git a/code/game/jobs/whitelist.dm b/code/game/jobs/whitelist.dm
index 7c5623d6cc57..02aa4f5b967e 100644
--- a/code/game/jobs/whitelist.dm
+++ b/code/game/jobs/whitelist.dm
@@ -18,28 +18,6 @@ GLOBAL_LIST_FILE_LOAD(whitelist, WHITELISTFILE)
return J.can_play_role(client)
return TRUE
-GLOBAL_LIST_FILE_LOAD(alien_whitelist, "config/alienwhitelist.txt")
-
-//todo: admin aliens
-/proc/is_alien_whitelisted(mob/M, species)
- if(!CONFIG_GET(flag/usealienwhitelist)) //If there's not config to use the whitelist.
- return 1
- if(species == "human" || species == "Human")
- return 1
-// if(check_rights(R_ADMIN, 0)) //Admins are not automatically considered to be whitelisted anymore. ~N
-// return 1 //This actually screwed up a bunch of procs, but I only noticed it with the wrong spawn point.
- if(!CONFIG_GET(flag/usealienwhitelist) || !GLOB.alien_whitelist)
- return 0
- if(M && species)
- for (var/s in GLOB.alien_whitelist)
- if(findtext(lowertext(s),"[lowertext(M.key)] - [species]"))
- return 1
- //if(findtext(lowertext(s),"[lowertext(M.key)] - [species] Elder")) //Unnecessary.
- // return 1
- if(findtext(lowertext(s),"[lowertext(M.key)] - All"))
- return 1
- return 0
-
/// returns a list of strings containing the whitelists held by a specific ckey
/proc/get_whitelisted_roles(ckey)
var/datum/entity/player/player = get_player_from_key(ckey)
diff --git a/code/modules/admin/topic/topic.dm b/code/modules/admin/topic/topic.dm
index fa814ca16b7c..915364458b98 100644
--- a/code/modules/admin/topic/topic.dm
+++ b/code/modules/admin/topic/topic.dm
@@ -917,12 +917,7 @@
qdel(M.skills)
M.skills = null //no skill restriction
- if(is_alien_whitelisted(M,"Yautja Elder"))
- M.change_real_name(M, "Elder [y_name]")
- H.equip_to_slot_or_del(new /obj/item/clothing/suit/armor/yautja/hunter/full(H), WEAR_JACKET)
- H.equip_to_slot_or_del(new /obj/item/weapon/twohanded/yautja/glaive(H), WEAR_L_HAND)
- else
- M.change_real_name(M, y_name)
+ M.change_real_name(M, y_name)
M.name = "Unknown" // Yautja names are not visible for oomans
if(H)
diff --git a/code/modules/mob/new_player/new_player.dm b/code/modules/mob/new_player/new_player.dm
index ccf649fb0509..810eb4006634 100644
--- a/code/modules/mob/new_player/new_player.dm
+++ b/code/modules/mob/new_player/new_player.dm
@@ -168,16 +168,6 @@
tutorial_menu()
return
- if(client.prefs.species != "Human")
- if(!is_alien_whitelisted(src, client.prefs.species) && CONFIG_GET(flag/usealienwhitelist))
- to_chat(src, "You are currently not whitelisted to play [client.prefs.species].")
- return
-
- var/datum/species/S = GLOB.all_species[client.prefs.species]
- if(!(S.flags & IS_WHITELISTED))
- to_chat(src, alert("Your current species,[client.prefs.species], is not available for play on the station."))
- return
-
LateChoices()
if("late_join_xeno")
@@ -217,16 +207,6 @@
to_chat(usr, SPAN_WARNING("There is an administrative lock on entering the game! (The dropship likely crashed into the Almayer. This should take at most 20 minutes.)"))
return
- if(client.prefs.species != "Human")
- if(!is_alien_whitelisted(src, client.prefs.species) && CONFIG_GET(flag/usealienwhitelist))
- to_chat(src, alert("You are currently not whitelisted to play [client.prefs.species]."))
- return 0
-
- var/datum/species/S = GLOB.all_species[client.prefs.species]
- if(!(S.flags & IS_WHITELISTED))
- to_chat(src, alert("Your current species,[client.prefs.species], is not available for play on the station."))
- return 0
-
AttemptLateSpawn(href_list["job_selected"])
return
@@ -382,14 +362,6 @@
var/mob/living/carbon/human/new_character
- var/datum/species/chosen_species
- if(client.prefs.species)
- chosen_species = GLOB.all_species[client.prefs.species]
- if(chosen_species)
- // Have to recheck admin due to no usr at roundstart. Latejoins are fine though.
- if(is_species_whitelisted(chosen_species) || has_admin_rights())
- new_character = new(loc, client.prefs.species)
-
if(!new_character)
new_character = new(loc)
@@ -456,26 +428,6 @@
ui.close()
continue
-/mob/new_player/proc/has_admin_rights()
- return client.admin_holder.rights & R_ADMIN
-
-/mob/new_player/proc/is_species_whitelisted(datum/species/S)
- if(!S) return 1
- return is_alien_whitelisted(src, S.name) || !CONFIG_GET(flag/usealienwhitelist) || !(S.flags & IS_WHITELISTED)
-
-/mob/new_player/get_species()
- var/datum/species/chosen_species
- if(client.prefs.species)
- chosen_species = GLOB.all_species[client.prefs.species]
-
- if(!chosen_species)
- return "Human"
-
- if(is_species_whitelisted(chosen_species) || has_admin_rights())
- return chosen_species.name
-
- return "Human"
-
/mob/new_player/get_gender()
if(!client || !client.prefs) ..()
return client.prefs.gender
From f11e045841f8f50f9ec73cf7c7b876a76bffeff4 Mon Sep 17 00:00:00 2001
From: forest2001
Date: Sun, 7 Jan 2024 21:53:15 +0000
Subject: [PATCH 05/27] TGUI
---
code/game/jobs/whitelist.dm | 161 ++++++++++++
code/modules/admin/admin_verbs.dm | 1 +
.../tgui/interfaces/WhitelistPanel.jsx | 237 ++++++++++++++++++
3 files changed, 399 insertions(+)
create mode 100644 tgui/packages/tgui/interfaces/WhitelistPanel.jsx
diff --git a/code/game/jobs/whitelist.dm b/code/game/jobs/whitelist.dm
index 02aa4f5b967e..cbc9ae16118a 100644
--- a/code/game/jobs/whitelist.dm
+++ b/code/game/jobs/whitelist.dm
@@ -49,4 +49,165 @@ GLOBAL_LIST_FILE_LOAD(whitelist, WHITELISTFILE)
if(WHITELISTS_LEADER & player.whitelist_flags)
add_verb(src, /client/proc/whitelist_panel)
+/*
+target.client.prefs.muted = text2num(params["mute_flag"])
+ log_admin("[key_name(user)] set the mute flags for [key_name(target)] to [target.client.prefs.muted].")
+ return TRUE
+*/
+
+/client/proc/whitelist_panel_tgui()
+ set name = "Whitelist TGUI Panel"
+ set category = "Admin.Panels"
+ if(!SSticker.mode)
+ to_chat(usr, SPAN_WARNING("The round has not started yet."))
+ return FALSE
+
+ GLOB.WhitelistPanel.tgui_interact(mob)
+ var/mob/user = usr
+ var/log = "[key_name(user)] opened the Whitelist Panel."
+ message_admins(log)
+
+GLOBAL_DATUM_INIT(WhitelistPanel, /datum/whitelist_panel, new)
+
+/datum/whitelist_panel
+ var/viewed_player = list()
+ var/current_menu = "Panel"
+ var/used_by
+ var/user_rights
+
+#define PANEL_RIGHT_CO (1<<0)
+#define PANEL_RIGHT_SYNTH (1<<1)
+#define PANEL_RIGHT_YAUTJA (1<<2)
+#define PANEL_RIGHT_MENTOR (1<<3)
+#define PANEL_RIGHT_OVERSEER (1<<4)
+#define PANEL_ALL_RIGHTS (PANEL_RIGHT_CO|PANEL_RIGHT_SYNTH|PANEL_RIGHT_YAUTJA|PANEL_RIGHT_MENTOR|PANEL_RIGHT_OVERSEER)
+
+/datum/whitelist_panel/proc/get_user_rights(mob/user)
+ if(!user.client)
+ return
+ var/client/person = user.client
+ if(CLIENT_HAS_RIGHTS(person, R_PERMISSIONS) || person.check_whitelist_status(WHITELISTS_LEADER))
+ return PANEL_ALL_RIGHTS
+ var/rights
+ if(person.check_whitelist_status(WHITELIST_COMMANDER_LEADER))
+ rights |= PANEL_RIGHT_CO
+ if(person.check_whitelist_status(WHITELIST_SYNTHETIC_LEADER))
+ rights |= PANEL_RIGHT_SYNTH
+ if(person.check_whitelist_status(WHITELIST_YAUTJA_LEADER))
+ rights |= PANEL_RIGHT_YAUTJA
+ return rights
+
+/datum/whitelist_panel/tgui_interact(mob/user, datum/tgui/ui, datum/ui_state/state)
+ ui = SStgui.try_update_ui(user, src, ui)
+ if(!ui)
+ ui = new(user, src, "WhitelistPanel", "Whitelist Panel")
+ ui.open()
+
+/datum/whitelist_panel/ui_close(mob/user)
+ . = ..()
+ if(used_by)
+ used_by = null
+ viewed_player = list()
+
+/datum/whitelist_panel/ui_data(mob/user)
+ var/list/data = list()
+
+ data["current_menu"] = current_menu
+ data["viewed_player"] = viewed_player
+
+ var/list/datum/view_record/players/players_view = DB_VIEW(/datum/view_record/players, DB_COMP("whitelist_status", DB_NOTEQUAL, ""))
+
+ var/list/whitelisted_players = list()
+ for(var/datum/view_record/players/whitelistee in players_view)
+ var/list/current_player = list()
+ current_player["ckey"] = whitelistee.ckey
+ current_player["status"] = whitelistee.whitelist_status
+ whitelisted_players += list(current_player)
+ data["whitelisted_players"] = whitelisted_players
+
+ return data
+
+GLOBAL_LIST_INIT(co_flags, list(
+ list(name = "Whitelisted", bitflag = WHITELIST_COMMANDER, permission = PANEL_RIGHT_CO),
+ list(name = "Council", bitflag = WHITELIST_COMMANDER_COUNCIL, permission = PANEL_RIGHT_CO),
+ list(name = "Legacy Council", bitflag = WHITELIST_COMMANDER_COUNCIL_LEGACY, permission = PANEL_RIGHT_CO),
+ list(name = "Senator", bitflag = WHITELIST_COMMANDER_LEADER, permission = PANEL_RIGHT_OVERSEER)
+))
+GLOBAL_LIST_INIT(syn_flags, list(
+ list(name = "Whitelisted", bitflag = WHITELIST_SYNTHETIC, permission = PANEL_RIGHT_SYNTH),
+ list(name = "Council", bitflag = WHITELIST_SYNTHETIC_COUNCIL, permission = PANEL_RIGHT_SYNTH),
+ list(name = "Legacy Council", bitflag = WHITELIST_SYNTHETIC_COUNCIL_LEGACY, permission = PANEL_RIGHT_SYNTH),
+ list(name = "Senator", bitflag = WHITELIST_SYNTHETIC_LEADER, permission = PANEL_RIGHT_OVERSEER)
+))
+GLOBAL_LIST_INIT(yaut_flags, list(
+ list(name = "Whitelisted", bitflag = WHITELIST_YAUTJA, permission = PANEL_RIGHT_YAUTJA),
+ list(name = "Legacy", bitflag = WHITELIST_YAUTJA_LEGACY, permission = PANEL_RIGHT_OVERSEER),
+ list(name = "Council", bitflag = WHITELIST_YAUTJA_COUNCIL, permission = PANEL_RIGHT_YAUTJA),
+ list(name = "Legacy Council", bitflag = WHITELIST_YAUTJA_COUNCIL_LEGACY, permission = PANEL_RIGHT_YAUTJA),
+ list(name = "Senator", bitflag = WHITELIST_YAUTJA_LEADER, permission = PANEL_RIGHT_OVERSEER)
+))
+GLOBAL_LIST_INIT(misc_flags, list(
+ list(name = "Senior Enlisted Advisor", bitflag = WHITELIST_MENTOR, permission = PANEL_RIGHT_MENTOR),
+ list(name = "Working Joe", bitflag = WHITELIST_JOE, permission = PANEL_RIGHT_SYNTH),
+))
+
+/datum/whitelist_panel/ui_static_data(mob/user)
+ . = list()
+ .["glob_mute_bits"] = GLOB.mute_bits
+ .["co_flags"] = GLOB.co_flags
+ .["syn_flags"] = GLOB.syn_flags
+ .["yaut_flags"] = GLOB.yaut_flags
+ .["misc_flags"] = GLOB.misc_flags
+
+/datum/whitelist_panel/ui_act(action, list/params, datum/tgui/ui, datum/ui_state/state)
+ . = ..()
+ if(.)
+ return
+ var/mob/user = usr
+ switch(action)
+ if("select_player")
+ if(used_by != user.ckey)
+ to_chat(user, SPAN_ALERTWARNING("Panel already in use by [used_by]"))
+ var/override_option = tgui_alert(user, "The Whitelist Panel is in use by [used_by]. Do you want to override?", "Use Panel", list("Override", "Cancel"))
+ if(override_option != "Override")
+ return
+
+ var/datum/entity/player/player = get_player_from_key(params["player"])
+ var/list/current_player = list()
+ current_player["ckey"] = params["player"]
+ current_player["status"] = player.whitelist_status
+ current_player["flags"] = player.whitelist_flags
+
+ viewed_player = current_player
+ current_menu = "Update"
+ user_rights = get_user_rights(user)
+ used_by = user.ckey
+
+/*
+/proc/update_whitelist()
+ if(!CLIENT_HAS_RIGHTS(src, R_PERMISSIONS) && !check_whitelist_status(WHITELISTS_LEADER))
+ return
+
+ var/target_ckey = href_list["change_whitelist"]
+ if(target_ckey == "[TRUE]")
+ target_ckey = ckey(tgui_input_text(usr, "Which CKEY do you want to edit?", "Select CKEY"))
+
+ if(!target_ckey || target_ckey == TRUE)
+ return
+
+ var/datum/entity/player/player = get_player_from_key(ckey)
+ var/can_edit = list()
+ for(var/bitfield in GLOB.whitelist_permissions)
+ if(player.whitelist_flags & bitfield)
+ can_edit += GLOB.whitelist_permissions[bitfield]
+ if(!length(can_edit))
+ can_edit = null
+
+ var/flags = input_bitfield(usr, "Select Flags", "whitelist_status", player.whitelist_flags, allowed_edit_list = can_edit)
+ player.set_whitelist_status(flags)
+*/
+
+
+
+
#undef WHITELISTFILE
diff --git a/code/modules/admin/admin_verbs.dm b/code/modules/admin/admin_verbs.dm
index c95cf55b1d3b..c285fc8ea56d 100644
--- a/code/modules/admin/admin_verbs.dm
+++ b/code/modules/admin/admin_verbs.dm
@@ -244,6 +244,7 @@ GLOBAL_LIST_INIT(admin_verbs_possess, list(
GLOBAL_LIST_INIT(admin_verbs_permissions, list(
/client/proc/ToRban,
/client/proc/whitelist_panel,
+ /client/proc/whitelist_panel_tgui,
))
GLOBAL_LIST_INIT(admin_verbs_color, list(
diff --git a/tgui/packages/tgui/interfaces/WhitelistPanel.jsx b/tgui/packages/tgui/interfaces/WhitelistPanel.jsx
new file mode 100644
index 000000000000..fce9cc4f9ccd
--- /dev/null
+++ b/tgui/packages/tgui/interfaces/WhitelistPanel.jsx
@@ -0,0 +1,237 @@
+import { useBackend } from '../backend';
+import { Button, Stack, Section, Box, Flex } from '../components';
+import { Window } from '../layouts';
+
+const PAGES = {
+ 'Panel': () => PlayerList,
+ 'Update': () => StatusUpdate,
+};
+
+const hasPermission = (data, action) => {
+ if (!(action in data.glob_pp_actions)) return false;
+
+ const action_data = data.glob_pp_actions[action];
+ return !!(action_data.permissions_required & data.current_permissions);
+};
+
+export const WhitelistPanel = (props, context) => {
+ const { data } = useBackend(context);
+ const { current_menu } = data;
+ const PageComponent = PAGES[current_menu]();
+
+ let themecolor = 'crtblue';
+
+ return (
+
+
+
+
+
+ );
+};
+
+const PlayerList = (props, context) => {
+ const { data, act } = useBackend(context);
+ const { last_page, current_menu, whitelisted_players } = data;
+
+ return (
+ <>
+
+
+
+ act('go_back')}
+ disabled={last_page === current_menu}
+ />
+
+
+
+
+
+ Whitelist Panel
+
+ {!!whitelisted_players.length && (
+
+
+
+ CKey
+
+
+ Status
+
+
+ )}
+ {whitelisted_players.map((record, i) => {
+ return (
+
+
+ act('select_player', { player: record.ckey })}
+ />
+
+
+ {record.ckey}
+
+
+ {record.status}
+
+
+ );
+ })}
+
+ >
+ );
+};
+
+const StatusUpdate = (props, context) => {
+ const { act, data } = useBackend(context);
+ const {
+ co_flags,
+ syn_flags,
+ yaut_flags,
+ misc_flags,
+ client_muted,
+ viewed_player,
+ user_rights,
+ } = data;
+ return (
+
+ Whitelists for: {viewed_player.name}
+
+
+ {co_flags.map((bit, i) => {
+ const isWhitelisted =
+ viewed_player.flags && viewed_player.flags & bit.bitflag;
+ return (
+
+ act('mob_mute', {
+ 'mute_flag': !isWhitelisted
+ ? client_muted | bit.bitflag
+ : client_muted & ~bit.bitflag,
+ })
+ }
+ />
+ );
+ })}
+
+
+
+
+ {syn_flags.map((bit, i) => {
+ const isWhitelisted =
+ viewed_player.flags && viewed_player.flags & bit.bitflag;
+ return (
+
+ act('mob_mute', {
+ 'mute_flag': !isWhitelisted
+ ? client_muted | bit.bitflag
+ : client_muted & ~bit.bitflag,
+ })
+ }
+ />
+ );
+ })}
+
+
+
+
+ {yaut_flags.map((bit, i) => {
+ const isWhitelisted =
+ viewed_player.flags && viewed_player.flags & bit.bitflag;
+ return (
+
+ act('mob_mute', {
+ 'mute_flag': !isWhitelisted
+ ? client_muted | bit.bitflag
+ : client_muted & ~bit.bitflag,
+ })
+ }
+ />
+ );
+ })}
+
+
+
+
+ {misc_flags.map((bit, i) => {
+ const isWhitelisted =
+ viewed_player.flags && viewed_player.flags & bit.bitflag;
+ return (
+
+ act('mob_mute', {
+ 'mute_flag': !isWhitelisted
+ ? client_muted | bit.bitflag
+ : client_muted & ~bit.bitflag,
+ })
+ }
+ />
+ );
+ })}
+
+
+
+
+ {misc_flags.map((bit, i) => {
+ const isWhitelisted =
+ viewed_player.flags && viewed_player.flags & bit.bitflag;
+ return (
+
+ act('mob_mute', {
+ 'mute_flag': !isWhitelisted
+ ? client_muted | bit.bitflag
+ : client_muted & ~bit.bitflag,
+ })
+ }
+ />
+ );
+ })}
+
+
+
+ );
+};
From 81652c3a61f1d983fbbb505f9700e5cb473aa54e Mon Sep 17 00:00:00 2001
From: forest2001
Date: Sun, 7 Jan 2024 23:24:56 +0000
Subject: [PATCH 06/27] opens
right checks
x
---
code/game/jobs/whitelist.dm | 71 +++++++++++--------
.../tgui/interfaces/WhitelistPanel.jsx | 35 +++------
2 files changed, 50 insertions(+), 56 deletions(-)
diff --git a/code/game/jobs/whitelist.dm b/code/game/jobs/whitelist.dm
index cbc9ae16118a..da4fb4b7c6ec 100644
--- a/code/game/jobs/whitelist.dm
+++ b/code/game/jobs/whitelist.dm
@@ -69,50 +69,56 @@ target.client.prefs.muted = text2num(params["mute_flag"])
GLOBAL_DATUM_INIT(WhitelistPanel, /datum/whitelist_panel, new)
+#define WL_PANEL_RIGHT_CO (1<<0)
+#define WL_PANEL_RIGHT_SYNTH (1<<1)
+#define WL_PANEL_RIGHT_YAUTJA (1<<2)
+#define WL_PANEL_RIGHT_MENTOR (1<<3)
+#define WL_PANEL_RIGHT_OVERSEER (1<<4)
+#define WL_PANEL_ALL_RIGHTS (WL_PANEL_RIGHT_CO|WL_PANEL_RIGHT_SYNTH|WL_PANEL_RIGHT_YAUTJA|WL_PANEL_RIGHT_MENTOR|WL_PANEL_RIGHT_OVERSEER)
+
/datum/whitelist_panel
var/viewed_player = list()
var/current_menu = "Panel"
var/used_by
- var/user_rights
-
-#define PANEL_RIGHT_CO (1<<0)
-#define PANEL_RIGHT_SYNTH (1<<1)
-#define PANEL_RIGHT_YAUTJA (1<<2)
-#define PANEL_RIGHT_MENTOR (1<<3)
-#define PANEL_RIGHT_OVERSEER (1<<4)
-#define PANEL_ALL_RIGHTS (PANEL_RIGHT_CO|PANEL_RIGHT_SYNTH|PANEL_RIGHT_YAUTJA|PANEL_RIGHT_MENTOR|PANEL_RIGHT_OVERSEER)
+ var/user_rights = 0
/datum/whitelist_panel/proc/get_user_rights(mob/user)
if(!user.client)
return
var/client/person = user.client
if(CLIENT_HAS_RIGHTS(person, R_PERMISSIONS) || person.check_whitelist_status(WHITELISTS_LEADER))
- return PANEL_ALL_RIGHTS
+ return WL_PANEL_ALL_RIGHTS
var/rights
if(person.check_whitelist_status(WHITELIST_COMMANDER_LEADER))
- rights |= PANEL_RIGHT_CO
+ rights |= WL_PANEL_RIGHT_CO
if(person.check_whitelist_status(WHITELIST_SYNTHETIC_LEADER))
- rights |= PANEL_RIGHT_SYNTH
+ rights |= WL_PANEL_RIGHT_SYNTH
if(person.check_whitelist_status(WHITELIST_YAUTJA_LEADER))
- rights |= PANEL_RIGHT_YAUTJA
+ rights |= WL_PANEL_RIGHT_YAUTJA
return rights
-/datum/whitelist_panel/tgui_interact(mob/user, datum/tgui/ui, datum/ui_state/state)
+/datum/whitelist_panel/tgui_interact(mob/user, datum/tgui/ui)
ui = SStgui.try_update_ui(user, src, ui)
if(!ui)
ui = new(user, src, "WhitelistPanel", "Whitelist Panel")
ui.open()
+/datum/whitelist_panel/ui_state(mob/user)
+ return GLOB.always_state
+
/datum/whitelist_panel/ui_close(mob/user)
. = ..()
if(used_by)
used_by = null
viewed_player = list()
+ user_rights = 0
+ current_menu = "Panel"
/datum/whitelist_panel/ui_data(mob/user)
var/list/data = list()
data["current_menu"] = current_menu
+ data["user_rights"] = user_rights
data["viewed_player"] = viewed_player
var/list/datum/view_record/players/players_view = DB_VIEW(/datum/view_record/players, DB_COMP("whitelist_status", DB_NOTEQUAL, ""))
@@ -128,32 +134,31 @@ GLOBAL_DATUM_INIT(WhitelistPanel, /datum/whitelist_panel, new)
return data
GLOBAL_LIST_INIT(co_flags, list(
- list(name = "Whitelisted", bitflag = WHITELIST_COMMANDER, permission = PANEL_RIGHT_CO),
- list(name = "Council", bitflag = WHITELIST_COMMANDER_COUNCIL, permission = PANEL_RIGHT_CO),
- list(name = "Legacy Council", bitflag = WHITELIST_COMMANDER_COUNCIL_LEGACY, permission = PANEL_RIGHT_CO),
- list(name = "Senator", bitflag = WHITELIST_COMMANDER_LEADER, permission = PANEL_RIGHT_OVERSEER)
+ list(name = "Whitelisted", bitflag = WHITELIST_COMMANDER, permission = WL_PANEL_RIGHT_CO),
+ list(name = "Council", bitflag = WHITELIST_COMMANDER_COUNCIL, permission = WL_PANEL_RIGHT_CO),
+ list(name = "Legacy Council", bitflag = WHITELIST_COMMANDER_COUNCIL_LEGACY, permission = WL_PANEL_RIGHT_CO),
+ list(name = "Senator", bitflag = WHITELIST_COMMANDER_LEADER, permission = WL_PANEL_RIGHT_OVERSEER)
))
GLOBAL_LIST_INIT(syn_flags, list(
- list(name = "Whitelisted", bitflag = WHITELIST_SYNTHETIC, permission = PANEL_RIGHT_SYNTH),
- list(name = "Council", bitflag = WHITELIST_SYNTHETIC_COUNCIL, permission = PANEL_RIGHT_SYNTH),
- list(name = "Legacy Council", bitflag = WHITELIST_SYNTHETIC_COUNCIL_LEGACY, permission = PANEL_RIGHT_SYNTH),
- list(name = "Senator", bitflag = WHITELIST_SYNTHETIC_LEADER, permission = PANEL_RIGHT_OVERSEER)
+ list(name = "Whitelisted", bitflag = WHITELIST_SYNTHETIC, permission = WL_PANEL_RIGHT_SYNTH),
+ list(name = "Council", bitflag = WHITELIST_SYNTHETIC_COUNCIL, permission = WL_PANEL_RIGHT_SYNTH),
+ list(name = "Legacy Council", bitflag = WHITELIST_SYNTHETIC_COUNCIL_LEGACY, permission = WL_PANEL_RIGHT_SYNTH),
+ list(name = "Senator", bitflag = WHITELIST_SYNTHETIC_LEADER, permission = WL_PANEL_RIGHT_OVERSEER)
))
GLOBAL_LIST_INIT(yaut_flags, list(
- list(name = "Whitelisted", bitflag = WHITELIST_YAUTJA, permission = PANEL_RIGHT_YAUTJA),
- list(name = "Legacy", bitflag = WHITELIST_YAUTJA_LEGACY, permission = PANEL_RIGHT_OVERSEER),
- list(name = "Council", bitflag = WHITELIST_YAUTJA_COUNCIL, permission = PANEL_RIGHT_YAUTJA),
- list(name = "Legacy Council", bitflag = WHITELIST_YAUTJA_COUNCIL_LEGACY, permission = PANEL_RIGHT_YAUTJA),
- list(name = "Senator", bitflag = WHITELIST_YAUTJA_LEADER, permission = PANEL_RIGHT_OVERSEER)
+ list(name = "Whitelisted", bitflag = WHITELIST_YAUTJA, permission = WL_PANEL_RIGHT_YAUTJA),
+ list(name = "Legacy", bitflag = WHITELIST_YAUTJA_LEGACY, permission = WL_PANEL_RIGHT_OVERSEER),
+ list(name = "Council", bitflag = WHITELIST_YAUTJA_COUNCIL, permission = WL_PANEL_RIGHT_YAUTJA),
+ list(name = "Legacy Council", bitflag = WHITELIST_YAUTJA_COUNCIL_LEGACY, permission = WL_PANEL_RIGHT_YAUTJA),
+ list(name = "Senator", bitflag = WHITELIST_YAUTJA_LEADER, permission = WL_PANEL_RIGHT_OVERSEER)
))
GLOBAL_LIST_INIT(misc_flags, list(
- list(name = "Senior Enlisted Advisor", bitflag = WHITELIST_MENTOR, permission = PANEL_RIGHT_MENTOR),
- list(name = "Working Joe", bitflag = WHITELIST_JOE, permission = PANEL_RIGHT_SYNTH),
+ list(name = "Senior Enlisted Advisor", bitflag = WHITELIST_MENTOR, permission = WL_PANEL_RIGHT_MENTOR),
+ list(name = "Working Joe", bitflag = WHITELIST_JOE, permission = WL_PANEL_RIGHT_SYNTH),
))
/datum/whitelist_panel/ui_static_data(mob/user)
. = list()
- .["glob_mute_bits"] = GLOB.mute_bits
.["co_flags"] = GLOB.co_flags
.["syn_flags"] = GLOB.syn_flags
.["yaut_flags"] = GLOB.yaut_flags
@@ -166,7 +171,7 @@ GLOBAL_LIST_INIT(misc_flags, list(
var/mob/user = usr
switch(action)
if("select_player")
- if(used_by != user.ckey)
+ if(used_by && (used_by != user.ckey))
to_chat(user, SPAN_ALERTWARNING("Panel already in use by [used_by]"))
var/override_option = tgui_alert(user, "The Whitelist Panel is in use by [used_by]. Do you want to override?", "Use Panel", list("Override", "Cancel"))
if(override_option != "Override")
@@ -211,3 +216,9 @@ GLOBAL_LIST_INIT(misc_flags, list(
#undef WHITELISTFILE
+#undef WL_PANEL_RIGHT_CO
+#undef WL_PANEL_RIGHT_SYNTH
+#undef WL_PANEL_RIGHT_YAUTJA
+#undef WL_PANEL_RIGHT_MENTOR
+#undef WL_PANEL_RIGHT_OVERSEER
+#undef WL_PANEL_ALL_RIGHTS
diff --git a/tgui/packages/tgui/interfaces/WhitelistPanel.jsx b/tgui/packages/tgui/interfaces/WhitelistPanel.jsx
index fce9cc4f9ccd..ffa8378266cf 100644
--- a/tgui/packages/tgui/interfaces/WhitelistPanel.jsx
+++ b/tgui/packages/tgui/interfaces/WhitelistPanel.jsx
@@ -106,12 +106,13 @@ const StatusUpdate = (props, context) => {
} = data;
return (
- Whitelists for: {viewed_player.name}
+ Whitelists for: {viewed_player.ckey}
{co_flags.map((bit, i) => {
const isWhitelisted =
viewed_player.flags && viewed_player.flags & bit.bitflag;
+ const editable = user_rights && bit.permission & user_rights;
return (
{
checked={isWhitelisted}
color={isWhitelisted ? 'good' : 'bad'}
content={bit.name}
+ disabled={!editable}
onClick={() =>
act('mob_mute', {
'mute_flag': !isWhitelisted
@@ -137,6 +139,7 @@ const StatusUpdate = (props, context) => {
{syn_flags.map((bit, i) => {
const isWhitelisted =
viewed_player.flags && viewed_player.flags & bit.bitflag;
+ const editable = user_rights && bit.permission & user_rights;
return (
{
checked={isWhitelisted}
color={isWhitelisted ? 'good' : 'bad'}
content={bit.name}
+ disabled={!editable}
onClick={() =>
act('mob_mute', {
'mute_flag': !isWhitelisted
@@ -162,6 +166,7 @@ const StatusUpdate = (props, context) => {
{yaut_flags.map((bit, i) => {
const isWhitelisted =
viewed_player.flags && viewed_player.flags & bit.bitflag;
+ const editable = user_rights && bit.permission & user_rights;
return (
{
checked={isWhitelisted}
color={isWhitelisted ? 'good' : 'bad'}
content={bit.name}
+ disabled={!editable}
onClick={() =>
act('mob_mute', {
'mute_flag': !isWhitelisted
@@ -187,6 +193,7 @@ const StatusUpdate = (props, context) => {
{misc_flags.map((bit, i) => {
const isWhitelisted =
viewed_player.flags && viewed_player.flags & bit.bitflag;
+ const editable = user_rights && bit.permission & user_rights;
return (
{
checked={isWhitelisted}
color={isWhitelisted ? 'good' : 'bad'}
content={bit.name}
- onClick={() =>
- act('mob_mute', {
- 'mute_flag': !isWhitelisted
- ? client_muted | bit.bitflag
- : client_muted & ~bit.bitflag,
- })
- }
- />
- );
- })}
-
-
-
-
- {misc_flags.map((bit, i) => {
- const isWhitelisted =
- viewed_player.flags && viewed_player.flags & bit.bitflag;
- return (
-
act('mob_mute', {
'mute_flag': !isWhitelisted
From 4322bcfe08b7e80a98dc1a203b2e5639c74b983e Mon Sep 17 00:00:00 2001
From: forest2001
Date: Mon, 8 Jan 2024 00:09:57 +0000
Subject: [PATCH 07/27] xxx
---
code/game/jobs/whitelist.dm | 36 +++--
.../tgui/interfaces/WhitelistPanel.jsx | 144 +++++++++---------
2 files changed, 91 insertions(+), 89 deletions(-)
diff --git a/code/game/jobs/whitelist.dm b/code/game/jobs/whitelist.dm
index da4fb4b7c6ec..3f98e7e62943 100644
--- a/code/game/jobs/whitelist.dm
+++ b/code/game/jobs/whitelist.dm
@@ -81,6 +81,7 @@ GLOBAL_DATUM_INIT(WhitelistPanel, /datum/whitelist_panel, new)
var/current_menu = "Panel"
var/used_by
var/user_rights = 0
+ var/target_rights = 0
/datum/whitelist_panel/proc/get_user_rights(mob/user)
if(!user.client)
@@ -113,6 +114,7 @@ GLOBAL_DATUM_INIT(WhitelistPanel, /datum/whitelist_panel, new)
viewed_player = list()
user_rights = 0
current_menu = "Panel"
+ target_rights = 0
/datum/whitelist_panel/ui_data(mob/user)
var/list/data = list()
@@ -120,6 +122,7 @@ GLOBAL_DATUM_INIT(WhitelistPanel, /datum/whitelist_panel, new)
data["current_menu"] = current_menu
data["user_rights"] = user_rights
data["viewed_player"] = viewed_player
+ data["target_rights"] = target_rights
var/list/datum/view_record/players/players_view = DB_VIEW(/datum/view_record/players, DB_COMP("whitelist_status", DB_NOTEQUAL, ""))
@@ -134,23 +137,23 @@ GLOBAL_DATUM_INIT(WhitelistPanel, /datum/whitelist_panel, new)
return data
GLOBAL_LIST_INIT(co_flags, list(
- list(name = "Whitelisted", bitflag = WHITELIST_COMMANDER, permission = WL_PANEL_RIGHT_CO),
- list(name = "Council", bitflag = WHITELIST_COMMANDER_COUNCIL, permission = WL_PANEL_RIGHT_CO),
- list(name = "Legacy Council", bitflag = WHITELIST_COMMANDER_COUNCIL_LEGACY, permission = WL_PANEL_RIGHT_CO),
- list(name = "Senator", bitflag = WHITELIST_COMMANDER_LEADER, permission = WL_PANEL_RIGHT_OVERSEER)
+ list(name = "Commander", bitflag = WHITELIST_COMMANDER, permission = WL_PANEL_RIGHT_CO),
+ list(name = "CO Council", bitflag = WHITELIST_COMMANDER_COUNCIL, permission = WL_PANEL_RIGHT_CO),
+ list(name = "Legacy CO Council", bitflag = WHITELIST_COMMANDER_COUNCIL_LEGACY, permission = WL_PANEL_RIGHT_CO),
+ list(name = "CO Senator", bitflag = WHITELIST_COMMANDER_LEADER, permission = WL_PANEL_RIGHT_OVERSEER)
))
GLOBAL_LIST_INIT(syn_flags, list(
- list(name = "Whitelisted", bitflag = WHITELIST_SYNTHETIC, permission = WL_PANEL_RIGHT_SYNTH),
- list(name = "Council", bitflag = WHITELIST_SYNTHETIC_COUNCIL, permission = WL_PANEL_RIGHT_SYNTH),
- list(name = "Legacy Council", bitflag = WHITELIST_SYNTHETIC_COUNCIL_LEGACY, permission = WL_PANEL_RIGHT_SYNTH),
- list(name = "Senator", bitflag = WHITELIST_SYNTHETIC_LEADER, permission = WL_PANEL_RIGHT_OVERSEER)
+ list(name = "Synethetic", bitflag = WHITELIST_SYNTHETIC, permission = WL_PANEL_RIGHT_SYNTH),
+ list(name = "Synthetic Council", bitflag = WHITELIST_SYNTHETIC_COUNCIL, permission = WL_PANEL_RIGHT_SYNTH),
+ list(name = "Legacy Synthetic Council", bitflag = WHITELIST_SYNTHETIC_COUNCIL_LEGACY, permission = WL_PANEL_RIGHT_SYNTH),
+ list(name = "Synthetic Senator", bitflag = WHITELIST_SYNTHETIC_LEADER, permission = WL_PANEL_RIGHT_OVERSEER)
))
GLOBAL_LIST_INIT(yaut_flags, list(
- list(name = "Whitelisted", bitflag = WHITELIST_YAUTJA, permission = WL_PANEL_RIGHT_YAUTJA),
- list(name = "Legacy", bitflag = WHITELIST_YAUTJA_LEGACY, permission = WL_PANEL_RIGHT_OVERSEER),
- list(name = "Council", bitflag = WHITELIST_YAUTJA_COUNCIL, permission = WL_PANEL_RIGHT_YAUTJA),
- list(name = "Legacy Council", bitflag = WHITELIST_YAUTJA_COUNCIL_LEGACY, permission = WL_PANEL_RIGHT_YAUTJA),
- list(name = "Senator", bitflag = WHITELIST_YAUTJA_LEADER, permission = WL_PANEL_RIGHT_OVERSEER)
+ list(name = "Yautja", bitflag = WHITELIST_YAUTJA, permission = WL_PANEL_RIGHT_YAUTJA),
+ list(name = "Legacy Yautja", bitflag = WHITELIST_YAUTJA_LEGACY, permission = WL_PANEL_RIGHT_OVERSEER),
+ list(name = "Yautja Council", bitflag = WHITELIST_YAUTJA_COUNCIL, permission = WL_PANEL_RIGHT_YAUTJA),
+ list(name = "Legacy Yautja Council", bitflag = WHITELIST_YAUTJA_COUNCIL_LEGACY, permission = WL_PANEL_RIGHT_YAUTJA),
+ list(name = "Yautja Senator", bitflag = WHITELIST_YAUTJA_LEADER, permission = WL_PANEL_RIGHT_OVERSEER)
))
GLOBAL_LIST_INIT(misc_flags, list(
list(name = "Senior Enlisted Advisor", bitflag = WHITELIST_MENTOR, permission = WL_PANEL_RIGHT_MENTOR),
@@ -170,6 +173,13 @@ GLOBAL_LIST_INIT(misc_flags, list(
return
var/mob/user = usr
switch(action)
+ if("go_back")
+ if(used_by)
+ used_by = null
+ viewed_player = list()
+ user_rights = 0
+ current_menu = "Panel"
+ target_rights = 0
if("select_player")
if(used_by && (used_by != user.ckey))
to_chat(user, SPAN_ALERTWARNING("Panel already in use by [used_by]"))
diff --git a/tgui/packages/tgui/interfaces/WhitelistPanel.jsx b/tgui/packages/tgui/interfaces/WhitelistPanel.jsx
index ffa8378266cf..3adb153aab57 100644
--- a/tgui/packages/tgui/interfaces/WhitelistPanel.jsx
+++ b/tgui/packages/tgui/interfaces/WhitelistPanel.jsx
@@ -1,5 +1,5 @@
import { useBackend } from '../backend';
-import { Button, Stack, Section, Box, Flex } from '../components';
+import { Button, Stack, Section, Flex } from '../components';
import { Window } from '../layouts';
const PAGES = {
@@ -35,61 +35,44 @@ const PlayerList = (props, context) => {
const { last_page, current_menu, whitelisted_players } = data;
return (
- <>
-
-
-
- act('go_back')}
- disabled={last_page === current_menu}
- />
-
-
-
+
+ Whitelist Panel
-
- Whitelist Panel
-
- {!!whitelisted_players.length && (
-
-
+ {!!whitelisted_players.length && (
+
+
+
+ CKey
+
+
+ Status
+
+
+ )}
+ {whitelisted_players.map((record, i) => {
+ return (
+
+
+ act('select_player', { player: record.ckey })}
+ />
+
- CKey
+ {record.ckey}
-
- Status
+
+ {record.status}
- )}
- {whitelisted_players.map((record, i) => {
- return (
-
-
- act('select_player', { player: record.ckey })}
- />
-
-
- {record.ckey}
-
-
- {record.status}
-
-
- );
- })}
-
- >
+ );
+ })}
+
);
};
@@ -100,18 +83,26 @@ const StatusUpdate = (props, context) => {
syn_flags,
yaut_flags,
misc_flags,
- client_muted,
viewed_player,
user_rights,
+ target_rights,
} = data;
return (
+
+ act('go_back')}
+ />
+
Whitelists for: {viewed_player.ckey}
{co_flags.map((bit, i) => {
- const isWhitelisted =
- viewed_player.flags && viewed_player.flags & bit.bitflag;
+ const isWhitelisted = target_rights && target_rights & bit.bitflag;
const editable = user_rights && bit.permission & user_rights;
return (
{
content={bit.name}
disabled={!editable}
onClick={() =>
- act('mob_mute', {
- 'mute_flag': !isWhitelisted
- ? client_muted | bit.bitflag
- : client_muted & ~bit.bitflag,
+ act('update_player', {
+ 'wl_flag': !isWhitelisted
+ ? target_rights | bit.bitflag
+ : target_rights & ~bit.bitflag,
+ 'player': viewed_player.ckey,
})
}
/>
@@ -137,8 +129,7 @@ const StatusUpdate = (props, context) => {
{syn_flags.map((bit, i) => {
- const isWhitelisted =
- viewed_player.flags && viewed_player.flags & bit.bitflag;
+ const isWhitelisted = target_rights && target_rights & bit.bitflag;
const editable = user_rights && bit.permission & user_rights;
return (
{
content={bit.name}
disabled={!editable}
onClick={() =>
- act('mob_mute', {
- 'mute_flag': !isWhitelisted
- ? client_muted | bit.bitflag
- : client_muted & ~bit.bitflag,
+ act('update_player', {
+ 'wl_flag': !isWhitelisted
+ ? target_rights | bit.bitflag
+ : target_rights & ~bit.bitflag,
+ 'player': viewed_player.ckey,
})
}
/>
@@ -164,8 +156,7 @@ const StatusUpdate = (props, context) => {
{yaut_flags.map((bit, i) => {
- const isWhitelisted =
- viewed_player.flags && viewed_player.flags & bit.bitflag;
+ const isWhitelisted = target_rights && target_rights & bit.bitflag;
const editable = user_rights && bit.permission & user_rights;
return (
{
content={bit.name}
disabled={!editable}
onClick={() =>
- act('mob_mute', {
- 'mute_flag': !isWhitelisted
- ? client_muted | bit.bitflag
- : client_muted & ~bit.bitflag,
+ act('update_player', {
+ 'wl_flag': !isWhitelisted
+ ? target_rights | bit.bitflag
+ : target_rights & ~bit.bitflag,
+ 'player': viewed_player.ckey,
})
}
/>
@@ -191,8 +183,7 @@ const StatusUpdate = (props, context) => {
{misc_flags.map((bit, i) => {
- const isWhitelisted =
- viewed_player.flags && viewed_player.flags & bit.bitflag;
+ const isWhitelisted = target_rights && target_rights & bit.bitflag;
const editable = user_rights && bit.permission & user_rights;
return (
{
content={bit.name}
disabled={!editable}
onClick={() =>
- act('mob_mute', {
- 'mute_flag': !isWhitelisted
- ? client_muted | bit.bitflag
- : client_muted & ~bit.bitflag,
+ act('update_player', {
+ 'wl_flag': !isWhitelisted
+ ? target_rights | bit.bitflag
+ : target_rights & ~bit.bitflag,
+ 'player': viewed_player.ckey,
})
}
/>
From 15d3b1bd328f266f77d65948b86c06bbcbb13e36 Mon Sep 17 00:00:00 2001
From: forest2001
Date: Mon, 8 Jan 2024 00:47:11 +0000
Subject: [PATCH 08/27] functional?!
---
code/game/jobs/whitelist.dm | 46 ++-----
.../tgui/interfaces/WhitelistPanel.jsx | 122 ++++++++++++++----
2 files changed, 108 insertions(+), 60 deletions(-)
diff --git a/code/game/jobs/whitelist.dm b/code/game/jobs/whitelist.dm
index 3f98e7e62943..b77d05832f49 100644
--- a/code/game/jobs/whitelist.dm
+++ b/code/game/jobs/whitelist.dm
@@ -49,12 +49,6 @@ GLOBAL_LIST_FILE_LOAD(whitelist, WHITELISTFILE)
if(WHITELISTS_LEADER & player.whitelist_flags)
add_verb(src, /client/proc/whitelist_panel)
-/*
-target.client.prefs.muted = text2num(params["mute_flag"])
- log_admin("[key_name(user)] set the mute flags for [key_name(target)] to [target.client.prefs.muted].")
- return TRUE
-*/
-
/client/proc/whitelist_panel_tgui()
set name = "Whitelist TGUI Panel"
set category = "Admin.Panels"
@@ -82,6 +76,7 @@ GLOBAL_DATUM_INIT(WhitelistPanel, /datum/whitelist_panel, new)
var/used_by
var/user_rights = 0
var/target_rights = 0
+ var/new_rights = 0
/datum/whitelist_panel/proc/get_user_rights(mob/user)
if(!user.client)
@@ -115,6 +110,7 @@ GLOBAL_DATUM_INIT(WhitelistPanel, /datum/whitelist_panel, new)
user_rights = 0
current_menu = "Panel"
target_rights = 0
+ new_rights = 0
/datum/whitelist_panel/ui_data(mob/user)
var/list/data = list()
@@ -123,6 +119,7 @@ GLOBAL_DATUM_INIT(WhitelistPanel, /datum/whitelist_panel, new)
data["user_rights"] = user_rights
data["viewed_player"] = viewed_player
data["target_rights"] = target_rights
+ data["new_rights"] = new_rights
var/list/datum/view_record/players/players_view = DB_VIEW(/datum/view_record/players, DB_COMP("whitelist_status", DB_NOTEQUAL, ""))
@@ -180,6 +177,7 @@ GLOBAL_LIST_INIT(misc_flags, list(
user_rights = 0
current_menu = "Panel"
target_rights = 0
+ new_rights = 0
if("select_player")
if(used_by && (used_by != user.ckey))
to_chat(user, SPAN_ALERTWARNING("Panel already in use by [used_by]"))
@@ -191,38 +189,22 @@ GLOBAL_LIST_INIT(misc_flags, list(
var/list/current_player = list()
current_player["ckey"] = params["player"]
current_player["status"] = player.whitelist_status
- current_player["flags"] = player.whitelist_flags
+ target_rights = player.whitelist_flags
+ new_rights = player.whitelist_flags
viewed_player = current_player
current_menu = "Update"
user_rights = get_user_rights(user)
used_by = user.ckey
-
-/*
-/proc/update_whitelist()
- if(!CLIENT_HAS_RIGHTS(src, R_PERMISSIONS) && !check_whitelist_status(WHITELISTS_LEADER))
- return
-
- var/target_ckey = href_list["change_whitelist"]
- if(target_ckey == "[TRUE]")
- target_ckey = ckey(tgui_input_text(usr, "Which CKEY do you want to edit?", "Select CKEY"))
-
- if(!target_ckey || target_ckey == TRUE)
return
-
- var/datum/entity/player/player = get_player_from_key(ckey)
- var/can_edit = list()
- for(var/bitfield in GLOB.whitelist_permissions)
- if(player.whitelist_flags & bitfield)
- can_edit += GLOB.whitelist_permissions[bitfield]
- if(!length(can_edit))
- can_edit = null
-
- var/flags = input_bitfield(usr, "Select Flags", "whitelist_status", player.whitelist_flags, allowed_edit_list = can_edit)
- player.set_whitelist_status(flags)
-*/
-
-
+ if("update_number")
+ new_rights = text2num(params["wl_flag"])
+ return
+ if("update_perms")
+ var/datum/entity/player/player = get_player_from_key(params["player"])
+ player.set_whitelist_status(new_rights)
+ message_admins("Whitelists updated.")
+ return
#undef WHITELISTFILE
diff --git a/tgui/packages/tgui/interfaces/WhitelistPanel.jsx b/tgui/packages/tgui/interfaces/WhitelistPanel.jsx
index 3adb153aab57..ecb0a350cba0 100644
--- a/tgui/packages/tgui/interfaces/WhitelistPanel.jsx
+++ b/tgui/packages/tgui/interfaces/WhitelistPanel.jsx
@@ -86,6 +86,7 @@ const StatusUpdate = (props, context) => {
viewed_player,
user_rights,
target_rights,
+ new_rights,
} = data;
return (
@@ -99,26 +100,40 @@ const StatusUpdate = (props, context) => {
/>
Whitelists for: {viewed_player.ckey}
+ Flags: {new_rights}
{co_flags.map((bit, i) => {
const isWhitelisted = target_rights && target_rights & bit.bitflag;
+ return (
+
+ );
+ })}
+
+
+ {co_flags.map((bit, i) => {
+ const new_state = new_rights && new_rights & bit.bitflag;
const editable = user_rights && bit.permission & user_rights;
return (
- act('update_player', {
- 'wl_flag': !isWhitelisted
- ? target_rights | bit.bitflag
- : target_rights & ~bit.bitflag,
- 'player': viewed_player.ckey,
+ act('update_number', {
+ 'wl_flag': !new_state
+ ? new_rights | bit.bitflag
+ : new_rights & ~bit.bitflag,
})
}
/>
@@ -130,22 +145,35 @@ const StatusUpdate = (props, context) => {
{syn_flags.map((bit, i) => {
const isWhitelisted = target_rights && target_rights & bit.bitflag;
+ return (
+
+ );
+ })}
+
+
+ {syn_flags.map((bit, i) => {
+ const new_state = new_rights && new_rights & bit.bitflag;
const editable = user_rights && bit.permission & user_rights;
return (
- act('update_player', {
- 'wl_flag': !isWhitelisted
- ? target_rights | bit.bitflag
- : target_rights & ~bit.bitflag,
- 'player': viewed_player.ckey,
+ act('update_number', {
+ 'wl_flag': !new_state
+ ? new_rights | bit.bitflag
+ : new_rights & ~bit.bitflag,
})
}
/>
@@ -157,22 +185,36 @@ const StatusUpdate = (props, context) => {
{yaut_flags.map((bit, i) => {
const isWhitelisted = target_rights && target_rights & bit.bitflag;
- const editable = user_rights && bit.permission & user_rights;
return (
+ );
+ })}
+
+
+ {yaut_flags.map((bit, i) => {
+ const new_state = new_rights && new_rights & bit.bitflag;
+ const editable = user_rights && bit.permission & user_rights;
+ return (
+
- act('update_player', {
- 'wl_flag': !isWhitelisted
- ? target_rights | bit.bitflag
- : target_rights & ~bit.bitflag,
- 'player': viewed_player.ckey,
+ act('update_number', {
+ 'wl_flag': !new_state
+ ? new_rights | bit.bitflag
+ : new_rights & ~bit.bitflag,
})
}
/>
@@ -184,22 +226,36 @@ const StatusUpdate = (props, context) => {
{misc_flags.map((bit, i) => {
const isWhitelisted = target_rights && target_rights & bit.bitflag;
- const editable = user_rights && bit.permission & user_rights;
return (
+ );
+ })}
+
+
+ {misc_flags.map((bit, i) => {
+ const new_state = new_rights && new_rights & bit.bitflag;
+ const editable = user_rights && bit.permission & user_rights;
+ return (
+
- act('update_player', {
- 'wl_flag': !isWhitelisted
- ? target_rights | bit.bitflag
- : target_rights & ~bit.bitflag,
- 'player': viewed_player.ckey,
+ act('update_number', {
+ 'wl_flag': !new_state
+ ? new_rights | bit.bitflag
+ : new_rights & ~bit.bitflag,
})
}
/>
@@ -207,6 +263,16 @@ const StatusUpdate = (props, context) => {
})}
+
+ act('update_perms', { 'player': viewed_player.ckey })}
+ />
+
);
};
From 61f6f373ba005e1b4b533c41125d1c3dea86940e Mon Sep 17 00:00:00 2001
From: forest2001
Date: Mon, 8 Jan 2024 01:11:13 +0000
Subject: [PATCH 09/27] functional.
---
code/game/jobs/whitelist.dm | 11 +++++++++--
.../tgui/interfaces/WhitelistPanel.jsx | 19 ++++++++-----------
2 files changed, 17 insertions(+), 13 deletions(-)
diff --git a/code/game/jobs/whitelist.dm b/code/game/jobs/whitelist.dm
index b77d05832f49..7de67a19b332 100644
--- a/code/game/jobs/whitelist.dm
+++ b/code/game/jobs/whitelist.dm
@@ -201,9 +201,16 @@ GLOBAL_LIST_INIT(misc_flags, list(
new_rights = text2num(params["wl_flag"])
return
if("update_perms")
- var/datum/entity/player/player = get_player_from_key(params["player"])
+ var/player_key = params["player"]
+ var/reason = tgui_input_text(user, "What is the reason for this change?", "Update Reason")
+ if(!reason)
+ return
+ var/datum/entity/player/player = get_player_from_key(player_key)
player.set_whitelist_status(new_rights)
- message_admins("Whitelists updated.")
+ message_admins("Whitelists for [player_key] updated by [key_name(user)]. Reason: '[reason]'.")
+ log_admin("WHITELISTS: Flags for [player_key] changed from [target_rights] to [new_rights]. Reason: '[reason]'.")
+ var/datum/entity/player/player2 = get_player_from_key(player_key)
+ target_rights = player2.whitelist_flags
return
diff --git a/tgui/packages/tgui/interfaces/WhitelistPanel.jsx b/tgui/packages/tgui/interfaces/WhitelistPanel.jsx
index ecb0a350cba0..8c6f5d650843 100644
--- a/tgui/packages/tgui/interfaces/WhitelistPanel.jsx
+++ b/tgui/packages/tgui/interfaces/WhitelistPanel.jsx
@@ -100,17 +100,16 @@ const StatusUpdate = (props, context) => {
/>
Whitelists for: {viewed_player.ckey}
- Flags: {new_rights}
{co_flags.map((bit, i) => {
const isWhitelisted = target_rights && target_rights & bit.bitflag;
return (
-
);
@@ -146,11 +145,11 @@ const StatusUpdate = (props, context) => {
{syn_flags.map((bit, i) => {
const isWhitelisted = target_rights && target_rights & bit.bitflag;
return (
-
);
@@ -186,12 +185,11 @@ const StatusUpdate = (props, context) => {
{yaut_flags.map((bit, i) => {
const isWhitelisted = target_rights && target_rights & bit.bitflag;
return (
-
);
@@ -227,12 +225,11 @@ const StatusUpdate = (props, context) => {
{misc_flags.map((bit, i) => {
const isWhitelisted = target_rights && target_rights & bit.bitflag;
return (
-
);
From 874748e864a963f6a6bc4b7e8c30407def296bcc Mon Sep 17 00:00:00 2001
From: forest2001
Date: Mon, 8 Jan 2024 03:13:27 +0000
Subject: [PATCH 10/27] Fully functional
---
code/__DEFINES/mode.dm | 6 +-
code/game/jobs/whitelist.dm | 78 ++++++++++++-------
code/modules/admin/admin_verbs.dm | 4 +-
code/modules/client/client_procs.dm | 12 +++
.../tgui/interfaces/WhitelistPanel.jsx | 21 +++--
5 files changed, 77 insertions(+), 44 deletions(-)
diff --git a/code/__DEFINES/mode.dm b/code/__DEFINES/mode.dm
index d11f4cb30e33..a2691b6bb312 100644
--- a/code/__DEFINES/mode.dm
+++ b/code/__DEFINES/mode.dm
@@ -187,7 +187,10 @@ GLOBAL_LIST_INIT(whitelist_hierarchy, list(WHITELIST_NORMAL, WHITELIST_COUNCIL,
#define WHITELIST_EVERYTHING (WHITELISTS_GENERAL|WHITELISTS_COUNCIL|WHITELISTS_LEADER)
-#define isCouncil(A) (A.check_whitelist_status(WHITELISTS_COUNCIL))
+#define COUNCIL_LIST list(WHITELIST_COMMANDER_COUNCIL, WHITELIST_SYNTHETIC_COUNCIL, WHITELIST_YAUTJA_COUNCIL)
+#define SENATOR_LIST list(WHITELIST_COMMANDER_LEADER, WHITELIST_SYNTHETIC_LEADER, WHITELIST_YAUTJA_LEADER)
+#define isCouncil(A) (A.check_whitelist_status_list(COUNCIL_LIST))
+#define isSenator(A) (A.check_whitelist_status_list(SENATOR_LIST))
GLOBAL_LIST_INIT_TYPED(whitelist_permissions, /list, list(
WHITELIST_SYNTHETIC_LEADER = list(WHITELIST_SYNTHETIC_COUNCIL, WHITELIST_SYNTHETIC_COUNCIL_LEGACY, WHITELIST_SYNTHETIC),
@@ -204,6 +207,7 @@ DEFINE_BITFIELD(whitelist_status, list(
"WHITELIST_COMMANDER" = WHITELIST_COMMANDER,
"WHITELIST_COMMANDER_COUNCIL" = WHITELIST_COMMANDER_COUNCIL,
"WHITELIST_COMMANDER_COUNCIL_LEGACY" = WHITELIST_COMMANDER_COUNCIL_LEGACY,
+ "WHITELIST_COMMANDER_LEADER" = WHITELIST_COMMANDER_LEADER,
"WHITELIST_JOE" = WHITELIST_JOE,
"WHITELIST_SYNTHETIC" = WHITELIST_SYNTHETIC,
"WHITELIST_SYNTHETIC_COUNCIL" = WHITELIST_SYNTHETIC_COUNCIL,
diff --git a/code/game/jobs/whitelist.dm b/code/game/jobs/whitelist.dm
index 7de67a19b332..96f0a379c2c5 100644
--- a/code/game/jobs/whitelist.dm
+++ b/code/game/jobs/whitelist.dm
@@ -28,8 +28,8 @@ GLOBAL_LIST_FILE_LOAD(whitelist, WHITELISTFILE)
if(player.check_whitelist_status(WHITELIST_SYNTHETIC))
LAZYADD(., "synthetic")
-/client/proc/whitelist_panel()
- set name = "Whitelist Panel"
+/client/proc/whitelist_panel_backup()
+ set name = "Whitelist Panel (Backup)"
set category = "Admin.Panels"
var/data = "Whitelists: Add Whitelist "
@@ -46,20 +46,14 @@ GLOBAL_LIST_FILE_LOAD(whitelist, WHITELISTFILE)
/client/load_player_data_info(datum/entity/player/player)
. = ..()
- if(WHITELISTS_LEADER & player.whitelist_flags)
+ if(isSenator(src))
add_verb(src, /client/proc/whitelist_panel)
-/client/proc/whitelist_panel_tgui()
- set name = "Whitelist TGUI Panel"
+/client/proc/whitelist_panel()
+ set name = "Whitelist Panel"
set category = "Admin.Panels"
- if(!SSticker.mode)
- to_chat(usr, SPAN_WARNING("The round has not started yet."))
- return FALSE
GLOB.WhitelistPanel.tgui_interact(mob)
- var/mob/user = usr
- var/log = "[key_name(user)] opened the Whitelist Panel."
- message_admins(log)
GLOBAL_DATUM_INIT(WhitelistPanel, /datum/whitelist_panel, new)
@@ -68,6 +62,7 @@ GLOBAL_DATUM_INIT(WhitelistPanel, /datum/whitelist_panel, new)
#define WL_PANEL_RIGHT_YAUTJA (1<<2)
#define WL_PANEL_RIGHT_MENTOR (1<<3)
#define WL_PANEL_RIGHT_OVERSEER (1<<4)
+#define WL_PANEL_ALL_COUNCILS (WL_PANEL_RIGHT_CO|WL_PANEL_RIGHT_SYNTH|WL_PANEL_RIGHT_YAUTJA)
#define WL_PANEL_ALL_RIGHTS (WL_PANEL_RIGHT_CO|WL_PANEL_RIGHT_SYNTH|WL_PANEL_RIGHT_YAUTJA|WL_PANEL_RIGHT_MENTOR|WL_PANEL_RIGHT_OVERSEER)
/datum/whitelist_panel
@@ -82,7 +77,7 @@ GLOBAL_DATUM_INIT(WhitelistPanel, /datum/whitelist_panel, new)
if(!user.client)
return
var/client/person = user.client
- if(CLIENT_HAS_RIGHTS(person, R_PERMISSIONS) || person.check_whitelist_status(WHITELISTS_LEADER))
+ if(CLIENT_HAS_RIGHTS(person, R_PERMISSIONS))
return WL_PANEL_ALL_RIGHTS
var/rights
if(person.check_whitelist_status(WHITELIST_COMMANDER_LEADER))
@@ -91,6 +86,8 @@ GLOBAL_DATUM_INIT(WhitelistPanel, /datum/whitelist_panel, new)
rights |= WL_PANEL_RIGHT_SYNTH
if(person.check_whitelist_status(WHITELIST_YAUTJA_LEADER))
rights |= WL_PANEL_RIGHT_YAUTJA
+ if(rights == WL_PANEL_ALL_COUNCILS)
+ return WL_PANEL_ALL_RIGHTS
return rights
/datum/whitelist_panel/tgui_interact(mob/user, datum/tgui/ui)
@@ -140,7 +137,7 @@ GLOBAL_LIST_INIT(co_flags, list(
list(name = "CO Senator", bitflag = WHITELIST_COMMANDER_LEADER, permission = WL_PANEL_RIGHT_OVERSEER)
))
GLOBAL_LIST_INIT(syn_flags, list(
- list(name = "Synethetic", bitflag = WHITELIST_SYNTHETIC, permission = WL_PANEL_RIGHT_SYNTH),
+ list(name = "Synthetic", bitflag = WHITELIST_SYNTHETIC, permission = WL_PANEL_RIGHT_SYNTH),
list(name = "Synthetic Council", bitflag = WHITELIST_SYNTHETIC_COUNCIL, permission = WL_PANEL_RIGHT_SYNTH),
list(name = "Legacy Synthetic Council", bitflag = WHITELIST_SYNTHETIC_COUNCIL_LEGACY, permission = WL_PANEL_RIGHT_SYNTH),
list(name = "Synthetic Senator", bitflag = WHITELIST_SYNTHETIC_LEADER, permission = WL_PANEL_RIGHT_OVERSEER)
@@ -169,6 +166,9 @@ GLOBAL_LIST_INIT(misc_flags, list(
if(.)
return
var/mob/user = usr
+ if(used_by && (used_by != user.ckey))
+ to_chat(user, SPAN_ALERTWARNING("You are not the current user. [used_by] is editing this player."))
+ return
switch(action)
if("go_back")
if(used_by)
@@ -179,23 +179,10 @@ GLOBAL_LIST_INIT(misc_flags, list(
target_rights = 0
new_rights = 0
if("select_player")
- if(used_by && (used_by != user.ckey))
- to_chat(user, SPAN_ALERTWARNING("Panel already in use by [used_by]"))
- var/override_option = tgui_alert(user, "The Whitelist Panel is in use by [used_by]. Do you want to override?", "Use Panel", list("Override", "Cancel"))
- if(override_option != "Override")
- return
-
- var/datum/entity/player/player = get_player_from_key(params["player"])
- var/list/current_player = list()
- current_player["ckey"] = params["player"]
- current_player["status"] = player.whitelist_status
-
- target_rights = player.whitelist_flags
- new_rights = player.whitelist_flags
- viewed_player = current_player
- current_menu = "Update"
- user_rights = get_user_rights(user)
- used_by = user.ckey
+ select_player(user, params["player"])
+ return
+ if("add_player")
+ select_player(user, TRUE)
return
if("update_number")
new_rights = text2num(params["wl_flag"])
@@ -213,6 +200,37 @@ GLOBAL_LIST_INIT(misc_flags, list(
target_rights = player2.whitelist_flags
return
+/datum/whitelist_panel/proc/select_player(mob/user, player_key)
+ var/target_key = player_key
+ if(IsAdminAdvancedProcCall())
+ return PROC_BLOCKED
+ if(!target_key)
+ return FALSE
+
+ if(used_by && (used_by != user.ckey))
+ to_chat(user, SPAN_ALERTWARNING("Panel already in use by [used_by]"))
+ var/override_option = tgui_alert(user, "The Whitelist Panel is in use by [used_by]. Do you want to override?", "Use Panel", list("Override", "Cancel"))
+ if(override_option != "Override")
+ return FALSE
+
+ if(target_key == TRUE)
+ var/new_player = tgui_input_text(user, "Enter the new ckey you wish to add. Do not include spaces or special characters.", "New Whitelistee")
+ if(!new_player)
+ return FALSE
+ target_key = new_player
+
+ var/datum/entity/player/player = get_player_from_key(target_key)
+ var/list/current_player = list()
+ current_player["ckey"] = target_key
+ current_player["status"] = player.whitelist_status
+
+ target_rights = player.whitelist_flags
+ new_rights = player.whitelist_flags
+ viewed_player = current_player
+ current_menu = "Update"
+ user_rights = get_user_rights(user)
+ used_by = user.ckey
+ return
#undef WHITELISTFILE
#undef WL_PANEL_RIGHT_CO
diff --git a/code/modules/admin/admin_verbs.dm b/code/modules/admin/admin_verbs.dm
index c285fc8ea56d..a5d100cad78b 100644
--- a/code/modules/admin/admin_verbs.dm
+++ b/code/modules/admin/admin_verbs.dm
@@ -244,7 +244,7 @@ GLOBAL_LIST_INIT(admin_verbs_possess, list(
GLOBAL_LIST_INIT(admin_verbs_permissions, list(
/client/proc/ToRban,
/client/proc/whitelist_panel,
- /client/proc/whitelist_panel_tgui,
+ /client/proc/whitelist_panel_backup,
))
GLOBAL_LIST_INIT(admin_verbs_color, list(
@@ -346,6 +346,8 @@ GLOBAL_LIST_INIT(roundstart_mod_verbs, list(
add_verb(src, GLOB.admin_verbs_sounds)
if(CLIENT_HAS_RIGHTS(src, R_SPAWN))
add_verb(src, GLOB.admin_verbs_spawn)
+ if(CLIENT_HAS_RIGHTS(src, R_STEALTH))
+ add_verb(src, GLOB.admin_verbs_stealth)
if(check_whitelist_status(WHITELIST_YAUTJA_LEADER))
add_verb(src, GLOB.clan_verbs)
diff --git a/code/modules/client/client_procs.dm b/code/modules/client/client_procs.dm
index 8d79d0e9c0b5..22d453398ca9 100644
--- a/code/modules/client/client_procs.dm
+++ b/code/modules/client/client_procs.dm
@@ -241,6 +241,8 @@ GLOBAL_LIST_INIT(whitelisted_client_procs, list(
can_edit = null
var/flags = input_bitfield(usr, "Select Flags", "whitelist_status", player.whitelist_flags, allowed_edit_list = can_edit)
+
+ message_admins("Whitelists for [target_ckey] updated by [key_name(usr)] via backup panel.")
player.set_whitelist_status(flags)
switch(href_list["_src_"])
@@ -884,6 +886,16 @@ GLOBAL_LIST_INIT(whitelisted_client_procs, list(
return player_data.check_whitelist_status(flag_to_check)
+/client/proc/check_whitelist_status_list(flags_to_check)
+ var/success = FALSE
+ if(!player_data)
+ load_player_data()
+ for(var/bitfield in flags_to_check)
+ success = player_data.check_whitelist_status(bitfield)
+ if(success)
+ break
+ return success
+
/client/proc/check_localhost_status()
if(CONFIG_GET(flag/no_localhost_rank))
return FALSE
diff --git a/tgui/packages/tgui/interfaces/WhitelistPanel.jsx b/tgui/packages/tgui/interfaces/WhitelistPanel.jsx
index 8c6f5d650843..506c70afe24d 100644
--- a/tgui/packages/tgui/interfaces/WhitelistPanel.jsx
+++ b/tgui/packages/tgui/interfaces/WhitelistPanel.jsx
@@ -7,22 +7,13 @@ const PAGES = {
'Update': () => StatusUpdate,
};
-const hasPermission = (data, action) => {
- if (!(action in data.glob_pp_actions)) return false;
-
- const action_data = data.glob_pp_actions[action];
- return !!(action_data.permissions_required & data.current_permissions);
-};
-
export const WhitelistPanel = (props, context) => {
const { data } = useBackend(context);
const { current_menu } = data;
const PageComponent = PAGES[current_menu]();
- let themecolor = 'crtblue';
-
return (
-
+
@@ -32,7 +23,7 @@ export const WhitelistPanel = (props, context) => {
const PlayerList = (props, context) => {
const { data, act } = useBackend(context);
- const { last_page, current_menu, whitelisted_players } = data;
+ const { whitelisted_players } = data;
return (
@@ -44,7 +35,13 @@ const PlayerList = (props, context) => {
p=".75rem"
align="center"
fontSize="1.25rem">
-
+
+ act('add_player')}
+ />
+
CKey
From f39cffc1aeefe1742e9e73bcb09615c1d740044c Mon Sep 17 00:00:00 2001
From: forest2001
Date: Mon, 8 Jan 2024 03:15:08 +0000
Subject: [PATCH 11/27] feedback message
---
code/game/jobs/whitelist.dm | 1 +
1 file changed, 1 insertion(+)
diff --git a/code/game/jobs/whitelist.dm b/code/game/jobs/whitelist.dm
index 96f0a379c2c5..9455e63e8b30 100644
--- a/code/game/jobs/whitelist.dm
+++ b/code/game/jobs/whitelist.dm
@@ -194,6 +194,7 @@ GLOBAL_LIST_INIT(misc_flags, list(
return
var/datum/entity/player/player = get_player_from_key(player_key)
player.set_whitelist_status(new_rights)
+ to_chat(user, SPAN_HELPFUL("Whitelists for [player_key] updated."))
message_admins("Whitelists for [player_key] updated by [key_name(user)]. Reason: '[reason]'.")
log_admin("WHITELISTS: Flags for [player_key] changed from [target_rights] to [new_rights]. Reason: '[reason]'.")
var/datum/entity/player/player2 = get_player_from_key(player_key)
From 364d9b3fd654d0f35026eb127f7caee410c5f51a Mon Sep 17 00:00:00 2001
From: forest2001
Date: Mon, 8 Jan 2024 03:32:38 +0000
Subject: [PATCH 12/27] edit lock
time for bed
---
code/game/jobs/whitelist.dm | 3 +++
1 file changed, 3 insertions(+)
diff --git a/code/game/jobs/whitelist.dm b/code/game/jobs/whitelist.dm
index 9455e63e8b30..dfa40b641f02 100644
--- a/code/game/jobs/whitelist.dm
+++ b/code/game/jobs/whitelist.dm
@@ -109,6 +109,9 @@ GLOBAL_DATUM_INIT(WhitelistPanel, /datum/whitelist_panel, new)
target_rights = 0
new_rights = 0
+/datum/whitelist_panel/vv_edit_var(var_name, var_value)
+ return FALSE
+
/datum/whitelist_panel/ui_data(mob/user)
var/list/data = list()
From 5150a81f57cd738e1268931b19a28866d7bda094 Mon Sep 17 00:00:00 2001
From: forest2001
Date: Tue, 9 Jan 2024 15:50:04 +0000
Subject: [PATCH 13/27] changes
---
code/__DEFINES/mode.dm | 24 ++---
code/game/jobs/job/command/cic/captain.dm | 2 +-
code/game/jobs/whitelist.dm | 91 ++++++++-----------
code/modules/admin/admin_verbs.dm | 1 -
code/modules/admin/banjob.dm | 2 -
code/modules/client/client_procs.dm | 24 -----
code/modules/client/preferences.dm | 2 +-
.../tgui/interfaces/WhitelistPanel.jsx | 35 ++++---
8 files changed, 74 insertions(+), 107 deletions(-)
diff --git a/code/__DEFINES/mode.dm b/code/__DEFINES/mode.dm
index a2691b6bb312..2b018c0a2810 100644
--- a/code/__DEFINES/mode.dm
+++ b/code/__DEFINES/mode.dm
@@ -171,15 +171,20 @@ GLOBAL_LIST_INIT(whitelist_hierarchy, list(WHITELIST_NORMAL, WHITELIST_COUNCIL,
///Old holders of COMMANDER_COUNCIL for 3 months
#define WHITELIST_COMMANDER_COUNCIL_LEGACY (1<<7)
#define WHITELIST_COMMANDER_LEADER (1<<8)
+///Former CO senator/whitelist overseer award
+#define WHITELIST_COMMANDER_COLONEL (1<<9)
-#define WHITELIST_JOE (1<<9)
-#define WHITELIST_SYNTHETIC (1<<10)
-#define WHITELIST_SYNTHETIC_COUNCIL (1<<11)
+#define WHITELIST_JOE (1<<10)
+#define WHITELIST_SYNTHETIC (1<<11)
+#define WHITELIST_SYNTHETIC_COUNCIL (1<<12)
///Old holders of SYNTHETIC_COUNCIL for 3 months
-#define WHITELIST_SYNTHETIC_COUNCIL_LEGACY (1<<12)
-#define WHITELIST_SYNTHETIC_LEADER (1<<13)
+#define WHITELIST_SYNTHETIC_COUNCIL_LEGACY (1<<13)
+#define WHITELIST_SYNTHETIC_LEADER (1<<14)
+
+///Senior Enlisted Advisor, auto granted by R_MENTOR
+#define WHITELIST_MENTOR (1<<15)
+
-#define WHITELIST_MENTOR (1<<14)
#define WHITELISTS_GENERAL (WHITELIST_YAUTJA|WHITELIST_COMMANDER|WHITELIST_SYNTHETIC|WHITELIST_MENTOR|WHITELIST_JOE)
#define WHITELISTS_COUNCIL (WHITELIST_YAUTJA_COUNCIL|WHITELIST_COMMANDER_COUNCIL|WHITELIST_SYNTHETIC_COUNCIL)
#define WHITELISTS_LEGACY_COUNCIL (WHITELIST_YAUTJA_COUNCIL_LEGACY|WHITELIST_COMMANDER_COUNCIL_LEGACY|WHITELIST_SYNTHETIC_COUNCIL_LEGACY)
@@ -192,12 +197,6 @@ GLOBAL_LIST_INIT(whitelist_hierarchy, list(WHITELIST_NORMAL, WHITELIST_COUNCIL,
#define isCouncil(A) (A.check_whitelist_status_list(COUNCIL_LIST))
#define isSenator(A) (A.check_whitelist_status_list(SENATOR_LIST))
-GLOBAL_LIST_INIT_TYPED(whitelist_permissions, /list, list(
- WHITELIST_SYNTHETIC_LEADER = list(WHITELIST_SYNTHETIC_COUNCIL, WHITELIST_SYNTHETIC_COUNCIL_LEGACY, WHITELIST_SYNTHETIC),
- WHITELIST_YAUTJA_LEADER = list(WHITELIST_YAUTJA_COUNCIL, WHITELIST_YAUTJA_COUNCIL_LEGACY, WHITELIST_YAUTJA),
- WHITELIST_COMMANDER_LEADER = list(WHITELIST_COMMANDER_COUNCIL, WHITELIST_COMMANDER_COUNCIL_LEGACY, WHITELIST_COMMANDER),
- ))
-
DEFINE_BITFIELD(whitelist_status, list(
"WHITELIST_YAUTJA" = WHITELIST_YAUTJA,
"WHITELIST_YAUTJA_LEGACY" = WHITELIST_YAUTJA_LEGACY,
@@ -207,6 +206,7 @@ DEFINE_BITFIELD(whitelist_status, list(
"WHITELIST_COMMANDER" = WHITELIST_COMMANDER,
"WHITELIST_COMMANDER_COUNCIL" = WHITELIST_COMMANDER_COUNCIL,
"WHITELIST_COMMANDER_COUNCIL_LEGACY" = WHITELIST_COMMANDER_COUNCIL_LEGACY,
+ "WHITELIST_COMMANDER_COLONEL" = WHITELIST_COMMANDER_COLONEL,
"WHITELIST_COMMANDER_LEADER" = WHITELIST_COMMANDER_LEADER,
"WHITELIST_JOE" = WHITELIST_JOE,
"WHITELIST_SYNTHETIC" = WHITELIST_SYNTHETIC,
diff --git a/code/game/jobs/job/command/cic/captain.dm b/code/game/jobs/job/command/cic/captain.dm
index 9f3f5d06bebd..30fa455beeee 100644
--- a/code/game/jobs/job/command/cic/captain.dm
+++ b/code/game/jobs/job/command/cic/captain.dm
@@ -24,7 +24,7 @@
if(!.)
return
- if(player.check_whitelist_status(WHITELIST_COMMANDER_LEADER))
+ if(player.check_whitelist_status(WHITELIST_COMMANDER_LEADER|WHITELIST_COMMANDER_COLONEL))
return get_desired_status(player.prefs.commander_status, WHITELIST_LEADER)
if(player.check_whitelist_status(WHITELIST_COMMANDER_COUNCIL|WHITELIST_COMMANDER_COUNCIL_LEGACY))
return get_desired_status(player.prefs.commander_status, WHITELIST_COUNCIL)
diff --git a/code/game/jobs/whitelist.dm b/code/game/jobs/whitelist.dm
index dfa40b641f02..fcd5ee094c09 100644
--- a/code/game/jobs/whitelist.dm
+++ b/code/game/jobs/whitelist.dm
@@ -1,12 +1,3 @@
-#define WHITELISTFILE "data/whitelist.txt"
-
-GLOBAL_LIST_FILE_LOAD(whitelist, WHITELISTFILE)
-
-/proc/check_whitelist(mob/M /*, rank*/)
- if(!CONFIG_GET(flag/usewhitelist) || !GLOB.whitelist)
- return 0
- return ("[M.ckey]" in GLOB.whitelist)
-
/proc/can_play_special_job(client/client, job)
if(client.admin_holder && (client.admin_holder.rights & R_ADMIN))
return TRUE
@@ -28,21 +19,6 @@ GLOBAL_LIST_FILE_LOAD(whitelist, WHITELISTFILE)
if(player.check_whitelist_status(WHITELIST_SYNTHETIC))
LAZYADD(., "synthetic")
-/client/proc/whitelist_panel_backup()
- set name = "Whitelist Panel (Backup)"
- set category = "Admin.Panels"
-
- var/data = "Whitelists: Add Whitelist "
-
- var/list/datum/view_record/players/players_view = DB_VIEW(/datum/view_record/players, DB_COMP("whitelist_status", DB_NOTEQUAL, ""))
-
- for(var/datum/view_record/players/whitelistee in players_view)
- data += " (CHANGE) Key: [whitelistee.ckey] Whitelists: [whitelistee.whitelist_status] "
-
- data += "
"
-
- show_browser(usr, data, "Whitelist Panel", "whitelist_panel", "size=857x400")
-
/client/load_player_data_info(datum/entity/player/player)
. = ..()
@@ -121,36 +97,27 @@ GLOBAL_DATUM_INIT(WhitelistPanel, /datum/whitelist_panel, new)
data["target_rights"] = target_rights
data["new_rights"] = new_rights
- var/list/datum/view_record/players/players_view = DB_VIEW(/datum/view_record/players, DB_COMP("whitelist_status", DB_NOTEQUAL, ""))
-
- var/list/whitelisted_players = list()
- for(var/datum/view_record/players/whitelistee in players_view)
- var/list/current_player = list()
- current_player["ckey"] = whitelistee.ckey
- current_player["status"] = whitelistee.whitelist_status
- whitelisted_players += list(current_player)
- data["whitelisted_players"] = whitelisted_players
-
return data
GLOBAL_LIST_INIT(co_flags, list(
list(name = "Commander", bitflag = WHITELIST_COMMANDER, permission = WL_PANEL_RIGHT_CO),
- list(name = "CO Council", bitflag = WHITELIST_COMMANDER_COUNCIL, permission = WL_PANEL_RIGHT_CO),
- list(name = "Legacy CO Council", bitflag = WHITELIST_COMMANDER_COUNCIL_LEGACY, permission = WL_PANEL_RIGHT_CO),
- list(name = "CO Senator", bitflag = WHITELIST_COMMANDER_LEADER, permission = WL_PANEL_RIGHT_OVERSEER)
+ list(name = "Council", bitflag = WHITELIST_COMMANDER_COUNCIL, permission = WL_PANEL_RIGHT_CO),
+ list(name = "Legacy Council", bitflag = WHITELIST_COMMANDER_COUNCIL_LEGACY, permission = WL_PANEL_RIGHT_CO),
+ list(name = "Senator", bitflag = WHITELIST_COMMANDER_LEADER, permission = WL_PANEL_RIGHT_OVERSEER),
+ list(name = "Colonel", bitflag = WHITELIST_COMMANDER_COLONEL, permission = WL_PANEL_RIGHT_OVERSEER)
))
GLOBAL_LIST_INIT(syn_flags, list(
list(name = "Synthetic", bitflag = WHITELIST_SYNTHETIC, permission = WL_PANEL_RIGHT_SYNTH),
- list(name = "Synthetic Council", bitflag = WHITELIST_SYNTHETIC_COUNCIL, permission = WL_PANEL_RIGHT_SYNTH),
- list(name = "Legacy Synthetic Council", bitflag = WHITELIST_SYNTHETIC_COUNCIL_LEGACY, permission = WL_PANEL_RIGHT_SYNTH),
- list(name = "Synthetic Senator", bitflag = WHITELIST_SYNTHETIC_LEADER, permission = WL_PANEL_RIGHT_OVERSEER)
+ list(name = "Council", bitflag = WHITELIST_SYNTHETIC_COUNCIL, permission = WL_PANEL_RIGHT_SYNTH),
+ list(name = "Legacy Council", bitflag = WHITELIST_SYNTHETIC_COUNCIL_LEGACY, permission = WL_PANEL_RIGHT_SYNTH),
+ list(name = "Senator", bitflag = WHITELIST_SYNTHETIC_LEADER, permission = WL_PANEL_RIGHT_OVERSEER)
))
GLOBAL_LIST_INIT(yaut_flags, list(
list(name = "Yautja", bitflag = WHITELIST_YAUTJA, permission = WL_PANEL_RIGHT_YAUTJA),
- list(name = "Legacy Yautja", bitflag = WHITELIST_YAUTJA_LEGACY, permission = WL_PANEL_RIGHT_OVERSEER),
- list(name = "Yautja Council", bitflag = WHITELIST_YAUTJA_COUNCIL, permission = WL_PANEL_RIGHT_YAUTJA),
- list(name = "Legacy Yautja Council", bitflag = WHITELIST_YAUTJA_COUNCIL_LEGACY, permission = WL_PANEL_RIGHT_YAUTJA),
- list(name = "Yautja Senator", bitflag = WHITELIST_YAUTJA_LEADER, permission = WL_PANEL_RIGHT_OVERSEER)
+ list(name = "Legacy Holder", bitflag = WHITELIST_YAUTJA_LEGACY, permission = WL_PANEL_RIGHT_OVERSEER),
+ list(name = "Council", bitflag = WHITELIST_YAUTJA_COUNCIL, permission = WL_PANEL_RIGHT_YAUTJA),
+ list(name = "Legacy Council", bitflag = WHITELIST_YAUTJA_COUNCIL_LEGACY, permission = WL_PANEL_RIGHT_YAUTJA),
+ list(name = "Senator", bitflag = WHITELIST_YAUTJA_LEADER, permission = WL_PANEL_RIGHT_OVERSEER)
))
GLOBAL_LIST_INIT(misc_flags, list(
list(name = "Senior Enlisted Advisor", bitflag = WHITELIST_MENTOR, permission = WL_PANEL_RIGHT_MENTOR),
@@ -164,6 +131,16 @@ GLOBAL_LIST_INIT(misc_flags, list(
.["yaut_flags"] = GLOB.yaut_flags
.["misc_flags"] = GLOB.misc_flags
+ var/list/datum/view_record/players/players_view = DB_VIEW(/datum/view_record/players, DB_COMP("whitelist_status", DB_NOTEQUAL, ""))
+
+ var/list/whitelisted_players = list()
+ for(var/datum/view_record/players/whitelistee in players_view)
+ var/list/current_player = list()
+ current_player["ckey"] = whitelistee.ckey
+ current_player["status"] = whitelistee.whitelist_status
+ whitelisted_players += list(current_player)
+ .["whitelisted_players"] = whitelisted_players
+
/datum/whitelist_panel/ui_act(action, list/params, datum/tgui/ui, datum/ui_state/state)
. = ..()
if(.)
@@ -174,13 +151,7 @@ GLOBAL_LIST_INIT(misc_flags, list(
return
switch(action)
if("go_back")
- if(used_by)
- used_by = null
- viewed_player = list()
- user_rights = 0
- current_menu = "Panel"
- target_rights = 0
- new_rights = 0
+ go_back()
if("select_player")
select_player(user, params["player"])
return
@@ -200,9 +171,12 @@ GLOBAL_LIST_INIT(misc_flags, list(
to_chat(user, SPAN_HELPFUL("Whitelists for [player_key] updated."))
message_admins("Whitelists for [player_key] updated by [key_name(user)]. Reason: '[reason]'.")
log_admin("WHITELISTS: Flags for [player_key] changed from [target_rights] to [new_rights]. Reason: '[reason]'.")
- var/datum/entity/player/player2 = get_player_from_key(player_key)
- target_rights = player2.whitelist_flags
+ update_static_data(user, ui)
+ go_back()
return
+ if("refresh_data")
+ update_static_data(user, ui)
+ to_chat(user, SPAN_NOTICE("Whitelist data refreshed."))
/datum/whitelist_panel/proc/select_player(mob/user, player_key)
var/target_key = player_key
@@ -236,7 +210,16 @@ GLOBAL_LIST_INIT(misc_flags, list(
used_by = user.ckey
return
-#undef WHITELISTFILE
+/datum/whitelist_panel/proc/go_back()
+ if(used_by)
+ used_by = null
+ viewed_player = list()
+ user_rights = 0
+ current_menu = "Panel"
+ target_rights = 0
+ new_rights = 0
+
+
#undef WL_PANEL_RIGHT_CO
#undef WL_PANEL_RIGHT_SYNTH
#undef WL_PANEL_RIGHT_YAUTJA
diff --git a/code/modules/admin/admin_verbs.dm b/code/modules/admin/admin_verbs.dm
index a5d100cad78b..56002d139599 100644
--- a/code/modules/admin/admin_verbs.dm
+++ b/code/modules/admin/admin_verbs.dm
@@ -244,7 +244,6 @@ GLOBAL_LIST_INIT(admin_verbs_possess, list(
GLOBAL_LIST_INIT(admin_verbs_permissions, list(
/client/proc/ToRban,
/client/proc/whitelist_panel,
- /client/proc/whitelist_panel_backup,
))
GLOBAL_LIST_INIT(admin_verbs_color, list(
diff --git a/code/modules/admin/banjob.dm b/code/modules/admin/banjob.dm
index 13c3b4664a15..dd6516b2ede3 100644
--- a/code/modules/admin/banjob.dm
+++ b/code/modules/admin/banjob.dm
@@ -42,8 +42,6 @@ GLOBAL_LIST_EMPTY(jobban_keylist)
if(guest_jobbans(rank))
if(CONFIG_GET(flag/guest_jobban) && IsGuestKey(M.key))
return "Guest Job-ban"
- if(CONFIG_GET(flag/usewhitelist) && !check_whitelist(M))
- return "Whitelisted Job"
var/datum/entity/player_job_ban/PJB = M.client.player_data.job_bans[rank]
return PJB ? PJB.text : null
diff --git a/code/modules/client/client_procs.dm b/code/modules/client/client_procs.dm
index 22d453398ca9..1d2aa0a382bc 100644
--- a/code/modules/client/client_procs.dm
+++ b/code/modules/client/client_procs.dm
@@ -221,30 +221,6 @@ GLOBAL_LIST_INIT(whitelisted_client_procs, list(
var/datum/entity/player/P = get_player_from_key(key)
P.remove_note(index)
- if(href_list["change_whitelist"])
- if(!CLIENT_HAS_RIGHTS(src, R_PERMISSIONS) && !check_whitelist_status(WHITELISTS_LEADER))
- return
-
- var/target_ckey = href_list["change_whitelist"]
- if(target_ckey == "[TRUE]")
- target_ckey = ckey(tgui_input_text(usr, "Which CKEY do you want to edit?", "Select CKEY"))
-
- if(!target_ckey || target_ckey == TRUE)
- return
-
- var/datum/entity/player/player = get_player_from_key(ckey)
- var/can_edit = list()
- for(var/bitfield in GLOB.whitelist_permissions)
- if(player.whitelist_flags & bitfield)
- can_edit += GLOB.whitelist_permissions[bitfield]
- if(!length(can_edit))
- can_edit = null
-
- var/flags = input_bitfield(usr, "Select Flags", "whitelist_status", player.whitelist_flags, allowed_edit_list = can_edit)
-
- message_admins("Whitelists for [target_ckey] updated by [key_name(usr)] via backup panel.")
- player.set_whitelist_status(flags)
-
switch(href_list["_src_"])
if("admin_holder")
hsrc = admin_holder
diff --git a/code/modules/client/preferences.dm b/code/modules/client/preferences.dm
index f9b0960ff6fd..db65616f95a5 100644
--- a/code/modules/client/preferences.dm
+++ b/code/modules/client/preferences.dm
@@ -1328,7 +1328,7 @@ GLOBAL_LIST_INIT(bgstate_options, list(
if(whitelist_flags & (WHITELIST_COMMANDER_COUNCIL|WHITELIST_COMMANDER_COUNCIL_LEGACY))
options += list("Council" = WHITELIST_COUNCIL)
- if(whitelist_flags & WHITELIST_COMMANDER_LEADER)
+ if(whitelist_flags & WHITELIST_COMMANDER_LEADER|WHITELIST_COMMANDER_COLONEL)
options += list("Leader" = WHITELIST_LEADER)
var/new_commander_status = tgui_input_list(user, "Choose your new Commander Whitelist Status.", "Commander Status", options)
diff --git a/tgui/packages/tgui/interfaces/WhitelistPanel.jsx b/tgui/packages/tgui/interfaces/WhitelistPanel.jsx
index 506c70afe24d..2c25bb09acf4 100644
--- a/tgui/packages/tgui/interfaces/WhitelistPanel.jsx
+++ b/tgui/packages/tgui/interfaces/WhitelistPanel.jsx
@@ -27,25 +27,36 @@ const PlayerList = (props, context) => {
return (
- Whitelist Panel
-
+
+
+ act('add_player')}
+ />
+
+
+ act('refresh_data')}
+ />
+
+
+ Whitelist Panel
+
+
{!!whitelisted_players.length && (
-
- act('add_player')}
- />
-
-
+
CKey
-
+
Status
@@ -260,7 +271,7 @@ const StatusUpdate = (props, context) => {
Date: Tue, 9 Jan 2024 15:51:01 +0000
Subject: [PATCH 14/27] todo comment
---
code/game/jobs/role_authority.dm | 53 --------------------------------
1 file changed, 53 deletions(-)
diff --git a/code/game/jobs/role_authority.dm b/code/game/jobs/role_authority.dm
index b8079e87ddc3..c24696f0355c 100644
--- a/code/game/jobs/role_authority.dm
+++ b/code/game/jobs/role_authority.dm
@@ -115,59 +115,6 @@ GLOBAL_VAR_INIT(players_preassigned, 0)
squads += S
squads_by_type[S.type] = S
-/* TODO: delete this
-
- load_whitelist()
-
-/datum/authority/branch/role/proc/load_whitelist(filename = "config/role_whitelist.txt")
- var/L[] = file2list(filename)
- var/P[]
- var/W[] = new //We want a temporary whitelist list, in case we need to reload.
-
- var/i
- var/r
- var/ckey
- var/role
- roles_whitelist = list()
- for(i in L)
- if(!i) continue
- i = trim(i)
- if(!length(i)) continue
- else if (copytext(i, 1, 2) == "#") continue
-
- P = splittext(i, "+")
- if(!P.len) continue
- ckey = ckey(P[1]) //Converting their key to canonical form. ckey() does this by stripping all spaces, underscores and converting to lower case.
-
- role = NO_FLAGS
- r = 1
- while(++r <= P.len)
- switch(ckey(P[r]))
- if("yautja") role |= WHITELIST_YAUTJA
- if("yautjalegacy") role |= WHITELIST_YAUTJA_LEGACY
- if("yautjacouncil") role |= WHITELIST_YAUTJA_COUNCIL
- if("yautjacouncillegacy") role |= WHITELIST_YAUTJA_COUNCIL_LEGACY
- if("yautjaleader") role |= WHITELIST_YAUTJA_LEADER
- if("commander") role |= WHITELIST_COMMANDER
- if("commandercouncil") role |= WHITELIST_COMMANDER_COUNCIL
- if("commandercouncillegacy") role |= WHITELIST_COMMANDER_COUNCIL_LEGACY
- if("commanderleader") role |= WHITELIST_COMMANDER_LEADER
- if("workingjoe") role |= WHITELIST_JOE
- if("synthetic") role |= (WHITELIST_SYNTHETIC|WHITELIST_JOE)
- if("syntheticcouncil") role |= WHITELIST_SYNTHETIC_COUNCIL
- if("syntheticcouncillegacy") role |= WHITELIST_SYNTHETIC_COUNCIL_LEGACY
- if("syntheticleader") role |= WHITELIST_SYNTHETIC_LEADER
- if("advisor") role |= WHITELIST_MENTOR
- if("allgeneral") role |= WHITELISTS_GENERAL
- if("allcouncil") role |= (WHITELISTS_COUNCIL|WHITELISTS_GENERAL)
- if("alllegacycouncil") role |= (WHITELISTS_LEGACY_COUNCIL|WHITELISTS_GENERAL)
- if("everything", "allleader") role |= WHITELIST_EVERYTHING
-
- W[ckey] = role
-
- roles_whitelist = W
-*/
-
//#undef FACTION_TO_JOIN
/*
From 2a8fe767455a2f7deea774972f13f74766c7b5e2 Mon Sep 17 00:00:00 2001
From: forest2001
Date: Tue, 9 Jan 2024 16:11:36 +0000
Subject: [PATCH 15/27] readable status
---
code/game/jobs/whitelist.dm | 4 +++-
tgui/packages/tgui/interfaces/WhitelistPanel.jsx | 8 ++++----
2 files changed, 7 insertions(+), 5 deletions(-)
diff --git a/code/game/jobs/whitelist.dm b/code/game/jobs/whitelist.dm
index fcd5ee094c09..7395a699b255 100644
--- a/code/game/jobs/whitelist.dm
+++ b/code/game/jobs/whitelist.dm
@@ -137,7 +137,9 @@ GLOBAL_LIST_INIT(misc_flags, list(
for(var/datum/view_record/players/whitelistee in players_view)
var/list/current_player = list()
current_player["ckey"] = whitelistee.ckey
- current_player["status"] = whitelistee.whitelist_status
+ var/list/unreadable_list = splittext(whitelistee.whitelist_status, "|")
+ var/readable_list = unreadable_list.Join(" | ")
+ current_player["status"] = readable_list
whitelisted_players += list(current_player)
.["whitelisted_players"] = whitelisted_players
diff --git a/tgui/packages/tgui/interfaces/WhitelistPanel.jsx b/tgui/packages/tgui/interfaces/WhitelistPanel.jsx
index 2c25bb09acf4..cc0ef2e0b871 100644
--- a/tgui/packages/tgui/interfaces/WhitelistPanel.jsx
+++ b/tgui/packages/tgui/interfaces/WhitelistPanel.jsx
@@ -13,7 +13,7 @@ export const WhitelistPanel = (props, context) => {
const PageComponent = PAGES[current_menu]();
return (
-
+
@@ -64,17 +64,17 @@ const PlayerList = (props, context) => {
{whitelisted_players.map((record, i) => {
return (
-
+
act('select_player', { player: record.ckey })}
/>
-
+
{record.ckey}
-
+
{record.status}
From d521efc69d1868b218097165689f81a86218651c Mon Sep 17 00:00:00 2001
From: forest2001
Date: Tue, 9 Jan 2024 16:14:54 +0000
Subject: [PATCH 16/27] ui user
---
code/game/jobs/whitelist.dm | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/code/game/jobs/whitelist.dm b/code/game/jobs/whitelist.dm
index 7395a699b255..0a8cdbed70a1 100644
--- a/code/game/jobs/whitelist.dm
+++ b/code/game/jobs/whitelist.dm
@@ -147,7 +147,7 @@ GLOBAL_LIST_INIT(misc_flags, list(
. = ..()
if(.)
return
- var/mob/user = usr
+ var/mob/user = ui.user
if(used_by && (used_by != user.ckey))
to_chat(user, SPAN_ALERTWARNING("You are not the current user. [used_by] is editing this player."))
return
From 5a9e22575ae1dd4d212f1e703aafa39e425bbad8 Mon Sep 17 00:00:00 2001
From: forest2001
Date: Tue, 9 Jan 2024 17:20:16 +0000
Subject: [PATCH 17/27] runtime catch
---
code/modules/client/client_procs.dm | 2 ++
1 file changed, 2 insertions(+)
diff --git a/code/modules/client/client_procs.dm b/code/modules/client/client_procs.dm
index 1d2aa0a382bc..687458af8261 100644
--- a/code/modules/client/client_procs.dm
+++ b/code/modules/client/client_procs.dm
@@ -859,6 +859,8 @@ GLOBAL_LIST_INIT(whitelisted_client_procs, list(
if(!player_data)
load_player_data()
+ if(!player_data)
+ return FALSE
return player_data.check_whitelist_status(flag_to_check)
From e17609ca40700c22341c446eb991e9adeba136b4 Mon Sep 17 00:00:00 2001
From: harryob
Date: Thu, 18 Jan 2024 16:47:27 +0000
Subject: [PATCH 18/27] why was this here
---
code/modules/client/client_procs.dm | 2 --
1 file changed, 2 deletions(-)
diff --git a/code/modules/client/client_procs.dm b/code/modules/client/client_procs.dm
index 687458af8261..497b0415888f 100644
--- a/code/modules/client/client_procs.dm
+++ b/code/modules/client/client_procs.dm
@@ -878,8 +878,6 @@ GLOBAL_LIST_INIT(whitelisted_client_procs, list(
if(CONFIG_GET(flag/no_localhost_rank))
return FALSE
- deadmin()
-
var/static/list/localhost_addresses = list("127.0.0.1", "::1")
if(isnull(address) || (address in localhost_addresses))
return TRUE
From 3a987cfdfb53a5a3864abdd985f5cd6552a5ae7b Mon Sep 17 00:00:00 2001
From: harryob
Date: Thu, 18 Jan 2024 16:48:25 +0000
Subject: [PATCH 19/27] reverts changes to runtime
---
maps/map_files/USS_Runtime/USS_Runtime.dmm | 298 ---------------------
1 file changed, 298 deletions(-)
diff --git a/maps/map_files/USS_Runtime/USS_Runtime.dmm b/maps/map_files/USS_Runtime/USS_Runtime.dmm
index ccd5bbca9cc3..aec89c5882dd 100644
--- a/maps/map_files/USS_Runtime/USS_Runtime.dmm
+++ b/maps/map_files/USS_Runtime/USS_Runtime.dmm
@@ -25,12 +25,6 @@
icon_state = "plating"
},
/area/event)
-"f" = (
-/turf/closed/wall/almayer,
-/area/almayer/command/cic)
-"g" = (
-/turf/open/space/basic,
-/area/space)
"h" = (
/obj/effect/landmark/start/police,
/turf/open/floor/almayer{
@@ -121,9 +115,6 @@
icon_state = "plating"
},
/area/event)
-"E" = (
-/turf/open/floor,
-/area/almayer/command/cic)
"F" = (
/obj/effect/landmark/start/marine/tl,
/turf/open/floor/almayer{
@@ -491,292 +482,3 @@ a
a
a
"}
-
-(1,1,2) = {"
-g
-g
-g
-g
-g
-g
-g
-g
-g
-g
-g
-g
-g
-g
-g
-g
-"}
-(2,1,2) = {"
-f
-f
-f
-f
-f
-f
-f
-f
-f
-f
-f
-f
-f
-f
-g
-g
-"}
-(3,1,2) = {"
-f
-E
-E
-E
-E
-E
-E
-E
-E
-E
-E
-E
-E
-f
-g
-g
-"}
-(4,1,2) = {"
-f
-E
-E
-E
-E
-E
-E
-E
-E
-E
-E
-E
-E
-f
-g
-g
-"}
-(5,1,2) = {"
-f
-E
-E
-E
-E
-E
-E
-E
-E
-E
-E
-E
-E
-f
-g
-g
-"}
-(6,1,2) = {"
-f
-E
-E
-E
-E
-E
-E
-E
-E
-E
-E
-E
-E
-f
-g
-g
-"}
-(7,1,2) = {"
-f
-E
-E
-E
-E
-E
-E
-E
-E
-E
-E
-E
-E
-f
-g
-g
-"}
-(8,1,2) = {"
-f
-E
-E
-E
-E
-E
-E
-E
-E
-E
-E
-E
-E
-f
-g
-g
-"}
-(9,1,2) = {"
-f
-E
-E
-E
-E
-E
-E
-E
-E
-E
-E
-E
-E
-f
-g
-g
-"}
-(10,1,2) = {"
-f
-E
-E
-E
-E
-E
-E
-E
-E
-E
-E
-E
-E
-f
-g
-g
-"}
-(11,1,2) = {"
-f
-E
-E
-E
-E
-E
-E
-E
-E
-E
-E
-E
-E
-f
-g
-g
-"}
-(12,1,2) = {"
-f
-E
-E
-E
-E
-E
-E
-E
-E
-E
-E
-E
-E
-f
-g
-g
-"}
-(13,1,2) = {"
-f
-E
-E
-E
-E
-E
-E
-E
-E
-E
-E
-E
-E
-f
-g
-g
-"}
-(14,1,2) = {"
-f
-E
-E
-E
-E
-E
-E
-E
-E
-E
-E
-E
-E
-f
-g
-g
-"}
-(15,1,2) = {"
-f
-f
-f
-f
-f
-f
-f
-f
-f
-f
-f
-f
-f
-f
-g
-g
-"}
-(16,1,2) = {"
-g
-g
-g
-g
-g
-g
-g
-g
-g
-g
-g
-g
-g
-g
-g
-g
-"}
From 051ea9803cd19dd450b0983beb2ecac8a84213f0 Mon Sep 17 00:00:00 2001
From: harryob
Date: Thu, 18 Jan 2024 16:51:40 +0000
Subject: [PATCH 20/27] we do some accidental reverting as a treat
---
code/modules/client/client_procs.dm | 30 +++++++++++++++++++++++++++++
1 file changed, 30 insertions(+)
diff --git a/code/modules/client/client_procs.dm b/code/modules/client/client_procs.dm
index 497b0415888f..63c1fafa85cb 100644
--- a/code/modules/client/client_procs.dm
+++ b/code/modules/client/client_procs.dm
@@ -847,6 +847,36 @@ GLOBAL_LIST_INIT(whitelisted_client_procs, list(
return total_t3_playtime
+/client/verb/action_hide_menu()
+ set name = "Show/Hide Actions"
+ set category = "IC"
+
+ var/mob/user = usr
+
+ var/list/actions_list = list()
+ for(var/datum/action/action as anything in user.actions)
+ var/action_name = action.name
+ if(action.player_hidden)
+ action_name += " (Hidden)"
+ actions_list[action_name] += action
+
+ if(!LAZYLEN(actions_list))
+ to_chat(user, SPAN_WARNING("You have no actions available."))
+ return
+
+ var/selected_action_name = tgui_input_list(user, "Show or hide selected action", "Show/Hide Actions", actions_list, 30 SECONDS)
+ if(!selected_action_name)
+ to_chat(user, SPAN_WARNING("You did not select an action."))
+ return
+
+ var/datum/action/selected_action = actions_list[selected_action_name]
+ selected_action.player_hidden = !selected_action.player_hidden
+ user.update_action_buttons()
+
+ if(!selected_action.player_hidden && selected_action.hidden) //Inform the player that even if they are unhiding it, itll still not be visible
+ to_chat(user, SPAN_NOTICE("[selected_action] is forcefully hidden, bypassing player unhiding."))
+
+
/client/proc/check_whitelist_status(flag_to_check)
if(check_localhost_status())
return TRUE
From 7ce402cfceb2a1ce968755ccbf927f5f71f29de8 Mon Sep 17 00:00:00 2001
From: forest2001
Date: Fri, 19 Jan 2024 00:40:31 +0000
Subject: [PATCH 21/27] multi-user
---
code/game/jobs/whitelist.dm | 34 ++++++-------------
.../tgui/interfaces/WhitelistPanel.jsx | 4 +++
2 files changed, 14 insertions(+), 24 deletions(-)
diff --git a/code/game/jobs/whitelist.dm b/code/game/jobs/whitelist.dm
index 0a8cdbed70a1..09db84fec2c2 100644
--- a/code/game/jobs/whitelist.dm
+++ b/code/game/jobs/whitelist.dm
@@ -25,13 +25,17 @@
if(isSenator(src))
add_verb(src, /client/proc/whitelist_panel)
+/client
+ var/datum/whitelist_panel/wl_panel
+
/client/proc/whitelist_panel()
set name = "Whitelist Panel"
set category = "Admin.Panels"
- GLOB.WhitelistPanel.tgui_interact(mob)
-
-GLOBAL_DATUM_INIT(WhitelistPanel, /datum/whitelist_panel, new)
+ if(wl_panel)
+ qdel(wl_panel)
+ wl_panel = new
+ wl_panel.tgui_interact(mob)
#define WL_PANEL_RIGHT_CO (1<<0)
#define WL_PANEL_RIGHT_SYNTH (1<<1)
@@ -44,7 +48,6 @@ GLOBAL_DATUM_INIT(WhitelistPanel, /datum/whitelist_panel, new)
/datum/whitelist_panel
var/viewed_player = list()
var/current_menu = "Panel"
- var/used_by
var/user_rights = 0
var/target_rights = 0
var/new_rights = 0
@@ -77,13 +80,8 @@ GLOBAL_DATUM_INIT(WhitelistPanel, /datum/whitelist_panel, new)
/datum/whitelist_panel/ui_close(mob/user)
. = ..()
- if(used_by)
- used_by = null
- viewed_player = list()
- user_rights = 0
- current_menu = "Panel"
- target_rights = 0
- new_rights = 0
+ if(user?.client.wl_panel)
+ qdel(user.client.wl_panel)
/datum/whitelist_panel/vv_edit_var(var_name, var_value)
return FALSE
@@ -148,9 +146,6 @@ GLOBAL_LIST_INIT(misc_flags, list(
if(.)
return
var/mob/user = ui.user
- if(used_by && (used_by != user.ckey))
- to_chat(user, SPAN_ALERTWARNING("You are not the current user. [used_by] is editing this player."))
- return
switch(action)
if("go_back")
go_back()
@@ -173,8 +168,8 @@ GLOBAL_LIST_INIT(misc_flags, list(
to_chat(user, SPAN_HELPFUL("Whitelists for [player_key] updated."))
message_admins("Whitelists for [player_key] updated by [key_name(user)]. Reason: '[reason]'.")
log_admin("WHITELISTS: Flags for [player_key] changed from [target_rights] to [new_rights]. Reason: '[reason]'.")
- update_static_data(user, ui)
go_back()
+ update_static_data(user, ui)
return
if("refresh_data")
update_static_data(user, ui)
@@ -187,12 +182,6 @@ GLOBAL_LIST_INIT(misc_flags, list(
if(!target_key)
return FALSE
- if(used_by && (used_by != user.ckey))
- to_chat(user, SPAN_ALERTWARNING("Panel already in use by [used_by]"))
- var/override_option = tgui_alert(user, "The Whitelist Panel is in use by [used_by]. Do you want to override?", "Use Panel", list("Override", "Cancel"))
- if(override_option != "Override")
- return FALSE
-
if(target_key == TRUE)
var/new_player = tgui_input_text(user, "Enter the new ckey you wish to add. Do not include spaces or special characters.", "New Whitelistee")
if(!new_player)
@@ -209,12 +198,9 @@ GLOBAL_LIST_INIT(misc_flags, list(
viewed_player = current_player
current_menu = "Update"
user_rights = get_user_rights(user)
- used_by = user.ckey
return
/datum/whitelist_panel/proc/go_back()
- if(used_by)
- used_by = null
viewed_player = list()
user_rights = 0
current_menu = "Panel"
diff --git a/tgui/packages/tgui/interfaces/WhitelistPanel.jsx b/tgui/packages/tgui/interfaces/WhitelistPanel.jsx
index cc0ef2e0b871..a79f4b9f1d52 100644
--- a/tgui/packages/tgui/interfaces/WhitelistPanel.jsx
+++ b/tgui/packages/tgui/interfaces/WhitelistPanel.jsx
@@ -118,6 +118,7 @@ const StatusUpdate = (props, context) => {
width="100%"
height="100%"
color={isWhitelisted ? 'purple' : 'blue'}
+ tooltip={isWhitelisted ? 'Whitelisted' : 'Not Whitelisted'}
content={bit.name}
/>
);
@@ -158,6 +159,7 @@ const StatusUpdate = (props, context) => {
width="100%"
height="100%"
color={isWhitelisted ? 'purple' : 'blue'}
+ tooltip={isWhitelisted ? 'Whitelisted' : 'Not Whitelisted'}
content={bit.name}
/>
);
@@ -198,6 +200,7 @@ const StatusUpdate = (props, context) => {
width="100%"
height="100%"
color={isWhitelisted ? 'purple' : 'blue'}
+ tooltip={isWhitelisted ? 'Whitelisted' : 'Not Whitelisted'}
content={bit.name}
/>
);
@@ -238,6 +241,7 @@ const StatusUpdate = (props, context) => {
width="100%"
height="100%"
color={isWhitelisted ? 'purple' : 'blue'}
+ tooltip={isWhitelisted ? 'Whitelisted' : 'Not Whitelisted'}
content={bit.name}
/>
);
From cd68235f6e56eb36c08431a106c590d2d756c310 Mon Sep 17 00:00:00 2001
From: forest2001
Date: Fri, 19 Jan 2024 00:58:49 +0000
Subject: [PATCH 22/27] search button
---
tgui/packages/tgui/interfaces/WhitelistPanel.jsx | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/tgui/packages/tgui/interfaces/WhitelistPanel.jsx b/tgui/packages/tgui/interfaces/WhitelistPanel.jsx
index a79f4b9f1d52..128045bf2694 100644
--- a/tgui/packages/tgui/interfaces/WhitelistPanel.jsx
+++ b/tgui/packages/tgui/interfaces/WhitelistPanel.jsx
@@ -31,7 +31,8 @@ const PlayerList = (props, context) => {
act('add_player')}
/>
From b3f23704f6a85764263749d9299d4cb21fb6caab Mon Sep 17 00:00:00 2001
From: forest2001
Date: Fri, 19 Jan 2024 02:43:26 +0000
Subject: [PATCH 23/27] working joe fix
---
code/game/gamemodes/cm_initialize.dm | 3 ++-
code/modules/client/client_procs.dm | 2 +-
2 files changed, 3 insertions(+), 2 deletions(-)
diff --git a/code/game/gamemodes/cm_initialize.dm b/code/game/gamemodes/cm_initialize.dm
index 16176391e091..0ce335cbd3eb 100644
--- a/code/game/gamemodes/cm_initialize.dm
+++ b/code/game/gamemodes/cm_initialize.dm
@@ -993,6 +993,7 @@ Additional game mode variables.
if(!joe_candidate.client)
return
+ var/client/joe_client = joe_candidate.client
var/datum/job/joe_job = GLOB.RoleAuthority.roles_by_name[JOB_WORKING_JOE]
@@ -1001,7 +1002,7 @@ Additional game mode variables.
to_chat(joe_candidate, SPAN_WARNING("Something went wrong!"))
return
- if(!(joe_candidate.client.check_whitelist_status(WHITELIST_JOE)))
+ if(!(joe_client.check_whitelist_status(WHITELIST_JOE) || joe_client.check_whitelist_status(WHITELIST_SYNTHETIC)))
if(show_warning)
to_chat(joe_candidate, SPAN_WARNING("You are not whitelisted! You may apply on the forums to be whitelisted as a synth."))
return
diff --git a/code/modules/client/client_procs.dm b/code/modules/client/client_procs.dm
index 63c1fafa85cb..44820444a955 100644
--- a/code/modules/client/client_procs.dm
+++ b/code/modules/client/client_procs.dm
@@ -894,7 +894,7 @@ GLOBAL_LIST_INIT(whitelisted_client_procs, list(
return player_data.check_whitelist_status(flag_to_check)
-/client/proc/check_whitelist_status_list(flags_to_check)
+/client/proc/check_whitelist_status_list(flags_to_check) /// Logical OR list, not match all.
var/success = FALSE
if(!player_data)
load_player_data()
From 88d0ecb9db16653b5947756fce524abd6c5b7bcc Mon Sep 17 00:00:00 2001
From: forest2001
Date: Fri, 19 Jan 2024 09:09:20 +0000
Subject: [PATCH 24/27] co lead fix
---
code/modules/client/preferences.dm | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/code/modules/client/preferences.dm b/code/modules/client/preferences.dm
index db65616f95a5..b8350cea2ab0 100644
--- a/code/modules/client/preferences.dm
+++ b/code/modules/client/preferences.dm
@@ -1328,7 +1328,7 @@ GLOBAL_LIST_INIT(bgstate_options, list(
if(whitelist_flags & (WHITELIST_COMMANDER_COUNCIL|WHITELIST_COMMANDER_COUNCIL_LEGACY))
options += list("Council" = WHITELIST_COUNCIL)
- if(whitelist_flags & WHITELIST_COMMANDER_LEADER|WHITELIST_COMMANDER_COLONEL)
+ if(whitelist_flags & (WHITELIST_COMMANDER_LEADER|WHITELIST_COMMANDER_COLONEL))
options += list("Leader" = WHITELIST_LEADER)
var/new_commander_status = tgui_input_list(user, "Choose your new Commander Whitelist Status.", "Commander Status", options)
From d2a74eb74471d0e248453c31e25f34477a9eea00 Mon Sep 17 00:00:00 2001
From: harryob <55142896+harryob@users.noreply.github.com>
Date: Fri, 19 Jan 2024 10:54:19 +0000
Subject: [PATCH 25/27] fixes twerking joe
---
code/game/jobs/job/civilians/support/working_joe.dm | 6 ++++++
code/game/jobs/job/job.dm | 7 +++++++
code/game/jobs/role_authority.dm | 2 +-
code/modules/client/preferences.dm | 4 ++--
4 files changed, 16 insertions(+), 3 deletions(-)
diff --git a/code/game/jobs/job/civilians/support/working_joe.dm b/code/game/jobs/job/civilians/support/working_joe.dm
index bc8f8c439900..d890b3684084 100644
--- a/code/game/jobs/job/civilians/support/working_joe.dm
+++ b/code/game/jobs/job/civilians/support/working_joe.dm
@@ -17,6 +17,12 @@
job_options = list(STANDARD_VARIANT = "JOE", HAZMAT_VARIANT = "HAZ")
var/standard = TRUE
+/datum/job/civilian/working_joe/check_whitelist_status(mob/user)
+ if(user.client.check_whitelist_status(WHITELIST_SYNTHETIC))
+ return TRUE
+
+ return ..()
+
/datum/job/civilian/working_joe/handle_job_options(option)
if(option != HAZMAT_VARIANT)
standard = TRUE
diff --git a/code/game/jobs/job/job.dm b/code/game/jobs/job/job.dm
index d88542dcf104..1a04c3cafeb5 100644
--- a/code/game/jobs/job/job.dm
+++ b/code/game/jobs/job/job.dm
@@ -311,3 +311,10 @@
/// Intended to be overwritten to handle any requirements for specific job variations that can be selected
/datum/job/proc/filter_job_option(mob/job_applicant)
return job_options
+
+/datum/job/proc/check_whitelist_status(mob/user)
+ if(!(flags_startup_parameters & ROLE_WHITELISTED))
+ return TRUE
+
+ if(user.client.check_whitelist_status(flags_whitelist))
+ return TRUE
diff --git a/code/game/jobs/role_authority.dm b/code/game/jobs/role_authority.dm
index c24696f0355c..58c9ad5b5092 100644
--- a/code/game/jobs/role_authority.dm
+++ b/code/game/jobs/role_authority.dm
@@ -363,7 +363,7 @@ I hope it's easier to tell what the heck this proc is even doing, unlike previou
return FALSE
if(!J.can_play_role(M.client))
return FALSE
- if(J.flags_startup_parameters & ROLE_WHITELISTED && !(M.client.check_whitelist_status(J.flags_whitelist)))
+ if(!J.check_whitelist_status(M))
return FALSE
if(J.total_positions != -1 && J.get_total_positions(latejoin) <= J.current_positions)
return FALSE
diff --git a/code/modules/client/preferences.dm b/code/modules/client/preferences.dm
index b8350cea2ab0..221736b5c84f 100644
--- a/code/modules/client/preferences.dm
+++ b/code/modules/client/preferences.dm
@@ -684,7 +684,7 @@ GLOBAL_LIST_INIT(bgstate_options, list(
if(jobban_isbanned(user, job.title))
HTML += "[job.disp_title]BANNED "
continue
- else if(job.flags_startup_parameters & ROLE_WHITELISTED && !user.client.check_whitelist_status(job.flags_whitelist))
+ else if(!job.check_whitelist_status(user))
HTML += "[job.disp_title]WHITELISTED "
continue
else if(!job.can_play_role(user.client))
@@ -796,7 +796,7 @@ GLOBAL_LIST_INIT(bgstate_options, list(
if(jobban_isbanned(user, job.title))
HTML += "[job.disp_title]BANNED "
continue
- else if(job.flags_startup_parameters & ROLE_WHITELISTED && !user.client.check_whitelist_status(job.flags_whitelist))
+ else if(!job.check_whitelist_status(user))
HTML += "[job.disp_title]WHITELISTED "
continue
else if(!job.can_play_role(user.client))
From 6d706248e5a8a51b154f0b526baeb29f042125ba Mon Sep 17 00:00:00 2001
From: harryob <55142896+harryob@users.noreply.github.com>
Date: Fri, 19 Jan 2024 11:52:11 +0000
Subject: [PATCH 26/27] cleanup
---
code/game/gamemodes/cm_initialize.dm | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/code/game/gamemodes/cm_initialize.dm b/code/game/gamemodes/cm_initialize.dm
index 0ce335cbd3eb..9c7d156f8475 100644
--- a/code/game/gamemodes/cm_initialize.dm
+++ b/code/game/gamemodes/cm_initialize.dm
@@ -1002,7 +1002,7 @@ Additional game mode variables.
to_chat(joe_candidate, SPAN_WARNING("Something went wrong!"))
return
- if(!(joe_client.check_whitelist_status(WHITELIST_JOE) || joe_client.check_whitelist_status(WHITELIST_SYNTHETIC)))
+ if(!joe_job.check_whitelist_status(joe_candidate))
if(show_warning)
to_chat(joe_candidate, SPAN_WARNING("You are not whitelisted! You may apply on the forums to be whitelisted as a synth."))
return
From cd12902fef91eb80e3377a448d7c9bed9a255bcd Mon Sep 17 00:00:00 2001
From: harryob <55142896+harryob@users.noreply.github.com>
Date: Fri, 19 Jan 2024 12:00:23 +0000
Subject: [PATCH 27/27] very unhappy about that warning
---
code/game/gamemodes/cm_initialize.dm | 1 -
1 file changed, 1 deletion(-)
diff --git a/code/game/gamemodes/cm_initialize.dm b/code/game/gamemodes/cm_initialize.dm
index 9c7d156f8475..af66052ddf05 100644
--- a/code/game/gamemodes/cm_initialize.dm
+++ b/code/game/gamemodes/cm_initialize.dm
@@ -993,7 +993,6 @@ Additional game mode variables.
if(!joe_candidate.client)
return
- var/client/joe_client = joe_candidate.client
var/datum/job/joe_job = GLOB.RoleAuthority.roles_by_name[JOB_WORKING_JOE]