diff --git a/code/__DEFINES/_tgs_defines.dm b/code/__DEFINES/_tgs_defines.dm index 37851d5d1b0..23d1e8c3926 100644 --- a/code/__DEFINES/_tgs_defines.dm +++ b/code/__DEFINES/_tgs_defines.dm @@ -1,11 +1,12 @@ #define TGS_EXTERNAL_CONFIGURATION +#define TGS_V3_API #define TGS_DEFINE_AND_SET_GLOBAL(Name, Value) GLOBAL_VAR_INIT(##Name, ##Value); GLOBAL_PROTECT(##Name) #define TGS_READ_GLOBAL(Name) GLOB.##Name #define TGS_WRITE_GLOBAL(Name, Value) GLOB.##Name = ##Value #define TGS_WORLD_ANNOUNCE(message) to_chat(world, "[html_encode(##message)]") -#define TGS_INFO_LOG(message) log_world("\[TGS] Info: [##message]") -#define TGS_WARNING_LOG(message) log_world("\[TGS] Warn: [##message]") -#define TGS_ERROR_LOG(message) log_world("\[TGS] Error: [##message]") +#define TGS_INFO_LOG(message) log_tgs(message, "INF") +#define TGS_WARNING_LOG(message) log_tgs(message, "WRN") +#define TGS_ERROR_LOG(message) log_tgs(message, "ERR") #define TGS_NOTIFY_ADMINS(event) message_admins(##event) #define TGS_CLIENT_COUNT length(GLOB.clients) #define TGS_PROTECT_DATUM(Path) GENERAL_PROTECT_DATUM(##Path) diff --git a/code/__HELPERS/_logging.dm b/code/__HELPERS/_logging.dm index 10ddec12803..59db4b675e5 100644 --- a/code/__HELPERS/_logging.dm +++ b/code/__HELPERS/_logging.dm @@ -3,6 +3,8 @@ // in the logs. ascii character 13 = CR GLOBAL_VAR_INIT(log_end, (world.system_type == UNIX ? ascii2text(13) : "")) +/// Log of TGS stuff that can be viewed ingame +GLOBAL_LIST_EMPTY(tgs_log) GLOBAL_PROTECT(log_end) #define DIRECT_OUTPUT(A, B) A << B @@ -117,6 +119,10 @@ GLOBAL_PROTECT(log_end) if(GLOB.configuration.logging.pda_logging) rustg_log_write(GLOB.world_game_log, "CHAT: [speaker.simple_info_line()] [html_decode(text)][GLOB.log_end]") +/proc/log_tgs(text, level) + GLOB.tgs_log += "\[[time_stamp()]] \[[level]] [text]" + rustg_log_write(GLOB.world_game_log, "TGS: [level]: [text][GLOB.log_end]") + /proc/log_misc(text) rustg_log_write(GLOB.world_game_log, "MISC: [text][GLOB.log_end]") diff --git a/code/modules/admin/admin_verbs.dm b/code/modules/admin/admin_verbs.dm index ea6f29cce0b..66a92ce4fac 100644 --- a/code/modules/admin/admin_verbs.dm +++ b/code/modules/admin/admin_verbs.dm @@ -171,6 +171,8 @@ GLOBAL_LIST_INIT(admin_verbs_debug, list( /datum/proc/qdel_then_find_references, /datum/proc/qdel_then_if_fail_find_references, #endif + /client/proc/dmapi_debug, + /client/proc/dmapi_log, )) GLOBAL_LIST_INIT(admin_verbs_possess, list( /proc/possess, diff --git a/code/modules/admin/verbs/debug_dmapi.dm b/code/modules/admin/verbs/debug_dmapi.dm new file mode 100644 index 00000000000..495323578a6 --- /dev/null +++ b/code/modules/admin/verbs/debug_dmapi.dm @@ -0,0 +1,35 @@ +// Admin verb to debug the DMAPI + +/client/proc/dmapi_debug() + set name = "Debug DMAPI" + set category = "Debug" + + if(!check_rights(R_DEBUG)) + return + + if(!world.TgsAvailable()) + to_chat(src, "DMAPI not connected") + return + + to_chat(src, "TGS Info") + to_chat(src, "Revision: [world.TgsRevision()]") + to_chat(src, "Version: [world.TgsVersion()]") + to_chat(src, "API Version: [world.TgsApiVersion()]") + to_chat(src, "Instance Name: [world.TgsInstanceName()]") + to_chat(src, "Testmerges:") + for(var/datum/tgs_revision_information/test_merge/TM as anything in world.TgsTestMerges()) + to_chat(src, "#[TM.number] | [TM.author] - [TM.title]") + + to_chat(src, "Channel info:") + for(var/datum/tgs_chat_channel/CC as anything in world.TgsChatChannelInfo()) + to_chat(src, "I:[CC.id] | FN:[CC.friendly_name] | AC:[CC.is_admin_channel] | PC:[CC.is_private_channel] | CT:[CC.custom_tag]") + to_chat(src, "Security level: [world.TgsSecurityLevel()]") + +/client/proc/dmapi_log() + set name = "DMAPI Log" + set category = "Debug" + + if(!check_rights(R_DEBUG)) + return + + usr << browse(GLOB.tgs_log.Join("
"), "window=dmapi_log") diff --git a/paradise.dme b/paradise.dme index fc99ba3b4cc..3b5108a2c50 100644 --- a/paradise.dme +++ b/paradise.dme @@ -1222,6 +1222,7 @@ #include "code\modules\admin\verbs\deadsay.dm" #include "code\modules\admin\verbs\deathsquad.dm" #include "code\modules\admin\verbs\debug.dm" +#include "code\modules\admin\verbs\debug_dmapi.dm" #include "code\modules\admin\verbs\diagnostics.dm" #include "code\modules\admin\verbs\dice.dm" #include "code\modules\admin\verbs\freeze.dm"