Skip to content
Open
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions citadel.dme
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,7 @@
#include "code\__DEFINES\admin\bans.dm"
#include "code\__DEFINES\admin\keybindings.dm"
#include "code\__DEFINES\admin\verbs.dm"
#include "code\__DEFINES\admin\verbs_tg.dm"
#include "code\__DEFINES\ai\ai_holder.dm"
#include "code\__DEFINES\ai\debug.dm"
#include "code\__DEFINES\assets\medical.dm"
Expand Down
16 changes: 8 additions & 8 deletions code/__DEFINES/admin/verbs.dm
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
* * Set `CATEGORY` to null to not have it show up in verb panel.
*/
#define ADMIN_VERB_DEF(PATH_SUFFIX, REQUIRED_RIGHTS, NAME, DESC, CATEGORY, HEADER...) \
ADMIN_VERB_DEF_INTERNAL(PATH_SUFFIX, REQUIRED_RIGHTS, NAME, DESC, CATEGORY, TRUE, HEADER)
_ADMIN_VERB_DEF_INTERNAL(PATH_SUFFIX, REQUIRED_RIGHTS, NAME, DESC, CATEGORY, TRUE, ##HEADER)

/**
* Declares an admin verb that does not show up in the popup menu.
Expand All @@ -21,24 +21,24 @@
* * Set `CATEGORY` to null to not have it show up in verb panel.
*/
#define ADMIN_VERB_DEF_PANEL_ONLY(PATH_SUFFIX, REQUIRED_RIGHTS, NAME, DESC, CATEGORY, HEADER...) \
ADMIN_VERB_DEF_INTERNAL(PATH_SUFFIX, REQUIRED_RIGHTS, NAME, DESC, CATEGORY, FALSE, HEADER)
_ADMIN_VERB_DEF_INTERNAL(PATH_SUFFIX, REQUIRED_RIGHTS, NAME, DESC, CATEGORY, FALSE, ##HEADER)

/**
* Do not use.
*/
#define ADMIN_VERB_DEF_INTERNAL(PATH_SUFFIX, REQUIRED_RIGHTS, NAME, DESC, CATEGORY, POPUP_MENU, HEADER...) \
#define _ADMIN_VERB_DEF_INTERNAL(PATH_SUFFIX, REQUIRED_RIGHTS, NAME, DESC, CATEGORY, POPUP_MENU, HEADER...) \
/datum/admin_verb_descriptor/##PATH_SUFFIX { \
id = #PATH_SUFFIX; \
required_rights = ##REQUIRED_RIGHTS; \
verb_path = /datum/admin_verb_abstraction/proc/verb__##PATH_SUFFIX; \
reflection_path = /datum/admin_verb_abstraction/proc/verb__invoke_##PATH_SUFFIX; \
}; \
/datum/admin_verb_abstraction/proc/verb__##PATH_SUFFIX(##HEADER) { \
set name = NAME; \
set desc = DESC; \
set category = CATEGORY; \
set name = ##NAME; \
set desc = ##DESC; \
set hidden = FALSE; \
set popup_menu = POPUP_MENU; \
set popup_menu = ##POPUP_MENU; \
set category = ##CATEGORY; \
if(!((usr?.client?.holder?.rights & ##REQUIRED_RIGHTS) == ##REQUIRED_RIGHTS)) {\
CRASH("attempted invocation with insufficient rights."); \
}; \
Expand All @@ -49,7 +49,7 @@
while(FALSE); \
call(usr.client, /datum/admin_verb_abstraction::verb__invoke_##PATH_SUFFIX())(arglist(list(usr.client) + args)); \
}; \
/datum/admin_verb_abstraction/proc/verb__invoke_##PATH_SUFFIX(client/invoking, ##HEADER)
/datum/admin_verb_abstraction/proc/verb__invoke_##PATH_SUFFIX(client/user, ##HEADER)

/**
* Abstract datum with no variables. Used to hold the proc definitions for admin verbs.
Expand Down
40 changes: 40 additions & 0 deletions code/__DEFINES/admin/verbs_tg.dm
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
// Re-aliased tg defines
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

don't realias macros if it just does the same thing
for context only just add a def that just nulls it

also, there's no need to replace the verb categories unless we're going to get a statpanel that doesn't treat them as verbs; they're all verbs internally, thus they are verb categories.

stuff like profile/ipintel should not be their own tabs, statpanel if needed should just parse the category like Category.Subcategory or something

rest of PR is fine but this is duplicate

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

license
also category is just a rename

#define ADMIN_VERB(verb_path_name, verb_permissions, verb_name, verb_desc, verb_category, verb_args...) \
_ADMIN_VERB_DEF_INTERNAL(verb_path_name, verb_permissions, verb_name, verb_desc, verb_category, FALSE, ##verb_args)

#define ADMIN_VERB_ONLY_CONTEXT_MENU(verb_path_name, verb_permissions, verb_name, verb_args...) \
_ADMIN_VERB_DEF_INTERNAL(verb_path_name, verb_permissions, verb_name, ADMIN_VERB_NO_DESCRIPTION, ADMIN_CATEGORY_HIDDEN, TRUE, ##verb_args)

#define ADMIN_VERB_AND_CONTEXT_MENU(verb_path_name, verb_permissions, verb_name, verb_desc, verb_category, verb_args...) \
_ADMIN_VERB_DEF_INTERNAL(verb_path_name, verb_permissions, verb_name, verb_desc, verb_category, TRUE, ##verb_args)

/*
* This is an example of how to use the above macro:
* ```
* ADMIN_VERB(name_of_verb, R_ADMIN, "Verb Name", "Verb Desc", "Verb Category", mob/target in world)
* to_chat(user, "Hello!")
* ```
* Note the implied `client/user` argument that is injected into the verb.
* Also note that byond is shit and you cannot multi-line the macro call.
*/

/// Use this to mark your verb as not having a description. Should ONLY be used if you are also hiding the verb!
#define ADMIN_VERB_NO_DESCRIPTION ""
/// Used to verbs you do not want to show up in the master verb panel.
#define ADMIN_CATEGORY_HIDDEN null

// Admin verb categories
#define ADMIN_CATEGORY_MAIN "Admin"
#define ADMIN_CATEGORY_EVENTS "Events"
#define ADMIN_CATEGORY_FUN "Fun"
#define ADMIN_CATEGORY_GAME "Game"
#define ADMIN_CATEGORY_SHUTTLE "Shuttle"

// Special categories that are separated
#define ADMIN_CATEGORY_DEBUG "Debug"
#define ADMIN_CATEGORY_SERVER "Server"
#define ADMIN_CATEGORY_OBJECT "Object"
#define ADMIN_CATEGORY_MAPPING "Mapping"
#define ADMIN_CATEGORY_PROFILE "Profile"
#define ADMIN_CATEGORY_IPINTEL "IPIntel"

9 changes: 0 additions & 9 deletions code/__DEFINES/interface/verbs.dm
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,3 @@
#define VERB_CATEGORY_OOC "OOC"
#define VERB_CATEGORY_OBJECT "Object"
#define VERB_CATEGORY_SYSTEM "System"

/// For admin verbs only!
#define VERB_CATEGORY_ADMIN "Admin"
/// For admin verbs only!
#define VERB_CATEGORY_DEBUG "Debug"
/// For admin verbs only!
#define VERB_CATEGORY_GAME "Game"
/// For admin verbs only!
#define VERB_CATEGORY_SERVER "Server"
1 change: 1 addition & 0 deletions code/controllers/communications.dm
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,7 @@ var/global/datum/controller/radio/radio_controller

//The global radio controller
/datum/controller/radio
name = "Radio Controller (Legacy)"
var/list/datum/radio_frequency/frequencies = list()

/datum/controller/radio/proc/add_object(obj/device as obj, var/new_frequency as num, var/radio_filter = null as text|null)
Expand Down
1 change: 1 addition & 0 deletions code/controllers/toml_config/toml_configuration.dm
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ GLOBAL_REAL(Configuration, /datum/controller/toml_configuration)
// todo: /datum/controller/configuration
// todo: needs stronger vv guarding; it still exposes list refs.
/datum/controller/toml_configuration
name = "TOML Configuration" // NAME YOUR FUCKING CONTROLLERS
/// Entries by type.
VAR_PRIVATE/list/datum/toml_config_entry/typed_entries
/// Entries as same structure as the underlying toml/json
Expand Down
88 changes: 34 additions & 54 deletions code/controllers/verbs.dm
Original file line number Diff line number Diff line change
Expand Up @@ -46,24 +46,46 @@ INITIALIZE_IMMEDIATE(/obj/effect/statclick)
usr.client.debug_variables(target)
message_admins("Admin [key_name_admin(usr)] is debugging the [target] [class].")


// Debug verbs.
/client/proc/restart_controller(controller in list("Master", "Failsafe"))
set category = "Debug"
set name = "Restart Controller"
set desc = "Restart one of the various periodic loop controllers for the game (be careful!)"

if(!holder)
return
ADMIN_VERB(restart_controller, R_DEBUG, "Restart Controller", "Restart one of the various periodic loop controllers for the game (be careful!)", ADMIN_CATEGORY_DEBUG, controller in list("Master", "Failsafe"))
switch(controller)
if("Master")
Recreate_MC()
feedback_add_details("admin_verb","RMC")
// BLACKBOX_LOG_ADMIN_VERB("Restart Master Controller")
if("Failsafe")
new /datum/controller/failsafe()
feedback_add_details("admin_verb","RFailsafe")
// BLACKBOX_LOG_ADMIN_VERB("Restart Failsafe Controller")

message_admins("Admin [key_name_admin(user)] has restarted the [controller] controller.")

ADMIN_VERB(debug_controller, R_DEBUG, "Debug Controller", "Debug the various periodic loop controllers for the game (be careful!)", ADMIN_CATEGORY_DEBUG)
var/list/controllers = list()
var/list/controller_choices = list()

// Please read the verb description. <- although we allow /d/c/repository lmao
for (var/var_key in global.vars)
var/datum/controller/controller = global.vars[var_key]
if(!istype(controller) || istype(controller, /datum/controller/subsystem))
continue
controllers[controller.name] = controller //we use an associated list to ensure clients can't hold references to controllers
controller_choices += controller.name

controller_choices += "INTERNAL: Gas Data"
controller_choices += "LEGACY: Configuration"
controller_choices += "LEGACY: paiController"
controllers["INTERNAL: Gas Data"] = global.gas_data
controllers["LEGACY: Configuration"] = config_legacy
controllers["LEGACY: paiController"] = paiController

var/datum/controller/controller_string = input("Select controller to debug", "Debug Controller") as null|anything in controller_choices
var/datum/controller/controller = controllers[controller_string]

if (!istype(controller))
return

message_admins("Admin [key_name_admin(usr)] has restarted the [controller] controller.")
user.debug_variables(controller)

// BLACKBOX_LOG_ADMIN_VERB("Debug Controller")
message_admins("Admin [key_name_admin(user)] is debugging the [controller] controller.")

/client/proc/debug_antagonist_template(antag_type in GLOB.all_antag_types)
set category = "Debug"
Expand All @@ -74,45 +96,3 @@ INITIALIZE_IMMEDIATE(/obj/effect/statclick)
if(antag)
usr.client.debug_variables(antag)
message_admins("Admin [key_name_admin(usr)] is debugging the [antag.role_text] template.")

/client/proc/debug_controller()
set category = "Debug"
set name = "Debug Controller"
set desc = "Debug the various subsystems/controllers for the game (be careful!)"

if(!holder)
return
var/list/options = list()
options["MC"] = global.Master
options["Failsafe"] = global.Failsafe
options["Global Variables"] = global.GLOB
options["Configuration"] = global.config
options["Gas Data"] = global.gas_data
options["Legacy Configuration"] = config_legacy
for(var/i in Master.subsystems)
var/datum/controller/subsystem/S = i
if(!istype(S)) //Eh, we're a debug verb, let's have typechecking.
continue
var/strtype = "SS[get_end_section_of_type(S.type)]"
if(options[strtype])
var/offset = 2
while(istype(options["[strtype]_[offset] - DUPE ERROR"], /datum/controller/subsystem))
offset++
options["[strtype]_[offset] - DUPE ERROR"] = S //Something is very, very wrong.
else
options[strtype] = S

//Goon PS stuff, and other yet-to-be-subsystem things.
options["LEGACY: radio_controller"] = radio_controller
options["LEGACY: paiController"] = paiController
options["LEGACY: GLOB.cameranet"] = GLOB.cameranet

var/pick = input(mob, "Choose a controller to debug/view variables of.", "VV controller:") as null|anything in options
if(!pick)
return
var/datum/D = options[pick]
if(!istype(D))
return
feedback_add_details("admin_verb", "DebugController")
message_admins("Admin [key_name_admin(mob)] is debugging the [pick] controller.")
debug_variables(D)
2 changes: 1 addition & 1 deletion code/modules/admin/admin_verb_descriptor.dm
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
//* This file is explicitly licensed under the MIT license. *//
//* Copyright (c) 2024 Citadel Station Developers *//

GLOBAL_REAL_PROTECT(admin_verbs)
VV_PROTECT(/datum/admin_verb_descriptor)
GLOBAL_REAL_LIST(admin_verb_descriptors) = zz__prepare_admin_verb_descriptors()

/proc/zz__prepare_admin_verb_descriptors()
Expand Down
8 changes: 1 addition & 7 deletions code/modules/admin/admin_verbs.dm
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,6 @@ var/list/admin_verbs_debug = list(
/client/proc/reload_configuration,
/client/proc/cmd_debug_make_powernets,
/client/proc/kill_airgroup,
/client/proc/debug_controller,
/client/proc/debug_antagonist_template,
/client/proc/cmd_debug_mob_lists,
/client/proc/cmd_admin_delete,
Expand All @@ -213,7 +212,6 @@ var/list/admin_verbs_debug = list(
/client/proc/air_report,
/client/proc/reload_admins,
/client/proc/reload_eventMs,
/client/proc/restart_controller,
/datum/admins/proc/restart,
/client/proc/print_random_map,
/client/proc/create_random_map,
Expand Down Expand Up @@ -245,8 +243,7 @@ var/list/admin_verbs_debug = list(

var/list/admin_verbs_paranoid_debug = list(
/client/proc/callproc,
/client/proc/callproc_datum,
/client/proc/debug_controller
/client/proc/callproc_datum
)

var/list/admin_verbs_possess = list(
Expand Down Expand Up @@ -307,7 +304,6 @@ var/list/admin_verbs_hideable = list(
/datum/admins/proc/toggleAI,
/datum/admins/proc/adspawn,
/datum/admins/proc/adjump,
/client/proc/restart_controller,
/client/proc/cmd_admin_list_open_jobs,
/client/proc/callproc,
/client/proc/callproc_datum,
Expand All @@ -316,7 +312,6 @@ var/list/admin_verbs_hideable = list(
/client/proc/kill_air,
/client/proc/cmd_debug_make_powernets,
/client/proc/kill_airgroup,
/client/proc/debug_controller,
/client/proc/startSinglo,
/client/proc/cmd_debug_mob_lists,
/client/proc/cmd_del_all,
Expand Down Expand Up @@ -382,7 +377,6 @@ var/list/admin_verbs_event_manager = list(
/proc/release,
/client/proc/callproc,
/client/proc/callproc_datum,
/client/proc/debug_controller,
/client/proc/show_gm_status,
/datum/admins/proc/change_weather,
/datum/admins/proc/change_time,
Expand Down
Loading
Loading