mirror of
https://github.com/Aurorastation/Aurora.3.git
synced 2026-07-11 16:07:36 +01:00
4ecb0bc21c
Repaths obj/machinery to obj/structure/machinery. **Note for reviewers:** the only meaningful changed code exists within **code/game/objects/structures.dm** and **code/game/objects/structures/_machinery.dm**, largely concerning damage procs. With the exception of moving airlock defines to their own file, ALL OTHER CHANGES ARE STRICTLY PATH CHANGES. Objects, _categorically_, are largely divided between those you can hold in your hand/inventory and those you can't. Machinery objects are already subtypes of Structures behaviorally, this PR just makes their pathing reflect that, and allows for future work (tool actions, more health/destruction functionality) to be developed without unnecessary code duplication. I have tested this PR by loading up the Horizon and dismantling various machines and structures with tools, shooting guns of various types throughout the ship, and detonating a bunch of explosions throughout the ship.
70 lines
2.6 KiB
Plaintext
70 lines
2.6 KiB
Plaintext
var/global/enable_power_update_profiling = 0
|
|
|
|
var/global/power_profiled_time = 0
|
|
var/global/power_last_profile_time = 0
|
|
GLOBAL_LIST_EMPTY(power_update_requests_by_machine)
|
|
GLOBAL_LIST_EMPTY(power_update_requests_by_area)
|
|
|
|
/proc/log_power_update_request(area/A, obj/structure/machinery/M)
|
|
if (!enable_power_update_profiling)
|
|
return
|
|
|
|
var/machine_type = "[M.type]"
|
|
if (machine_type in GLOB.power_update_requests_by_machine)
|
|
GLOB.power_update_requests_by_machine[machine_type] += 1
|
|
else
|
|
GLOB.power_update_requests_by_machine[machine_type] = 1
|
|
|
|
if (A.name in GLOB.power_update_requests_by_area)
|
|
GLOB.power_update_requests_by_area[A.name] += 1
|
|
else
|
|
GLOB.power_update_requests_by_area[A.name] = 1
|
|
|
|
power_profiled_time += (world.time - power_last_profile_time)
|
|
power_last_profile_time = world.time
|
|
|
|
/client/proc/toggle_power_update_profiling()
|
|
set name = "Toggle Area Power Update Profiling"
|
|
set desc = "Toggles the recording of area power update requests."
|
|
set category = "Debug"
|
|
if(!check_rights(R_DEBUG)) return
|
|
|
|
if(enable_power_update_profiling)
|
|
enable_power_update_profiling = 0
|
|
|
|
to_chat(usr, "Area power update profiling disabled.")
|
|
message_admins("[key_name(src)] toggled area power update profiling off.")
|
|
log_admin("[key_name(src)] toggled area power update profiling off.")
|
|
else
|
|
enable_power_update_profiling = 1
|
|
power_last_profile_time = world.time
|
|
|
|
to_chat(usr, "Area power update profiling enabled.")
|
|
message_admins("[key_name(src)] toggled area power update profiling on.")
|
|
log_admin("[key_name(src)] toggled area power update profiling on.")
|
|
|
|
feedback_add_details("admin_verb","APUP") //If you are copy-pasting this, ensure the 2nd parameter is unique to the new proc!
|
|
|
|
/client/proc/view_power_update_stats_machines()
|
|
set name = "View Area Power Update Statistics By Machines"
|
|
set desc = "See which types of machines are triggering area power updates."
|
|
set category = "Debug"
|
|
|
|
if(!check_rights(R_DEBUG)) return
|
|
|
|
to_chat(usr, "Total profiling time: [power_profiled_time] ticks")
|
|
for (var/M in GLOB.power_update_requests_by_machine)
|
|
to_chat(usr, "[M] = [GLOB.power_update_requests_by_machine[M]]")
|
|
|
|
/client/proc/view_power_update_stats_area()
|
|
set name = "View Area Power Update Statistics By Area"
|
|
set desc = "See which areas are having area power updates."
|
|
set category = "Debug"
|
|
|
|
if(!check_rights(R_DEBUG)) return
|
|
|
|
to_chat(usr, "Total profiling time: [power_profiled_time] ticks")
|
|
to_chat(usr, "Total profiling time: [power_profiled_time] ticks")
|
|
for (var/A in GLOB.power_update_requests_by_area)
|
|
to_chat(usr, "[A] = [GLOB.power_update_requests_by_area[A]]")
|