Makes the /Stat proc about five times faster (#22735)

* i am going to scream

* less fucked up with sad removal
This commit is contained in:
GDN
2023-10-12 15:45:17 +01:00
committed by GitHub
parent 472d7ec6f2
commit a89a234737
11 changed files with 68 additions and 67 deletions
+2
View File
@@ -216,6 +216,8 @@ Remember to update _globalvars/traits.dm if you're adding/removing/renaming trai
#define TRAIT_DODGE_ALL_OBJECTS "dodges_all_objects" /// Allows a mob to dodge all thrown objects
#define TRAIT_BADASS "trait_badass"
#define TRAIT_FORCED_STANDING "forced_standing" // The mob cannot be floored, or lie down
#define TRAIT_HAS_GPS "has_gps" // used for /Stat
#define TRAIT_CAN_VIEW_HEALTH "can_view_health" // Also used for /Stat
//***** ITEM AND MOB TRAITS *****//
/// Show what machine/door wires do when held.
+8
View File
@@ -55,6 +55,14 @@
audible_message("[bicon(src)] *beep* *beep*")
toggle_scan()
/obj/item/assembly/health/pickup(mob/user)
..()
ADD_TRAIT(user, TRAIT_CAN_VIEW_HEALTH, "HEALTH[UID()]")
/obj/item/gps/dropped(mob/user, silent)
REMOVE_TRAIT(user, TRAIT_CAN_VIEW_HEALTH, "HEALTH[UID()]")
return ..()
/obj/item/assembly/health/proc/toggle_scan()
if(!secured)
return FALSE
@@ -280,8 +280,7 @@ This is the proc mobs get to turn into a ghost. Forked from ghostize due to comp
/mob/dead/observer/Stat()
..()
statpanel("Status")
if(client.statpanel == "Status")
if(statpanel("Status"))
show_stat_emergency_shuttle_eta()
stat(null, "Respawnability: [HAS_TRAIT(src, TRAIT_RESPAWNABLE) ? "Yes" : "No"]")
@@ -120,10 +120,10 @@
/mob/living/carbon/alien/Stat()
..()
statpanel("Status")
stat(null, "Intent: [a_intent]")
stat(null, "Move Mode: [m_intent]")
show_stat_emergency_shuttle_eta()
if(statpanel("Status"))
stat(null, "Intent: [a_intent]")
stat(null, "Move Mode: [m_intent]")
show_stat_emergency_shuttle_eta()
/mob/living/carbon/alien/SetStunned(amount, updating = TRUE, force = 0)
..()
@@ -81,16 +81,12 @@ I'm using this for Stat to give it a more nifty interface to work with
/mob/living/carbon/brain/Stat()
..()
if(has_synthetic_assistance())
statpanel("Status")
if(has_synthetic_assistance() && statpanel("Status"))
show_stat_emergency_shuttle_eta()
if(client.statpanel == "Status")
//Knowing how well-off your mech is doing is really important as an MMI
if(ismecha(src.loc))
var/obj/mecha/M = src.loc
stat("Exosuit Charge:", "[istype(M.cell) ? "[M.cell.charge] / [M.cell.maxcharge]" : "No cell detected"]")
stat("Exosuit Integrity", "[!M.obj_integrity ? "0" : "[(M.obj_integrity / M.max_integrity) * 100]"]%")
if(ismecha(loc))
var/obj/mecha/M = loc
stat("Exosuit Charge:", "[istype(M.cell) ? "[M.cell.charge] / [M.cell.maxcharge]" : "No cell detected"]")
stat("Exosuit Integrity", "[!M.obj_integrity ? "0" : "[(M.obj_integrity / M.max_integrity) * 100]"]%")
/mob/living/carbon/brain/can_safely_leave_loc()
return 0 //You're not supposed to be ethereal jaunting, brains
@@ -180,43 +180,41 @@
/mob/living/carbon/human/Stat()
..()
statpanel("Status")
if(!statpanel("Status"))
return
stat(null, "Intent: [a_intent]")
stat(null, "Move Mode: [m_intent]")
show_stat_emergency_shuttle_eta()
if(client.statpanel == "Status")
var/total_user_contents = GetAllContents() // cache it
if(locate(/obj/item/gps) in total_user_contents)
var/turf/T = get_turf(src)
stat(null, "GPS: [COORD(T)]")
if(locate(/obj/item/assembly/health) in total_user_contents)
stat(null, "Health: [health]")
if(HAS_TRAIT(src, TRAIT_HAS_GPS))
var/turf/T = get_turf(src)
stat(null, "GPS: [COORD(T)]")
if(HAS_TRAIT(src, TRAIT_CAN_VIEW_HEALTH))
stat(null, "Health: [health]")
if(internal)
if(!internal.air_contents)
qdel(internal)
else if(client?.prefs.toggles2 & PREFTOGGLE_2_SIMPLE_STAT_PANEL)
stat(null, "Internals Tank Connected")
else
stat("Internal Atmosphere Info", internal.name)
stat("Tank Pressure", internal.air_contents.return_pressure())
stat("Distribution Pressure", internal.distribute_pressure)
if(internal)
if(!internal.air_contents)
qdel(internal)
else if(client?.prefs.toggles2 & PREFTOGGLE_2_SIMPLE_STAT_PANEL)
stat(null, "Internals Tank Connected")
else
stat("Internal Atmosphere Info", internal.name)
stat("Tank Pressure", internal.air_contents.return_pressure())
stat("Distribution Pressure", internal.distribute_pressure)
// I REALLY need to split up status panel things into datums
// I REALLY need to split up status panel things into datums
if(mind)
var/datum/antagonist/changeling/cling = mind.has_antag_datum(/datum/antagonist/changeling)
if(cling)
stat("Chemical Storage", "[cling.chem_charges]/[cling.chem_storage]")
stat("Absorbed DNA", cling.absorbed_count)
if(mind)
var/datum/antagonist/changeling/cling = mind.has_antag_datum(/datum/antagonist/changeling)
if(cling)
stat("Chemical Storage", "[cling.chem_charges]/[cling.chem_storage]")
stat("Absorbed DNA", cling.absorbed_count)
var/datum/antagonist/vampire/V = mind.has_antag_datum(/datum/antagonist/vampire)
if(V)
stat("Total Blood", "[V.bloodtotal]")
stat("Usable Blood", "[V.bloodusable]")
var/datum/antagonist/vampire/V = mind.has_antag_datum(/datum/antagonist/vampire)
if(V)
stat("Total Blood", "[V.bloodtotal]")
stat("Usable Blood", "[V.bloodusable]")
/mob/living/carbon/human/ex_act(severity)
if(status_flags & GODMODE)
+1 -6
View File
@@ -154,14 +154,9 @@
/mob/living/silicon/pai/Stat()
..()
statpanel("Status")
if(client.statpanel == "Status")
if(statpanel("Status"))
show_silenced()
if(proc_holder_list.len)//Generic list for proc_holder objects.
for(var/obj/effect/proc_holder/P in proc_holder_list)
statpanel("[P.panel]","",P)
/mob/living/silicon/pai/blob_act()
if(stat != DEAD)
adjustBruteLoss(60)
@@ -123,7 +123,8 @@
/mob/living/simple_animal/parrot/Stat()
..()
stat("Held Item", held_item)
if(statpanel("Status"))
stat("Held Item", held_item)
/*
* Inventory
+10 -16
View File
@@ -971,20 +971,21 @@ GLOBAL_LIST_INIT(slot_equipment_priority, list( \
return FALSE
/mob/Stat()
..()
show_stat_turf_contents()
statpanel("Status") // We only want alt-clicked turfs to come before Status
stat(null, "Round ID: [GLOB.round_id ? GLOB.round_id : "NULL"]")
stat(null, "Map: [SSmapping.map_datum.fluff_name]")
if(SSmapping.next_map)
stat(null, "Next Map: [SSmapping.next_map.fluff_name]")
if(statpanel("Status"))
stat(null, "Round ID: [GLOB.round_id ? GLOB.round_id : "NULL"]")
stat(null, "Map: [SSmapping.map_datum.fluff_name]")
if(SSmapping.next_map)
stat(null, "Next Map: [SSmapping.next_map.fluff_name]")
if(SSticker)
show_stat_station_time()
stat(null, "Players Connected: [length(GLOB.clients)]")
if(mob_spell_list && mob_spell_list.len)
if(length(mob_spell_list))
for(var/obj/effect/proc_holder/spell/S in mob_spell_list)
add_spell_to_statpanel(S)
if(mind && isliving(src) && mind.spell_list && mind.spell_list.len)
if(length(mind.spell_list))
for(var/obj/effect/proc_holder/spell/S in mind.spell_list)
add_spell_to_statpanel(S)
@@ -1043,13 +1044,6 @@ GLOBAL_LIST_INIT(slot_equipment_priority, list( \
if((SS.cpu_display == SS_CPUDISPLAY_HIGH) && !(SS.flags & SS_NO_FIRE))
SS.stat_entry()
statpanel("Status") // Switch to the Status panel again, for the sake of the lazy Stat procs
if(client?.statpanel == "Status")
if(SSticker)
show_stat_station_time()
stat(null, "Players Connected: [length(GLOB.clients)]")
// this function displays the station time in the status panel
/mob/proc/show_stat_station_time()
stat(null, "Server Uptime: [worldtime2text()]")
+1 -1
View File
@@ -90,7 +90,7 @@
return
/mob/new_player/Stat()
. = ..()
..()
if(statpanel("Status") && SSticker)
if(!SSticker.hide_mode)
stat("Game Mode: [GLOB.master_mode]")
+8
View File
@@ -48,6 +48,14 @@ GLOBAL_LIST_EMPTY(GPS_list)
else if(tracking)
. += "working"
/obj/item/gps/pickup(mob/user)
..()
ADD_TRAIT(user, TRAIT_HAS_GPS, "GPS[UID()]")
/obj/item/gps/dropped(mob/user, silent)
REMOVE_TRAIT(user, TRAIT_HAS_GPS, "GPS[UID()]")
return ..()
/obj/item/gps/emp_act(severity)
emped = TRUE
update_icon(UPDATE_OVERLAYS)