From cee14fb2ca943e553a0b2b6124af8235901f8ca7 Mon Sep 17 00:00:00 2001 From: Kashargul <144968721+Kashargul@users.noreply.github.com> Date: Sun, 17 Mar 2024 23:08:07 +0100 Subject: [PATCH] adds an admin list searchable input to some admin verbs (#7995) --- code/__defines/admin_ch.dm | 6 ++- code/modules/admin/admin_tools.dm | 5 ++- code/modules/admin/admin_verb_lists_vr.dm | 1 + code/modules/admin/verbs/resize.dm | 38 ++++++++++--------- .../code/modules/admin/verbs/tgui_verbs.dm | 29 ++++++++++++++ vorestation.dme | 1 + 6 files changed, 60 insertions(+), 20 deletions(-) create mode 100644 modular_chomp/code/modules/admin/verbs/tgui_verbs.dm diff --git a/code/__defines/admin_ch.dm b/code/__defines/admin_ch.dm index 69f07034e7..c11114a915 100644 --- a/code/__defines/admin_ch.dm +++ b/code/__defines/admin_ch.dm @@ -1,4 +1,8 @@ #define SMITE_PIE "Pie Splat" #define SMITE_SPICE "Spicy Air" -#define NEWSFILE "data/news.sav" \ No newline at end of file +#define NEWSFILE "data/news.sav" + +#define TGUI_VIEW_ATTACK_LOGS "Check Player Attack Logs" +#define TGUI_VIEW_DIALOG_LOGS "Check Player Dialogue Logs" +#define TGUI_RESIZE "Resize player" diff --git a/code/modules/admin/admin_tools.dm b/code/modules/admin/admin_tools.dm index 4d4ecc4019..331b8f2770 100644 --- a/code/modules/admin/admin_tools.dm +++ b/code/modules/admin/admin_tools.dm @@ -2,8 +2,9 @@ set category = "Admin" set name = "Check Player Attack Logs" set desc = "Check a player's attack logs." - + show_cmd_admin_check_player_logs(M) //CHOMPEdit //Views specific attack logs belonging to one player. +/client/proc/show_cmd_admin_check_player_logs(mob/living/M) //CHOMPEdit var/dat = "[M]'s Attack Log:
" dat += "Viewing attack logs of [M] - (Played by ([key_name(M)]).
" if(M.mind) @@ -41,7 +42,9 @@ set category = "Admin" set name = "Check Player Dialogue Logs" set desc = "Check a player's dialogue logs." + show_cmd_admin_check_dialogue_logs(M) //CHOMPEdit +/client/proc/show_cmd_admin_check_dialogue_logs(mob/living/M) //CHOMPEdit //Views specific dialogue logs belonging to one player. var/dat = "[M]'s Dialogue Log:
" dat += "Viewing say and emote logs of [M] - (Played by ([key_name(M)]).
" diff --git a/code/modules/admin/admin_verb_lists_vr.dm b/code/modules/admin/admin_verb_lists_vr.dm index 50c734f043..1d6319c1f3 100644 --- a/code/modules/admin/admin_verb_lists_vr.dm +++ b/code/modules/admin/admin_verb_lists_vr.dm @@ -167,6 +167,7 @@ var/list/admin_verbs_fun = list( /client/proc/smite, /client/proc/admin_lightning_strike, /client/proc/resize, //VOREStation Add, + /client/proc/tgui_admin_lists, //CHOMPStation Add /client/proc/cmd_admin_droppod_deploy, /client/proc/adminorbit, //VOREStation Add /client/proc/add_mob_for_narration, //VOREStation Add diff --git a/code/modules/admin/verbs/resize.dm b/code/modules/admin/verbs/resize.dm index c67e2ffd8f..5e03d67c08 100644 --- a/code/modules/admin/verbs/resize.dm +++ b/code/modules/admin/verbs/resize.dm @@ -1,24 +1,26 @@ /client/proc/resize(var/mob/living/L in mob_list) - set name = "Resize" - set desc = "Resizes any living mob without any restrictions on size." - set category = "Fun" - if(!check_rights(R_ADMIN|R_FUN|R_VAREDIT)) - return + set name = "Resize" + set desc = "Resizes any living mob without any restrictions on size." + set category = "Fun" + if(!check_rights(R_ADMIN|R_FUN|R_VAREDIT)) + return + do_resize(L) //CHOMPEdit - var/size_multiplier = tgui_input_number(usr, "Input size multiplier.", "Resize", 1, round_value=FALSE) - if(!size_multiplier) - return //cancelled +/client/proc/do_resize(var/mob/living/L) //CHOMPEdit + var/size_multiplier = tgui_input_number(usr, "Input size multiplier.", "Resize", 1, round_value=FALSE) + if(!size_multiplier) + return //cancelled - size_multiplier = clamp(size_multiplier, -50, 50) //VOREStation Edit - being able to make people upside down is fun. Also 1000 is way, WAY too big. Honestly 50 is too big but at least you can see 50 and it doesn't break the rendering. - var/can_be_big = L.has_large_resize_bounds() - var/very_big = is_extreme_size(size_multiplier) + size_multiplier = clamp(size_multiplier, -50, 50) //VOREStation Edit - being able to make people upside down is fun. Also 1000 is way, WAY too big. Honestly 50 is too big but at least you can see 50 and it doesn't break the rendering. + var/can_be_big = L.has_large_resize_bounds() + var/very_big = is_extreme_size(size_multiplier) - if(very_big && can_be_big) // made an extreme size in an area that allows it, don't assume adminbuse - to_chat(src,"[L] will lose this size upon moving into an area where this size is not allowed.") - else if(very_big) // made an extreme size in an area that doesn't allow it, assume adminbuse - to_chat(src,"[L] will retain this normally unallowed size outside this area.") + if(very_big && can_be_big) // made an extreme size in an area that allows it, don't assume adminbuse + to_chat(src,"[L] will lose this size upon moving into an area where this size is not allowed.") + else if(very_big) // made an extreme size in an area that doesn't allow it, assume adminbuse + to_chat(src,"[L] will retain this normally unallowed size outside this area.") - L.resize(size_multiplier, animate = TRUE, uncapped = TRUE, ignore_prefs = TRUE) + L.resize(size_multiplier, animate = TRUE, uncapped = TRUE, ignore_prefs = TRUE) - log_and_message_admins("has changed [key_name(L)]'s size multiplier to [size_multiplier].") - feedback_add_details("admin_verb","RESIZE") + log_and_message_admins("has changed [key_name(L)]'s size multiplier to [size_multiplier].") + feedback_add_details("admin_verb","RESIZE") diff --git a/modular_chomp/code/modules/admin/verbs/tgui_verbs.dm b/modular_chomp/code/modules/admin/verbs/tgui_verbs.dm new file mode 100644 index 0000000000..2074ffd422 --- /dev/null +++ b/modular_chomp/code/modules/admin/verbs/tgui_verbs.dm @@ -0,0 +1,29 @@ +//Allows some list search inputs +/client/proc/tgui_admin_lists() + set name = "TGUI Admin Lists" + set desc = "Allows to have some procs with searchable lists." + set category = "Admin" + if(!check_rights(R_ADMIN|R_EVENT)) + return + + var/list/modification_options = list(TGUI_VIEW_ATTACK_LOGS, TGUI_VIEW_DIALOG_LOGS, TGUI_RESIZE) + + + var/tgui_list_choice = tgui_input_list(usr, "Select the verb you would like to use with a tgui input","Choice", modification_options) + if(!tgui_list_choice || tgui_list_choice == "Cancel") + return + + log_and_message_admins("[key_name(src)] has used TGUI Admin Lists with ([tgui_list_choice])].") + feedback_add_details("admin_verb","TGUIADL") //If you are copy-pasting this, ensure the 2nd parameter is unique to the new proc! + + switch(tgui_list_choice) + if(TGUI_VIEW_ATTACK_LOGS) + var/mob/living/L = tgui_input_list(usr, "Check a player's attack logs.", "Check Player Attack Logs", mob_list) + show_cmd_admin_check_player_logs(L) + if(TGUI_VIEW_DIALOG_LOGS) + var/mob/living/L = tgui_input_list(usr, "Check a player's dialogue logs.", "Check Player Dialogue Logs", mob_list) + show_cmd_admin_check_dialogue_logs(L) + if(TGUI_RESIZE) + var/mob/living/L = tgui_input_list(usr, "Resizes any living mob without any restrictions on size.", "Resize", mob_list) + if(L) + do_resize(L) diff --git a/vorestation.dme b/vorestation.dme index 739dbb1a91..3218e34bdb 100644 --- a/vorestation.dme +++ b/vorestation.dme @@ -4697,6 +4697,7 @@ #include "modular_chomp\code\matrices\color_matrix.dm" #include "modular_chomp\code\modules\admin\functions\modify_traits.dm" #include "modular_chomp\code\modules\admin\verbs\randomverbs.dm" +#include "modular_chomp\code\modules\admin\verbs\tgui_verbs.dm" #include "modular_chomp\code\modules\artifice\deadringer.dm" #include "modular_chomp\code\modules\balloon_alert\balloon_alert.dm" #include "modular_chomp\code\modules\casino\casino_map_atoms.dm"