mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-08-29 16:18:01 +01:00
Refactors admin verbs from giant ass lists into datums (#72407)
## About The Pull Request See title. ## Why It's Good For The Game Makes it easier for people to add new admin buttons, and also removes the giant ass ugly lists that are an affront to my eyes. Yes you are still able to call them manually via the verb bar   ## Changelog 🆑 refactor: Admin verbs are now datums with a dedicated panel handler admin: Admin verbs now come with a handy description when you hover over them! /🆑 --------- Signed-off-by: GitHub <noreply@github.com>
This commit is contained in:
+43
-89
@@ -13,7 +13,6 @@
|
||||
|
||||
/datum/admins/Topic(href, href_list)
|
||||
..()
|
||||
|
||||
if(usr.client != src.owner || !check_rights(0))
|
||||
message_admins("[usr.key] has attempted to override the admin panel!")
|
||||
log_admin("[key_name(usr)] tried to use the admin panel without authorization.")
|
||||
@@ -22,6 +21,9 @@
|
||||
if(!CheckAdminHref(href, href_list))
|
||||
return
|
||||
|
||||
if(SSadmin_verbs.handle_admin_holder_topic(usr.client, href, href_list))
|
||||
return
|
||||
|
||||
if(href_list["ahelp"])
|
||||
if(!check_rights(R_ADMIN, TRUE))
|
||||
return
|
||||
@@ -111,10 +113,7 @@
|
||||
minor_announce("The emergency shuttle will reach its destination in [DisplayTimeText(timer SECONDS)].")
|
||||
message_admins(span_adminnotice("[key_name_admin(usr)] edited the Emergency Shuttle's timeleft to [timer] seconds."))
|
||||
else if(href_list["trigger_centcom_recall"])
|
||||
if(!check_rights(R_ADMIN))
|
||||
return
|
||||
|
||||
usr.client.trigger_centcom_recall()
|
||||
SSadmin_verbs.dynamic_invoke_admin_verb(usr, /mob/admin_module_holder/events/recall_shuttle)
|
||||
|
||||
else if(href_list["move_shuttle"])
|
||||
if(!check_rights(R_ADMIN))
|
||||
@@ -136,8 +135,7 @@
|
||||
to_chat(usr, "[shuttle_console] was [shuttle_console.admin_controlled ? "locked" : "unlocked"].", confidential = TRUE)
|
||||
|
||||
else if(href_list["delay_round_end"])
|
||||
// Permissions are checked in delay_round_end
|
||||
delay_round_end()
|
||||
SSadmin_verbs.dynamic_invoke_admin_verb(usr.client, /mob/admin_module_holder/server/delay_round_end)
|
||||
|
||||
else if(href_list["undelay_round_end"])
|
||||
if(!check_rights(R_SERVER))
|
||||
@@ -709,12 +707,10 @@
|
||||
if(iscyborg(our_mob))
|
||||
to_chat(usr, "That's already a cyborg.", confidential = TRUE)
|
||||
return
|
||||
|
||||
usr.client.cmd_admin_robotize(our_mob)
|
||||
SSadmin_verbs.dynamic_invoke_admin_verb(usr, /mob/admin_module_holder/debug/make_cyborg, our_mob)
|
||||
|
||||
else if(href_list["adminplayeropts"])
|
||||
var/mob/M = locate(href_list["adminplayeropts"])
|
||||
show_player_panel(M)
|
||||
usr.client.admin_context_wrapper_context_player_panel(locate(href_list["adminplayeropts"]))
|
||||
|
||||
else if(href_list["ppbyckey"])
|
||||
var/target_ckey = href_list["ppbyckey"]
|
||||
@@ -729,7 +725,7 @@
|
||||
return
|
||||
|
||||
to_chat(usr, span_notice("Jumping to [target_ckey]'s new mob: [target_mob]!"))
|
||||
show_player_panel(target_mob)
|
||||
usr.client.admin_context_wrapper_context_player_panel(target_mob)
|
||||
|
||||
else if(href_list["adminplayerobservefollow"])
|
||||
if(!isobserver(usr) && !check_rights(R_ADMIN))
|
||||
@@ -757,14 +753,9 @@
|
||||
|
||||
var/client/C = usr.client
|
||||
if(!isobserver(usr))
|
||||
C.admin_ghost()
|
||||
SSadmin_verbs.dynamic_invoke_admin_verb(C, /mob/admin_module_holder/game/aghost)
|
||||
sleep(0.2 SECONDS)
|
||||
C.jumptocoord(x,y,z)
|
||||
|
||||
else if(href_list["adminchecklaws"])
|
||||
if(!check_rights(R_ADMIN))
|
||||
return
|
||||
output_ai_laws()
|
||||
SSadmin_verbs.dynamic_invoke_admin_verb(C, /mob/admin_module_holder/game/jump_to_coordinate, x, y, z)
|
||||
|
||||
else if(href_list["adminmoreinfo"])
|
||||
var/mob/subject = locate(href_list["adminmoreinfo"]) in GLOB.mob_list
|
||||
@@ -968,28 +959,24 @@
|
||||
to_chat(usr, "This can only be used on instances of type /mob/living/carbon/human", confidential = TRUE)
|
||||
return
|
||||
|
||||
usr.client.smite(H)
|
||||
usr.client.admin_context_wrapper_context_smite(H)
|
||||
|
||||
else if(href_list["CentComReply"])
|
||||
if(!check_rights(R_ADMIN))
|
||||
return
|
||||
|
||||
var/mob/M = locate(href_list["CentComReply"])
|
||||
usr.client.admin_headset_message(M, RADIO_CHANNEL_CENTCOM)
|
||||
usr.client.admin_context_wrapper_contexxt_headset_message(
|
||||
locate(href_list["CentComReply"]),
|
||||
RADIO_CHANNEL_CENTCOM,
|
||||
)
|
||||
|
||||
else if(href_list["SyndicateReply"])
|
||||
if(!check_rights(R_ADMIN))
|
||||
return
|
||||
|
||||
var/mob/M = locate(href_list["SyndicateReply"])
|
||||
usr.client.admin_headset_message(M, RADIO_CHANNEL_SYNDICATE)
|
||||
usr.client.admin_context_wrapper_contexxt_headset_message(
|
||||
locate(href_list["SyndicateReply"]),
|
||||
RADIO_CHANNEL_SYNDICATE,
|
||||
)
|
||||
|
||||
else if(href_list["HeadsetMessage"])
|
||||
if(!check_rights(R_ADMIN))
|
||||
return
|
||||
|
||||
var/mob/M = locate(href_list["HeadsetMessage"])
|
||||
usr.client.admin_headset_message(M)
|
||||
usr.client.admin_context_wrapper_contexxt_headset_message(
|
||||
locate(href_list["HeadsetMessage"]),
|
||||
)
|
||||
|
||||
else if(href_list["reject_custom_name"])
|
||||
if(!check_rights(R_ADMIN))
|
||||
@@ -997,12 +984,12 @@
|
||||
var/obj/item/station_charter/charter = locate(href_list["reject_custom_name"])
|
||||
if(istype(charter))
|
||||
charter.reject_proposed(usr)
|
||||
|
||||
else if(href_list["jumpto"])
|
||||
if(!isobserver(usr) && !check_rights(R_ADMIN))
|
||||
return
|
||||
|
||||
var/mob/M = locate(href_list["jumpto"])
|
||||
usr.client.jumptomob(M)
|
||||
SSadmin_verbs.dynamic_invoke_admin_verb(usr, /mob/admin_module_holder/game/jump_to_mob, locate(href_list["jumpto"]))
|
||||
|
||||
else if(href_list["getmob"])
|
||||
if(!check_rights(R_ADMIN))
|
||||
@@ -1010,38 +997,29 @@
|
||||
|
||||
if(tgui_alert(usr, "Confirm?", "Message", list("Yes", "No")) != "Yes")
|
||||
return
|
||||
var/mob/M = locate(href_list["getmob"])
|
||||
usr.client.Getmob(M)
|
||||
SSadmin_verbs.dynamic_invoke_admin_verb(usr, /mob/admin_module_holder/game/get_mob, locate(href_list["getmob"]))
|
||||
|
||||
else if(href_list["sendmob"])
|
||||
if(!check_rights(R_ADMIN))
|
||||
return
|
||||
|
||||
var/mob/M = locate(href_list["sendmob"])
|
||||
usr.client.sendmob(M)
|
||||
usr.client.admin_context_wrapper_context_sendmob(locate(href_list["sendmob"]))
|
||||
|
||||
else if(href_list["narrateto"])
|
||||
if(!check_rights(R_ADMIN))
|
||||
return
|
||||
|
||||
var/mob/M = locate(href_list["narrateto"])
|
||||
usr.client.cmd_admin_direct_narrate(M)
|
||||
usr.client.admin_context_wrapper_context_direct_narrate(locate(href_list["narrateto"]))
|
||||
|
||||
else if(href_list["subtlemessage"])
|
||||
if(!check_rights(R_ADMIN))
|
||||
return
|
||||
|
||||
var/mob/M = locate(href_list["subtlemessage"])
|
||||
usr.client.cmd_admin_subtle_message(M)
|
||||
usr.client.admin_context_wrapper_context_subtle_message(locate(href_list["subtlemessage"]))
|
||||
|
||||
else if(href_list["playsoundto"])
|
||||
if(!check_rights(R_SOUND))
|
||||
return
|
||||
|
||||
var/mob/M = locate(href_list["playsoundto"])
|
||||
if(QDELETED(M))
|
||||
to_chat(usr, span_warning("target mob no longer exists!"))
|
||||
return
|
||||
|
||||
var/S = input("", "Select a sound file",) as null|sound
|
||||
if(S)
|
||||
usr.client.play_direct_mob_sound(S, M)
|
||||
SSadmin_verbs.dynamic_invoke_admin_verb(usr.client, /mob/admin_module_holder/fun/play_direct_mob_sound, S, M)
|
||||
|
||||
else if(href_list["individuallog"])
|
||||
if(!check_rights(R_ADMIN))
|
||||
@@ -1081,37 +1059,13 @@
|
||||
else
|
||||
D.traitor_panel()
|
||||
else
|
||||
show_traitor_panel(M)
|
||||
SSadmin_verbs.dynamic_invoke_admin_verb(usr, /mob/admin_module_holder/game/traitor_panel, M)
|
||||
|
||||
else if(href_list["skill"])
|
||||
if(!check_rights(R_ADMIN))
|
||||
return
|
||||
|
||||
if(!SSticker.HasRoundStarted())
|
||||
tgui_alert(usr,"The game hasn't started yet!")
|
||||
return
|
||||
|
||||
var/target = locate(href_list["skill"])
|
||||
var/datum/mind/target_mind
|
||||
if(ismob(target))
|
||||
var/mob/target_mob = target
|
||||
target_mind = target_mob.mind
|
||||
else if (istype(target, /datum/mind))
|
||||
target_mind = target
|
||||
else
|
||||
to_chat(usr, "This can only be used on instances of type /mob and /mind", confidential = TRUE)
|
||||
return
|
||||
show_skill_panel(target_mind)
|
||||
SSadmin_verbs.dynamic_invoke_admin_verb(usr, /mob/admin_module_holder/game/skill_panel, locate(href_list["skill"]))
|
||||
|
||||
else if(href_list["borgpanel"])
|
||||
if(!check_rights(R_ADMIN))
|
||||
return
|
||||
|
||||
var/mob/M = locate(href_list["borgpanel"])
|
||||
if(!iscyborg(M))
|
||||
to_chat(usr, "This can only be used on cyborgs", confidential = TRUE)
|
||||
else
|
||||
open_borgopanel(M)
|
||||
usr.client.admin_context_wrapper_context_borg_panel(locate(href_list["borgpanel"]))
|
||||
|
||||
else if(href_list["initmind"])
|
||||
if(!check_rights(R_ADMIN))
|
||||
@@ -1274,9 +1228,7 @@
|
||||
return
|
||||
|
||||
else if(href_list["check_antagonist"])
|
||||
if(!check_rights(R_ADMIN))
|
||||
return
|
||||
usr.client.check_antagonists()
|
||||
SSadmin_verbs.dynamic_invoke_admin_verb(usr.client, /mob/admin_module_holder/game/check_antagonists)
|
||||
|
||||
else if(href_list["kick_all_from_lobby"])
|
||||
if(!check_rights(R_ADMIN))
|
||||
@@ -1324,7 +1276,7 @@
|
||||
G.report_message = description
|
||||
message_admins("[key_name(usr)] created \"[G.name]\" station goal.")
|
||||
GLOB.station_goals += G
|
||||
modify_goals()
|
||||
SSadmin_verbs.dynamic_invoke_admin_verb(usr, /mob/admin_module_holder/)
|
||||
|
||||
else if(href_list["change_lag_switch"])
|
||||
if(!check_rights(R_ADMIN))
|
||||
@@ -1347,7 +1299,7 @@
|
||||
log_admin("[key_name(usr)] turned a Lag Switch measure at index ([switch_index]) [LAZYACCESS(SSlag_switch.measures, switch_index) ? "ON" : "OFF"]")
|
||||
message_admins("[key_name_admin(usr)] turned a Lag Switch measure [LAZYACCESS(SSlag_switch.measures, switch_index) ? "ON" : "OFF"]")
|
||||
|
||||
src.show_lag_switch_panel()
|
||||
SSadmin_verbs.dynamic_invoke_admin_verb(usr, /mob/admin_module_holder/game/show_lag_switches)
|
||||
|
||||
else if(href_list["change_lag_switch_option"])
|
||||
if(!check_rights(R_ADMIN))
|
||||
@@ -1376,7 +1328,7 @@
|
||||
log_admin("[key_name(usr)] set the Lag Switch slowmode cooldown to [new_num] seconds.")
|
||||
message_admins("[key_name_admin(usr)] set the Lag Switch slowmode cooldown to [new_num] seconds.")
|
||||
|
||||
src.show_lag_switch_panel()
|
||||
SSadmin_verbs.dynamic_invoke_admin_verb(usr, /mob/admin_module_holder/game/show_lag_switches)
|
||||
|
||||
else if(href_list["viewruntime"])
|
||||
var/datum/error_viewer/error_viewer = locate(href_list["viewruntime"])
|
||||
@@ -1496,7 +1448,7 @@
|
||||
if(confirm == "No")
|
||||
return
|
||||
if(confirm == "Yes")
|
||||
restart()
|
||||
SSadmin_verbs.dynamic_invoke_admin_verb(usr.client, /mob/admin_module_holder/server/reboot_world)
|
||||
|
||||
else if(href_list["check_teams"])
|
||||
if(!check_rights(R_ADMIN))
|
||||
@@ -1748,3 +1700,5 @@
|
||||
if(!paper_to_show)
|
||||
return
|
||||
paper_to_show.ui_interact(usr)
|
||||
|
||||
stack_trace("Unknown admin topic [href]-'[list2params(href_list)]'")
|
||||
|
||||
Reference in New Issue
Block a user