mirror of
https://github.com/CHOMPStation2/CHOMPStation2.git
synced 2025-12-11 10:43:20 +00:00
[MIRROR] mass refactor of holder checks (#11155)
Co-authored-by: Kashargul <144968721+Kashargul@users.noreply.github.com>
This commit is contained in:
committed by
GitHub
parent
54d0d16826
commit
7161a6c22e
@@ -46,7 +46,7 @@
|
||||
/client/proc/ToRban(task in list("update","toggle","show","remove","remove all","find"))
|
||||
set name = "ToRban"
|
||||
set category = "Server.Config"
|
||||
if(!holder) return
|
||||
if(!check_rights_for(src, R_HOLDER)) return
|
||||
switch(task)
|
||||
if("update")
|
||||
ToRban_update()
|
||||
|
||||
@@ -630,7 +630,7 @@ ADMIN_VERB_ONLY_CONTEXT_MENU(show_player_panel, R_HOLDER, "Show Player Panel", m
|
||||
set category = "Server.Game"
|
||||
set name = "Restart"
|
||||
set desc="Restarts the world"
|
||||
if (!usr.client.holder)
|
||||
if (!check_rights_for(usr.client, R_HOLDER))
|
||||
return
|
||||
var/confirm = alert(usr, "Restart the game world?", "Restart", "Yes", "Cancel") // Not tgui_alert for safety
|
||||
if(!confirm || confirm == "Cancel")
|
||||
@@ -1021,7 +1021,7 @@ var/datum/announcement/minor/admin_min_announcer = new
|
||||
set category = "Server.Game"
|
||||
set desc="Reboots the server post haste"
|
||||
set name="Immediate Reboot"
|
||||
if(!usr.client.holder) return
|
||||
if(!check_rights_for(usr.client, R_HOLDER)) return
|
||||
if(alert(usr, "Reboot server?","Reboot!","Yes","No") != "Yes") // Not tgui_alert for safety
|
||||
return
|
||||
to_world(span_filter_system("[span_red(span_bold("Rebooting world!"))] [span_blue("Initiated by [usr.client.holder.fakekey ? "Admin" : usr.key]!")]"))
|
||||
@@ -1299,7 +1299,7 @@ var/datum/announcement/minor/admin_min_announcer = new
|
||||
set name = "Update Mob Sprite"
|
||||
set desc = "Should fix any mob sprite update errors."
|
||||
|
||||
if (!holder)
|
||||
if (!check_rights_for(src, R_HOLDER))
|
||||
to_chat(src, "Only administrators may use this command.")
|
||||
return
|
||||
|
||||
|
||||
@@ -29,7 +29,7 @@
|
||||
/client/proc/investigate_show( subject in list("hrefs","notes","singulo","telesci") )
|
||||
set name = "Investigate"
|
||||
set category = "Admin.Investigate"
|
||||
if(!holder) return
|
||||
if(!check_rights_for(src, R_HOLDER)) return
|
||||
switch(subject)
|
||||
if("singulo", "telesci") //general one-round-only stuff
|
||||
var/F = investigate_subject2file(subject)
|
||||
|
||||
@@ -67,7 +67,7 @@
|
||||
/client/proc/admin_ghost()
|
||||
set category = "Admin.Game"
|
||||
set name = "Aghost"
|
||||
if(!holder) return
|
||||
if(!check_rights_for(src, R_HOLDER)) return
|
||||
|
||||
var/build_mode
|
||||
if(src.buildmode)
|
||||
|
||||
@@ -245,7 +245,7 @@ you will have to do something like if(client.rights & R_ADMIN) yourself.
|
||||
//probably a bit iffy - will hopefully figure out a better solution
|
||||
/proc/check_if_greater_rights_than(client/other)
|
||||
if(usr?.client)
|
||||
if(usr.client.holder)
|
||||
if(check_rights_for(usr.client, R_HOLDER))
|
||||
if(!other || !other.holder)
|
||||
return TRUE
|
||||
return usr.client.holder.check_if_greater_rights_than_holder(other.holder)
|
||||
|
||||
@@ -623,7 +623,7 @@
|
||||
var/mob/living/carbon/human/Tar = target
|
||||
if(!istype(Tar))
|
||||
return
|
||||
if(!user.client.holder)
|
||||
if(!check_rights_for(user.client, R_HOLDER))
|
||||
return
|
||||
var/obj/item/X = user.client.holder.marked_datum
|
||||
if(!istype(X))
|
||||
@@ -634,7 +634,7 @@
|
||||
var/mob/living/carbon/human/Tar = target
|
||||
if(!istype(Tar))
|
||||
return
|
||||
if(!user.client.holder)
|
||||
if(!check_rights_for(user.client, R_HOLDER))
|
||||
return
|
||||
var/obj/item/X = user.client.holder.marked_datum
|
||||
if(!istype(X))
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
|
||||
/datum/admins/proc/player_panel_new()//The new one
|
||||
if (!usr.client.holder)
|
||||
if (!check_rights_for(usr.client, R_HOLDER))
|
||||
return
|
||||
var/ui_scale = owner.prefs.read_preference(/datum/preference/toggle/ui_scale)
|
||||
var/dat = "<html><head><title>Admin Player Panel</title></head>"
|
||||
@@ -324,7 +324,7 @@
|
||||
|
||||
//The old one
|
||||
/datum/admins/proc/player_panel_old()
|
||||
if (!usr.client.holder)
|
||||
if (!check_rights_for(usr.client, R_HOLDER))
|
||||
return
|
||||
|
||||
var/dat = "<html><head><title>Player Menu</title></head>"
|
||||
|
||||
@@ -835,7 +835,7 @@
|
||||
var/mob/M = locate(href_list["newban"])
|
||||
if(!ismob(M)) return
|
||||
|
||||
if(M.client && M.client.holder) return //admins cannot be banned. Even if they could, the ban doesn't affect them anyway
|
||||
if(M.client && check_rights_for(M.client, R_HOLDER)) return //admins cannot be banned. Even if they could, the ban doesn't affect them anyway
|
||||
|
||||
switch(tgui_alert(usr, "Temporary Ban?","Temporary Ban",list("Yes","No","Cancel")))
|
||||
if(null)
|
||||
|
||||
@@ -31,7 +31,7 @@
|
||||
|
||||
for(var/mob/M in mob_list)
|
||||
if(check_rights_for(M.client, R_ADMIN|R_MOD|R_EVENT)) // Staff can see AOOC unconditionally, and with more details.
|
||||
to_chat(M, span_ooc(span_aooc("[create_text_tag("aooc", "Antag-OOC:", M.client)] <EM>[get_options_bar(src, 0, 1, 1)]([admin_jump_link(usr, M.client.holder)]):</EM> " + span_message("[msg]"))))
|
||||
to_chat(M, span_ooc(span_aooc("[create_text_tag("aooc", "Antag-OOC:", M.client)] <EM>[get_options_bar(src, 0, 1, 1)]([admin_jump_link(usr, check_rights_for(M.client, R_HOLDER))]):</EM> " + span_message("[msg]"))))
|
||||
else if(M.client) // Players can only see AOOC if observing, or if they are an antag type allowed to use AOOC.
|
||||
var/datum/antagonist/A = null
|
||||
if(M.mind) // Observers don't have minds, but they should still see AOOC.
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
set category = "Mapping"
|
||||
set name = "Check Piping"
|
||||
set background = 1
|
||||
if(!src.holder)
|
||||
if(!check_rights_for(src, R_HOLDER))
|
||||
return
|
||||
|
||||
feedback_add_details("admin_verb","CP") //If you are copy-pasting this, ensure the 2nd parameter is unique to the new proc!
|
||||
@@ -43,7 +43,7 @@
|
||||
/client/proc/powerdebug()
|
||||
set category = "Mapping"
|
||||
set name = "Check Power"
|
||||
if(!src.holder)
|
||||
if(!check_rights_for(src, R_HOLDER))
|
||||
return
|
||||
|
||||
feedback_add_details("admin_verb","CPOW") //If you are copy-pasting this, ensure the 2nd parameter is unique to the new proc!
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
set category = "Fun.Event Kit"
|
||||
set name = "Change Custom Event"
|
||||
|
||||
if(!holder)
|
||||
if(!check_rights_for(src, R_HOLDER))
|
||||
to_chat(src, "Only administrators may use this command.")
|
||||
return
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
set category = "Admin.Chat"
|
||||
set name = "Dsay" //Gave this shit a shorter name so you only have to time out "dsay" rather than "dead say" to use it --NeoFite
|
||||
set hidden = 1
|
||||
if(!src.holder)
|
||||
if(!check_rights_for(src, R_HOLDER))
|
||||
to_chat(src, "Only administrators may use this command.")
|
||||
return
|
||||
if(!src.mob)
|
||||
|
||||
@@ -245,7 +245,7 @@ var/list/sounds_cache = list()
|
||||
/client/proc/stop_sounds()
|
||||
set category = "Debug.Dangerous"
|
||||
set name = "Stop All Playing Sounds"
|
||||
if(!src.holder)
|
||||
if(!check_rights_for(src, R_HOLDER))
|
||||
return
|
||||
|
||||
log_admin("[key_name(src)] stopped all currently playing sounds.")
|
||||
|
||||
@@ -20,7 +20,7 @@ ADMIN_VERB(drop_everything, R_ADMIN, "Drop Everything", ADMIN_VERB_NO_DESCRIPTIO
|
||||
/client/proc/cmd_admin_prison(mob/M as mob in mob_list)
|
||||
set category = "Admin.Game"
|
||||
set name = "Prison"
|
||||
if(!holder)
|
||||
if(!check_rights_for(src, R_HOLDER))
|
||||
return
|
||||
|
||||
if (ismob(M))
|
||||
@@ -48,7 +48,7 @@ ADMIN_VERB(drop_everything, R_ADMIN, "Drop Everything", ADMIN_VERB_NO_DESCRIPTIO
|
||||
/client/proc/cmd_check_new_players()
|
||||
set category = "Admin.Investigate"
|
||||
set name = "Check new Players"
|
||||
if(!holder)
|
||||
if(!check_rights_for(src, R_HOLDER))
|
||||
return
|
||||
|
||||
var/age = tgui_alert(src, "Age check", "Show accounts yonger then _____ days", list("7","30","All"))
|
||||
@@ -86,7 +86,7 @@ ADMIN_VERB(drop_everything, R_ADMIN, "Drop Everything", ADMIN_VERB_NO_DESCRIPTIO
|
||||
set name = "Subtle Message"
|
||||
|
||||
if(!ismob(M)) return
|
||||
if (!holder)
|
||||
if (!check_rights_for(src, R_HOLDER))
|
||||
return
|
||||
|
||||
var/msg = tgui_input_text(usr, "Message:", text("Subtle PM to [M.key]"))
|
||||
@@ -99,7 +99,7 @@ ADMIN_VERB(drop_everything, R_ADMIN, "Drop Everything", ADMIN_VERB_NO_DESCRIPTIO
|
||||
|
||||
if(usr)
|
||||
if (usr.client)
|
||||
if(usr.client.holder)
|
||||
if(check_rights_for(usr.client, R_HOLDER))
|
||||
to_chat(M, span_bold("You hear a voice in your head...") + " " + span_italics("[msg]"))
|
||||
|
||||
log_admin("SubtlePM: [key_name(usr)] -> [key_name(M)] : [msg]")
|
||||
@@ -112,7 +112,7 @@ ADMIN_VERB(drop_everything, R_ADMIN, "Drop Everything", ADMIN_VERB_NO_DESCRIPTIO
|
||||
set category = "Fun.Narrate"
|
||||
set name = "Global Narrate"
|
||||
|
||||
if (!holder)
|
||||
if (!check_rights_for(src, R_HOLDER))
|
||||
return
|
||||
|
||||
var/msg = tgui_input_text(usr, "Message:", text("Enter the text you wish to appear to everyone:"))
|
||||
@@ -133,7 +133,7 @@ ADMIN_VERB(drop_everything, R_ADMIN, "Drop Everything", ADMIN_VERB_NO_DESCRIPTIO
|
||||
set category = "Fun.Narrate"
|
||||
set name = "Direct Narrate"
|
||||
|
||||
if(!holder)
|
||||
if(!check_rights_for(src, R_HOLDER))
|
||||
return
|
||||
|
||||
if(!M)
|
||||
@@ -160,7 +160,7 @@ ADMIN_VERB(drop_everything, R_ADMIN, "Drop Everything", ADMIN_VERB_NO_DESCRIPTIO
|
||||
set category = "Admin.Game"
|
||||
set name = "Godmode"
|
||||
|
||||
if(!holder)
|
||||
if(!check_rights_for(src, R_HOLDER))
|
||||
return
|
||||
|
||||
M.status_flags ^= GODMODE
|
||||
@@ -180,16 +180,16 @@ ADMIN_VERB(drop_everything, R_ADMIN, "Drop Everything", ADMIN_VERB_NO_DESCRIPTIO
|
||||
else
|
||||
if(!usr || !usr.client)
|
||||
return
|
||||
if(!usr.client.holder)
|
||||
if(!check_rights_for(usr.client, R_HOLDER))
|
||||
to_chat(usr, span_red("Error: cmd_admin_mute: You don't have permission to do this."))
|
||||
return
|
||||
if(!M.client)
|
||||
to_chat(usr, span_red("Error: cmd_admin_mute: This mob doesn't have a client tied to it."))
|
||||
if(M.client.holder)
|
||||
if(check_rights_for(M.client, R_HOLDER))
|
||||
to_chat(usr, span_red("Error: cmd_admin_mute: You cannot mute an admin/mod."))
|
||||
if(!M.client)
|
||||
return
|
||||
if(M.client.holder)
|
||||
if(check_rights_for(M.client, R_HOLDER))
|
||||
return
|
||||
|
||||
var/muteunmute
|
||||
@@ -230,7 +230,7 @@ ADMIN_VERB(drop_everything, R_ADMIN, "Drop Everything", ADMIN_VERB_NO_DESCRIPTIO
|
||||
set category = "Fun.Silicon"
|
||||
set name = "Add Random AI Law"
|
||||
|
||||
if(!holder)
|
||||
if(!check_rights_for(src, R_HOLDER))
|
||||
return
|
||||
|
||||
var/confirm = tgui_alert(src, "You sure?", "Confirm", list("Yes", "No"))
|
||||
@@ -282,7 +282,7 @@ Ccomp's first proc.
|
||||
set name = "Allow player to respawn"
|
||||
set desc = "Let a player bypass the wait to respawn or allow them to re-enter their corpse."
|
||||
|
||||
if(!holder)
|
||||
if(!check_rights_for(src, R_HOLDER))
|
||||
return
|
||||
|
||||
var/target = tgui_input_list(usr, "Select a ckey to allow to rejoin", "Allow Respawn Selector", GLOB.respawn_timers)
|
||||
@@ -319,13 +319,13 @@ Ccomp's first proc.
|
||||
set name = "Toggle antagHUD usage"
|
||||
set desc = "Toggles antagHUD usage for observers"
|
||||
|
||||
if(!holder)
|
||||
if(!check_rights_for(src, R_HOLDER))
|
||||
return
|
||||
|
||||
var/action=""
|
||||
if(CONFIG_GET(flag/antag_hud_allowed))
|
||||
for(var/mob/observer/dead/g in get_ghosts())
|
||||
if(!g.client.holder) //Remove the verb from non-admin ghosts
|
||||
if(!check_rights_for(g.client, R_HOLDER)) //Remove the verb from non-admin ghosts
|
||||
remove_verb(g, /mob/observer/dead/verb/toggle_antagHUD)
|
||||
if(g.antagHUD)
|
||||
g.antagHUD = 0 // Disable it on those that have it enabled
|
||||
@@ -336,7 +336,7 @@ Ccomp's first proc.
|
||||
action = "disabled"
|
||||
else
|
||||
for(var/mob/observer/dead/g in get_ghosts())
|
||||
if(!g.client.holder) // Add the verb back for all non-admin ghosts
|
||||
if(!check_rights_for(g.client, R_HOLDER)) // Add the verb back for all non-admin ghosts
|
||||
add_verb(g, /mob/observer/dead/verb/toggle_antagHUD)
|
||||
to_chat(g, span_boldnotice("The Administrator has enabled AntagHUD")) // Notify all observers they can now use AntagHUD
|
||||
CONFIG_SET(flag/antag_hud_allowed, TRUE)
|
||||
@@ -354,7 +354,7 @@ Ccomp's first proc.
|
||||
set name = "Toggle antagHUD Restrictions"
|
||||
set desc = "Restricts players that have used antagHUD from being able to join this round."
|
||||
|
||||
if(!holder)
|
||||
if(!check_rights_for(src, R_HOLDER))
|
||||
return
|
||||
|
||||
var/action=""
|
||||
@@ -614,7 +614,7 @@ ADMIN_VERB(respawn_character, (R_ADMIN|R_REJUVINATE), "Spawn Character", "(Re)Sp
|
||||
set category = "Fun.Silicon"
|
||||
set name = "Add Custom AI law"
|
||||
|
||||
if(!holder)
|
||||
if(!check_rights_for(src, R_HOLDER))
|
||||
return
|
||||
|
||||
var/input = sanitize(tgui_input_text(usr, "Please enter anything you want the AI to do. Anything. Serious.", "What?", ""))
|
||||
@@ -643,7 +643,7 @@ ADMIN_VERB(respawn_character, (R_ADMIN|R_REJUVINATE), "Spawn Character", "(Re)Sp
|
||||
set category = "Admin.Game"
|
||||
set name = "Rejuvenate"
|
||||
|
||||
if(!holder)
|
||||
if(!check_rights_for(src, R_HOLDER))
|
||||
return
|
||||
|
||||
if(!mob)
|
||||
@@ -666,7 +666,7 @@ ADMIN_VERB(respawn_character, (R_ADMIN|R_REJUVINATE), "Spawn Character", "(Re)Sp
|
||||
set category = "Fun.Event Kit"
|
||||
set name = "Create Command Report"
|
||||
|
||||
if(!holder)
|
||||
if(!check_rights_for(src, R_HOLDER))
|
||||
return
|
||||
|
||||
var/input = sanitize(tgui_input_text(usr, "Please enter anything you want. Anything. Serious.", "What?", "", multiline = TRUE, prevent_enter = TRUE), extra = 0)
|
||||
@@ -696,7 +696,7 @@ ADMIN_VERB(respawn_character, (R_ADMIN|R_REJUVINATE), "Spawn Character", "(Re)Sp
|
||||
set category = "Admin.Game"
|
||||
set name = "Delete"
|
||||
|
||||
if (!holder)
|
||||
if (!check_rights_for(src, R_HOLDER))
|
||||
return
|
||||
|
||||
admin_delete(O)
|
||||
@@ -705,7 +705,7 @@ ADMIN_VERB(respawn_character, (R_ADMIN|R_REJUVINATE), "Spawn Character", "(Re)Sp
|
||||
set category = "Admin.Investigate"
|
||||
set name = "List free slots"
|
||||
|
||||
if (!holder)
|
||||
if (!check_rights_for(src, R_HOLDER))
|
||||
return
|
||||
|
||||
if(job_master)
|
||||
@@ -717,7 +717,7 @@ ADMIN_VERB(respawn_character, (R_ADMIN|R_REJUVINATE), "Spawn Character", "(Re)Sp
|
||||
/client/proc/cmd_manual_ban()
|
||||
set name = "Manual Ban"
|
||||
set category = "Admin.Moderation"
|
||||
if(!authenticated || !holder)
|
||||
if(!authenticated || !check_rights_for(src, R_HOLDER))
|
||||
to_chat(src, "Only administrators may use this command.")
|
||||
return
|
||||
var/mob/M = null
|
||||
@@ -730,7 +730,7 @@ ADMIN_VERB(respawn_character, (R_ADMIN|R_REJUVINATE), "Spawn Character", "(Re)Sp
|
||||
if(!selection)
|
||||
return
|
||||
M = selection:mob
|
||||
if ((M.client && M.client.holder && (M.client.holder.level >= holder.level)))
|
||||
if ((M.client && check_rights_for(M.client, R_HOLDER) && (M.client.holder.level >= holder.level)))
|
||||
tgui_alert_async(usr, "You cannot perform this action. You must be of a higher administrative rank!")
|
||||
return
|
||||
|
||||
@@ -780,7 +780,7 @@ ADMIN_VERB(respawn_character, (R_ADMIN|R_REJUVINATE), "Spawn Character", "(Re)Sp
|
||||
set name = "Check Contents"
|
||||
set popup_menu = FALSE
|
||||
|
||||
if(!holder)
|
||||
if(!check_rights_for(src, R_HOLDER))
|
||||
return
|
||||
|
||||
var/list/L = M.get_contents()
|
||||
@@ -792,7 +792,7 @@ ADMIN_VERB(respawn_character, (R_ADMIN|R_REJUVINATE), "Spawn Character", "(Re)Sp
|
||||
/client/proc/cmd_admin_remove_phoron()
|
||||
set category = "Debug.Game"
|
||||
set name = "Stabilize Atmos."
|
||||
if(!holder)
|
||||
if(!check_rights_for(src, R_HOLDER))
|
||||
to_chat(src, "Only administrators may use this command.")
|
||||
return
|
||||
feedback_add_details("admin_verb","STATM") //If you are copy-pasting this, ensure the 2nd parameter is unique to the new proc!
|
||||
@@ -824,7 +824,7 @@ ADMIN_VERB(respawn_character, (R_ADMIN|R_REJUVINATE), "Spawn Character", "(Re)Sp
|
||||
set name = "Change View Range"
|
||||
set desc = "switches between 1x and custom views"
|
||||
|
||||
if(!holder)
|
||||
if(!check_rights_for(src, R_HOLDER))
|
||||
return
|
||||
|
||||
var/view = src.view
|
||||
|
||||
@@ -317,7 +317,7 @@ var/redspace_abduction_z
|
||||
|
||||
target.forceMove(locate(target.x,target.y,redspace_abduction_z))
|
||||
to_chat(target,span_danger("The tug relaxes, but everything around you looks... slightly off."))
|
||||
to_chat(user,span_notice("The mob has been moved. ([admin_jump_link(target,usr.client.holder)])"))
|
||||
to_chat(user, span_notice("The mob has been moved. ([admin_jump_link(target, check_rights_for(usr.client, R_HOLDER))])"))
|
||||
|
||||
target.transforming = FALSE
|
||||
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
|
||||
A.associate(src)
|
||||
|
||||
if(!holder)
|
||||
if(!check_rights_for(src, R_HOLDER))
|
||||
return //This can happen if an admin attempts to vv themself into somebody elses's deadmin datum by getting ref via brute force
|
||||
|
||||
to_chat(src, span_interface("You are now an admin."), confidential = TRUE)
|
||||
|
||||
@@ -6,7 +6,7 @@ var/const/commandos_possible = 6 //if more Commandos are needed in the future
|
||||
set name = "Spawn Strike Team"
|
||||
set desc = "Spawns a strike team if you want to run an admin event."
|
||||
|
||||
if(!src.holder)
|
||||
if(!check_rights_for(src, R_HOLDER))
|
||||
to_chat(src, "Only administrators may use this command.")
|
||||
return
|
||||
|
||||
|
||||
@@ -12,5 +12,5 @@
|
||||
else
|
||||
holder.add_tagged_datum(target_datum)
|
||||
|
||||
ADMIN_VERB_ONLY_CONTEXT_MENU(tag_datum, R_NONE, "Tag Datum", datum/target_datum as mob|obj|turf|area in view())
|
||||
ADMIN_VERB_ONLY_CONTEXT_MENU(tag_datum, R_HOLDER, "Tag Datum", datum/target_datum as mob|obj|turf|area in view())
|
||||
user.tag_datum(target_datum)
|
||||
|
||||
@@ -11,7 +11,7 @@ ADMIN_VERB_AND_CONTEXT_MENU(debug_variables, (R_DEBUG|R_SERVER|R_ADMIN|R_SPAWN|R
|
||||
//set src in world
|
||||
var/static/cookieoffset = rand(1, 9999) //to force cookies to reset after the round.
|
||||
|
||||
if(!usr.client || !usr.client.holder) //This is usr because admins can call the proc on other clients, even if they're not admins, to show them VVs.
|
||||
if(!usr.client || !check_rights_for(usr.client, R_HOLDER)) //This is usr because admins can call the proc on other clients, even if they're not admins, to show them VVs.
|
||||
to_chat(usr, span_danger("You need to be an administrator to access this."), confidential = TRUE)
|
||||
return
|
||||
|
||||
|
||||
Reference in New Issue
Block a user