mirror of
https://github.com/ParadiseSS13/Paradise.git
synced 2026-07-12 07:33:34 +01:00
A lot of perf micro-optimisations (#20188)
* Refactors Investigate Log * Speedup character loading * Optimise SSinstancing * Removes both path images * Optimises SSdebugview * CRLF --> LF * Update config/example/config.toml
This commit is contained in:
@@ -1,61 +1,31 @@
|
||||
//By Carnwennan
|
||||
|
||||
//This system was made as an alternative to all the in-game lists and variables used to log stuff in-game.
|
||||
//lists and variables are great. However, they have several major flaws:
|
||||
//Firstly, they use memory. TGstation has one of the highest memory usage of all the ss13 branches.
|
||||
//Secondly, they are usually stored in an object. This means that they aren't centralised. It also means that
|
||||
//the data is lost when the object is deleted! This is especially annoying for things like the singulo engine!
|
||||
#define INVESTIGATE_DIR "data/investigate/"
|
||||
|
||||
//SYSTEM
|
||||
/proc/investigate_subject2file(subject)
|
||||
return wrap_file("[INVESTIGATE_DIR][subject].html")
|
||||
|
||||
/proc/investigate_reset()
|
||||
if(fdel(INVESTIGATE_DIR)) return 1
|
||||
return 0
|
||||
// Atom investigate stuff
|
||||
// All of this is stored in a global list because its faster than file IO and we arent ram constrained like TG -aa07
|
||||
GLOBAL_LIST_EMPTY(investigate_log_wrapper)
|
||||
GLOBAL_PROTECT(investigate_log_wrapper)
|
||||
|
||||
/atom/proc/investigate_log(message, subject)
|
||||
if(!message) return
|
||||
var/F = investigate_subject2file(subject)
|
||||
if(!F) return
|
||||
GLOB.investigate_log_subjects |= subject
|
||||
F << "<small>[time_stamp()] \ref[src] [ADMIN_COORDJMP(src)] </small> || [src] [message]<br>"
|
||||
if(!message || !subject)
|
||||
return
|
||||
|
||||
/proc/log_investigate(message, subject)
|
||||
if(!message) return
|
||||
var/F = investigate_subject2file(subject)
|
||||
if(!F) return
|
||||
GLOB.investigate_log_subjects |= subject
|
||||
F << "<small>[time_stamp()] || [message]<br>"
|
||||
if(!(subject in GLOB.investigate_log_wrapper))
|
||||
GLOB.investigate_log_wrapper[subject] = list()
|
||||
|
||||
GLOB.investigate_log_wrapper[subject] += "<small>[time_stamp()] [UID()] [ADMIN_COORDJMP(src)] </small> || [src] [message]"
|
||||
|
||||
//ADMINVERBS
|
||||
/client/proc/investigate_show( subject in GLOB.investigate_log_subjects )
|
||||
set name = "Investigate"
|
||||
/client/proc/investigate_show(subject in GLOB.investigate_log_wrapper)
|
||||
set name = "Investigate Round Objects"
|
||||
set category = "Admin"
|
||||
|
||||
if(!check_rights(R_ADMIN))
|
||||
return
|
||||
switch(subject)
|
||||
if("notes")
|
||||
show_note()
|
||||
|
||||
if("watchlist")
|
||||
watchlist_show()
|
||||
// Should never happen
|
||||
if(!(subject in GLOB.investigate_log_wrapper))
|
||||
return
|
||||
|
||||
if("hrefs") //persistant logs and stuff
|
||||
if(GLOB.configuration.logging.href_logging)
|
||||
if(GLOB.world_href_log)
|
||||
src << browse(file(GLOB.world_href_log), "window=investigate[subject];size=800x300")
|
||||
else
|
||||
to_chat(src, "<font color='red'>Error: admin_investigate: No href logfile found.</font>")
|
||||
return
|
||||
else
|
||||
to_chat(src, "<font color='red'>Error: admin_investigate: Href Logging is not on.</font>")
|
||||
return
|
||||
var/list/entries = GLOB.investigate_log_wrapper[subject]
|
||||
|
||||
else //general one-round-only stuff
|
||||
var/F = investigate_subject2file(subject)
|
||||
if(!F)
|
||||
to_chat(src, "<font color='red'>Error: admin_investigate: [INVESTIGATE_DIR][subject] is an invalid path or cannot be accessed.</font>")
|
||||
return
|
||||
src << browse(F,"window=investigate[subject];size=800x300")
|
||||
var/datum/browser/B = new(usr, "investigatelog", "Investigate ([subject])", 800, 400)
|
||||
B.set_content(entries.Join("<br>"))
|
||||
B.open()
|
||||
|
||||
@@ -69,7 +69,8 @@ GLOBAL_LIST_INIT(admin_verbs_admin, list(
|
||||
/client/proc/ccbdb_lookup_ckey,
|
||||
/client/proc/view_instances,
|
||||
/client/proc/start_vote,
|
||||
/client/proc/ping_all_admins
|
||||
/client/proc/ping_all_admins,
|
||||
/client/proc/show_watchlist
|
||||
))
|
||||
GLOBAL_LIST_INIT(admin_verbs_ban, list(
|
||||
/client/proc/ban_panel,
|
||||
@@ -996,3 +997,12 @@ GLOBAL_LIST_INIT(admin_verbs_maintainer, list(
|
||||
|
||||
log_admin("[key_name(usr)] has [advanced_admin_interaction ? "activated" : "deactivated"] their advanced admin interaction.")
|
||||
message_admins("[key_name_admin(usr)] has [advanced_admin_interaction ? "activated" : "deactivated"] their advanced admin interaction.")
|
||||
|
||||
/client/proc/show_watchlist()
|
||||
set name = "Show Watchlist"
|
||||
set category = "Admin"
|
||||
|
||||
if(!check_rights(R_ADMIN))
|
||||
return
|
||||
|
||||
watchlist_show()
|
||||
|
||||
Reference in New Issue
Block a user