Skip to content

Commit

Permalink
TGS Test Merge (#13546)
Browse files Browse the repository at this point in the history
  • Loading branch information
comfyorange committed Jul 26, 2023
2 parents 693594a + 4c22fb3 commit fd3a6d3
Show file tree
Hide file tree
Showing 64 changed files with 2,233 additions and 369 deletions.
2 changes: 2 additions & 0 deletions code/__DEFINES/_subsystems.dm
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,7 @@
#define INIT_ORDER_PATH -50
#define INIT_ORDER_EXPLOSIONS -69
#define INIT_ORDER_EXCAVATION -78
#define INIT_ORDER_STATPANELS -97
#define INIT_ORDER_CHAT -100 //Should be last to ensure chat remains smooth during init.

// Subsystem fire priority, from lowest to highest priority
Expand Down Expand Up @@ -140,6 +141,7 @@
#define FIRE_PRIORITY_MOBS 100
#define FIRE_PRIORITY_TGUI 110
#define FIRE_PRIORITY_TICKER 200
#define FIRE_PRIORITY_STATPANEL 390
#define FIRE_PRIORITY_CHAT 400
#define FIRE_PRIORITY_LOOPINGSOUND 405
#define FIRE_PRIORITY_RUNECHAT 410
Expand Down
6 changes: 6 additions & 0 deletions code/__DEFINES/dcs/signals.dm
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,10 @@
#define COMSIG_CLIENT_MOUSEDRAG "client_mousedrag" //from base of client/MouseUp(): (/client, object, location, control, params)
#define COMSIG_CLIENT_DISCONNECTED "client_disconnecred" //from base of /client/Destroy(): (/client)
#define COMSIG_CLIENT_PREFERENCES_UIACTED "client_preferences_uiacted" //called after preferences have been updated for this client after /datum/preferences/ui_act has completed
/// Called after one or more verbs are added: (list of verbs added)
#define COMSIG_CLIENT_VERB_ADDED "client_verb_added"
/// Called after one or more verbs are removed: (list of verbs added)
#define COMSIG_CLIENT_VERB_REMOVED "client_verb_removed"

// /atom signals
#define COMSIG_ATOM_ATTACKBY "atom_attackby" //from base of atom/attackby(): (/obj/item, /mob/living)
Expand Down Expand Up @@ -451,6 +455,8 @@
#define COMSIG_RANGED_SCATTER_MOD_CHANGED "ranged_scatter_mod_changed"
#define COMSIG_MOB_SKILLS_CHANGED "mob_skills_changed"
#define COMSIG_MOB_SHOCK_STAGE_CHANGED "mob_shock_stage_changed"
/// from mob/get_status_tab_items(): (list/items)
#define COMSIG_MOB_GET_STATUS_TAB_ITEMS "mob_get_status_tab_items"

//mob/dead/observer
#define COMSIG_OBSERVER_CLICKON "observer_clickon" //from mob/dead/observer/ClickOn(): (atom/A, params)
Expand Down
10 changes: 6 additions & 4 deletions code/__DEFINES/procpath.dm
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,12 @@
// below, their accesses are optimized away.

/// A text string of the verb's name.
var/name
var/name as text
/// The verb's help text or description.
var/desc
var/desc as text
/// The category or tab the verb will appear in.
var/category
var/category as text
/// Only clients/mobs with `see_invisibility` higher can use the verb.
var/invisibility
var/invisibility as num
/// Whether or not the verb appears in statpanel and commandbar when you press space
var/hidden as num
4 changes: 2 additions & 2 deletions code/__HELPERS/icons.dm
Original file line number Diff line number Diff line change
Expand Up @@ -1055,15 +1055,15 @@ ColorTone(rgb, tone)


//Costlier version of icon2html() that uses getFlatIcon() to account for overlays, underlays, etc. Use with extreme moderation, ESPECIALLY on mobs.
/proc/costly_icon2html(thing, target)
/proc/costly_icon2html(thing, target, sourceonly = FALSE)
if(!thing)
return

if(isicon(thing))
return icon2html(thing, target)

var/icon/I = getFlatIcon(thing)
return icon2html(I, target)
return icon2html(I, target, sourceonly = sourceonly)


//For creating consistent icons for human looking simple animals
Expand Down
98 changes: 98 additions & 0 deletions code/__HELPERS/verbs.dm
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
/**
* handles adding verbs and updating the stat panel browser
*
* pass the verb type path to this instead of adding it directly to verbs so the statpanel can update
* Arguments:
* * target - Who the verb is being added to, client or mob typepath
* * verb - typepath to a verb, or a list of verbs, supports lists of lists
*/
/proc/add_verb(client/target, verb_or_list_to_add)
if(!target)
CRASH("add_verb called without a target")
if(IsAdminAdvancedProcCall())
return
var/mob/mob_target = null

if(ismob(target))
mob_target = target
target = mob_target.client
else if(!istype(target, /client))
CRASH("add_verb called on a non-mob and non-client")
var/list/verbs_list = list()
if(!islist(verb_or_list_to_add))
verbs_list += verb_or_list_to_add
else
var/list/verb_listref = verb_or_list_to_add
var/list/elements_to_process = verb_listref.Copy()
while(length(elements_to_process))
var/element_or_list = elements_to_process[length(elements_to_process)] //Last element
elements_to_process.len--
if(islist(element_or_list))
elements_to_process += element_or_list //list/a += list/b adds the contents of b into a, not the reference to the list itself
else
verbs_list += element_or_list

if(mob_target)
mob_target.verbs += verbs_list
if(!target)
return //Our work is done.
else
target.verbs += verbs_list

var/list/output_list = list()
for(var/thing in verbs_list)
var/procpath/verb_to_add = thing
output_list[++output_list.len] = list(verb_to_add.category, verb_to_add.name)

target.stat_panel.send_message("add_verb_list", output_list)

SEND_SIGNAL(target, COMSIG_CLIENT_VERB_ADDED, verbs_list)

/**
* handles removing verb and sending it to browser to update, use this for removing verbs
*
* pass the verb type path to this instead of removing it from verbs so the statpanel can update
* Arguments:
* * target - Who the verb is being removed from, client or mob typepath
* * verb - typepath to a verb, or a list of verbs, supports lists of lists
*/
/proc/remove_verb(client/target, verb_or_list_to_remove)
if(IsAdminAdvancedProcCall())
return

var/mob/mob_target = null
if(ismob(target))
mob_target = target
target = mob_target.client
else if(!istype(target, /client))
CRASH("remove_verb called on a non-mob and non-client")

var/list/verbs_list = list()
if(!islist(verb_or_list_to_remove))
verbs_list += verb_or_list_to_remove
else
var/list/verb_listref = verb_or_list_to_remove
var/list/elements_to_process = verb_listref.Copy()
while(length(elements_to_process))
var/element_or_list = elements_to_process[length(elements_to_process)] //Last element
elements_to_process.len--
if(islist(element_or_list))
elements_to_process += element_or_list //list/a += list/b adds the contents of b into a, not the reference to the list itself
else
verbs_list += element_or_list

if(mob_target)
mob_target.verbs -= verbs_list
if(!target)
return //Our work is done.
else
target.verbs -= verbs_list

var/list/output_list = list()
for(var/thing in verbs_list)
var/procpath/verb_to_remove = thing
output_list[++output_list.len] = list(verb_to_remove.category, verb_to_remove.name)

target.stat_panel.send_message("remove_verb_list", output_list)

SEND_SIGNAL(target, COMSIG_CLIENT_VERB_REMOVED, verbs_list)
7 changes: 3 additions & 4 deletions code/_onclick/click.dm
Original file line number Diff line number Diff line change
Expand Up @@ -465,10 +465,9 @@ if(selected_ability.target_flags & flagname && !istype(A, typepath)){\

/atom/proc/AltClick(mob/user)
SEND_SIGNAL(src, COMSIG_CLICK_ALT, user)
var/turf/examined_turf = get_turf(src)
if(examined_turf && user.TurfAdjacent(examined_turf))
user.listed_turf = examined_turf
user.client.statpanel = examined_turf.name
var/turf/T = get_turf(src)
if(T && (isturf(loc) || isturf(src)) && user.TurfAdjacent(T))
user.set_listed_turf(T)
return TRUE


Expand Down
7 changes: 3 additions & 4 deletions code/controllers/configuration/configuration.dm
Original file line number Diff line number Diff line change
Expand Up @@ -231,10 +231,9 @@
return !(var_name in banned_edits) && ..()


/datum/controller/configuration/stat_entry()
if(!statclick)
statclick = new/obj/effect/statclick/debug(null, "Debug", src)
stat("[name]:", statclick)
/datum/controller/configuration/stat_entry(msg)
msg = "Edit"
return msg


/datum/controller/configuration/proc/Get(entry_type)
Expand Down
2 changes: 1 addition & 1 deletion code/controllers/controller.dm
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,4 @@

/datum/controller/proc/Recover()

/datum/controller/proc/stat_entry()
/datum/controller/proc/stat_entry(msg)
8 changes: 3 additions & 5 deletions code/controllers/failsafe.dm
Original file line number Diff line number Diff line change
Expand Up @@ -176,8 +176,6 @@ GLOBAL_REAL(Failsafe, /datum/controller/failsafe)
/datum/controller/failsafe/proc/defcon_pretty()
return defcon

/datum/controller/failsafe/stat_entry()
if(!statclick)
statclick = new/obj/effect/statclick/debug(null, "Initializing...", src)

stat("Failsafe Controller:", statclick.update("Defcon: [defcon_pretty()] (Interval: [Failsafe.processing_interval] | Iteration: [Failsafe.master_iteration])"))
/datum/controller/failsafe/stat_entry(msg)
msg = "Defcon: [defcon_pretty()] (Interval: [Failsafe.processing_interval] | Iteration: [Failsafe.master_iteration])"
return msg
8 changes: 3 additions & 5 deletions code/controllers/globals.dm
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,9 @@ GLOBAL_REAL(GLOB, /datum/controller/global_vars)
SHOULD_CALL_PARENT(FALSE)
return QDEL_HINT_IWILLGC

/datum/controller/global_vars/stat_entry()
if(!statclick)
statclick = new/obj/effect/statclick/debug(null, "Initializing...", src)

stat("Globals:", statclick.update("Debug"))
/datum/controller/global_vars/stat_entry(msg)
msg = "Edit"
return msg

/datum/controller/global_vars/vv_edit_var(var_name, var_value)
if(gvars_datum_protected_varlist[var_name])
Expand Down
8 changes: 3 additions & 5 deletions code/controllers/master.dm
Original file line number Diff line number Diff line change
Expand Up @@ -784,11 +784,9 @@ GLOBAL_REAL(Master, /datum/controller/master) = new


/datum/controller/master/stat_entry()
if(!statclick)
statclick = new/obj/effect/statclick/debug(null, "Initializing...", src)

stat("Byond:", "(FPS:[world.fps]) (TickCount:[world.time/world.tick_lag]) (TickDrift:[round(Master.tickdrift,1)]([round((Master.tickdrift/(world.time/world.tick_lag))*100,0.1)]%)) (Internal Tick Usage: [round(MAPTICK_LAST_INTERNAL_TICK_USAGE,0.1)]%)")
stat("Master Controller:", statclick.update("(TickRate:[Master.processing]) (Iteration:[Master.iteration]) (TickLimit: [round(Master.current_ticklimit, 0.1)])"))
/datum/controller/master/stat_entry(msg)
msg = "(TickRate:[Master.processing]) (Iteration:[Master.iteration]) (TickLimit: [round(Master.current_ticklimit, 0.1)])"
return msg


/datum/controller/master/StartLoadingMap()
Expand Down
12 changes: 1 addition & 11 deletions code/controllers/subsystem.dm
Original file line number Diff line number Diff line change
Expand Up @@ -198,21 +198,11 @@

//hook for printing stats to the "MC" statuspanel for admins to see performance and related stats etc.
/datum/controller/subsystem/stat_entry(msg)
if(!statclick)
statclick = new/obj/effect/statclick/debug(null, "Initializing...", src)



if(can_fire && !(SS_NO_FIRE & flags) && init_stage <= Master.init_stage_completed)
msg = "[round(cost,1)]ms|[round(tick_usage,1)]%([round(tick_overrun,1)]%)|[round(ticks,0.1)]\t[msg]"
else
msg = "OFFLINE\t[msg]"

var/title = name
if (can_fire)
title = "\[[state_letter()]][title]"

stat(title, statclick.update(msg))
return msg

/datum/controller/subsystem/proc/state_letter()
switch (state)
Expand Down
6 changes: 4 additions & 2 deletions code/controllers/subsystem/advanced_pathfinding.dm
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,10 @@ SUBSYSTEM_DEF(advanced_pathfinding)
if (MC_TICK_CHECK)
return

/datum/controller/subsystem/advanced_pathfinding/stat_entry()
..("Node pathfinding : [length(node_pathfinding_to_do)] || Tile pathfinding : [length(tile_pathfinding_to_do)]")
/datum/controller/subsystem/advanced_pathfinding/stat_entry(msg)
msg = "Node pathfinding : [length(node_pathfinding_to_do)] || Tile pathfinding : [length(tile_pathfinding_to_do)]"
return ..()


#define NODE_PATHING "node_pathing" //Looking through the network of nodes the best node path
#define TILE_PATHING "tile_pathing" //Looking the best tile path
Expand Down
3 changes: 2 additions & 1 deletion code/controllers/subsystem/autofire.dm
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,8 @@ SUBSYSTEM_DEF(automatedfire)
head_offset = world.time
bucket_resolution = world.tick_lag

/datum/controller/subsystem/automatedfire/stat_entry(msg = "ActShooters:[shooter_count]")
/datum/controller/subsystem/automatedfire/stat_entry(msg)
msg = "ActShooters:[shooter_count]"
return ..()

/datum/controller/subsystem/automatedfire/fire(resumed = FALSE)
Expand Down
4 changes: 2 additions & 2 deletions code/controllers/subsystem/events.dm
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ SUBSYSTEM_DEF(events)
//aka Badmin Central
/client/proc/force_event()
set name = "Trigger Event"
set category = "Fun"
set category = "Admin.Fun"

if(!holder ||!check_rights(R_FUN))
return
Expand All @@ -120,7 +120,7 @@ SUBSYSTEM_DEF(events)

/client/proc/toggle_events()
set name = "Toggle Events Subsystem"
set category = "Fun"
set category = "Admin.Fun"

if(!holder ||!check_rights(R_FUN))
return
Expand Down
2 changes: 1 addition & 1 deletion code/controllers/subsystem/explosions.dm
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ SUBSYSTEM_DEF(explosions)
msg += "TO:[length(throwTurf)]"

msg += "} "
..(msg)
return ..()


#define SSEX_TURF "turf"
Expand Down
2 changes: 1 addition & 1 deletion code/controllers/subsystem/garbage.dm
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ SUBSYSTEM_DEF(garbage)
msg += "TGR:[round((totalgcs/(totaldels+totalgcs))*100, 0.01)]%"
msg += " P:[pass_counts.Join(",")]"
msg += "|F:[fail_counts.Join(",")]"
..(msg)
return ..()

/datum/controller/subsystem/garbage/Shutdown()
//Adds the del() log to the qdel log file
Expand Down
5 changes: 3 additions & 2 deletions code/controllers/subsystem/idlenpcpool.dm
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,11 @@ SUBSYSTEM_DEF(idlenpcpool)
var/static/list/idle_mobs_by_zlevel[][]


/datum/controller/subsystem/idlenpcpool/stat_entry()
/datum/controller/subsystem/idlenpcpool/stat_entry(msg)
var/list/idlelist = GLOB.simple_animals[AI_IDLE]
var/list/zlist = GLOB.simple_animals[AI_Z_OFF]
..("IdleNPCS:[length(idlelist)]|Z:[length(zlist)]")
msg = "IdleNPCS:[length(idlelist)]|Z:[length(zlist)]"
return ..()


/datum/controller/subsystem/idlenpcpool/proc/MaxZChanged()
Expand Down
5 changes: 3 additions & 2 deletions code/controllers/subsystem/lighting.dm
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,9 @@ SUBSYSTEM_DEF(lighting)
return SS_INIT_SUCCESS


/datum/controller/subsystem/lighting/stat_entry()
. = ..("ShCalcs:[total_shadow_calculations]|SourcQ:[length(static_sources_queue)]|CcornQ:[length(corners_queue)]|ObjQ:[length(objects_queue)]|HybrQ:[length(mask_queue)]")
/datum/controller/subsystem/lighting/stat_entry(msg)
msg = "ShCalcs:[total_shadow_calculations]|SourcQ:[length(static_sources_queue)]|CcornQ:[length(corners_queue)]|ObjQ:[length(objects_queue)]|HybrQ:[length(mask_queue)]"
return ..()

/datum/controller/subsystem/lighting/fire(resumed, init_tick_checks)
MC_SPLIT_TICK_INIT(3)
Expand Down
5 changes: 3 additions & 2 deletions code/controllers/subsystem/machines.dm
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,9 @@ SUBSYSTEM_DEF(machines)
NewPN.add_cable(PC)
propagate_network(PC,PC.powernet)

/datum/controller/subsystem/machines/stat_entry()
..("PN:[length(powernets)]|PM:[length(processing)]")
/datum/controller/subsystem/machines/stat_entry(msg)
msg = "PM:[length(processing)]|PN:[length(powernets)]"
return ..()

/datum/controller/subsystem/machines/fire(resumed = FALSE)
if (!resumed)
Expand Down
5 changes: 3 additions & 2 deletions code/controllers/subsystem/mobs.dm
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,9 @@ SUBSYSTEM_DEF(mobs)
var/list/list/crates = list(list(), list(), list(), list())
var/crate = 1

/datum/controller/subsystem/mobs/stat_entry()
..("P:[length(processing)]")
/datum/controller/subsystem/mobs/stat_entry(msg)
msg = "P:[length(GLOB.mob_living_list)]"
return ..()

/datum/controller/subsystem/mobs/proc/stop_processing(mob/living/L)
if(!CHECK_BITFIELD(L.datum_flags, DF_ISPROCESSING))
Expand Down
5 changes: 3 additions & 2 deletions code/controllers/subsystem/npcpool.dm
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,10 @@ SUBSYSTEM_DEF(npcpool)
var/list/currentrun = list()


/datum/controller/subsystem/npcpool/stat_entry()
/datum/controller/subsystem/npcpool/stat_entry(msg)
var/list/activelist = GLOB.simple_animals[AI_ON]
..("NPCS:[length(activelist)]")
msg = "NPCS:[length(activelist)]"
return ..()


/datum/controller/subsystem/npcpool/fire(resumed = FALSE)
Expand Down
Loading

0 comments on commit fd3a6d3

Please sign in to comment.