Files
Aurora.3/code/modules/lighting/lighting_profiler.dm
Matt Atlas cadd19beac Ports the TG globals controller and converts globals. (#18057)
* SDQL2 update

* fix that verb

* cl

* fix that

* toworld

* this is pointless

* update info

* siiiiick..

* vv edit update

* fix that

* fix editing vars

* fix VV

* Port the /TG/ globals controller.

* part 1

* part 2

* oops

* part 3

* Hollow Purple

* sadas

* bsbsdb

* muda na agaki ta

* ids 1-15

* 16-31

* 41-75

* bring me back to how things used to be before i lost it all

* the strength of mayhem

* final touches

* cl

* protect some vars

* update sdql2 to use glob

* stuff?

* forgot that is not defined there

* whoops

* observ

* but it never gets better

* a

---------

Co-authored-by: Matt Atlas <liermattia@gmail.com>
2023-12-26 01:16:02 +00:00

42 lines
1006 B
Plaintext

// Writes lighting updates to the database.
// FOR DEBUGGING ONLY!
/proc/lprof_write(var/atom/movable/obj, var/type = "UNKNOWN")
if (!lighting_profiling || !obj || !establish_db_connection(GLOB.dbcon))
return
var/x = null
var/y = null
var/z = null
var/name = null
var/locname = null
if (istype(obj))
name = obj.name
locname = obj.loc.name
x = obj.loc.x
y = obj.loc.y
z = obj.loc.z
var/static/DBQuery/lprof_q
if (!lprof_q)
lprof_q = GLOB.dbcon.NewQuery({"INSERT INTO ss13dbg_lighting (time,tick_usage,type,name,loc_name,x,y,z)
VALUES (:time:,:tick_usage:,:type:,:name:,:loc_name:,:x:,:y:,:z:);"})
lprof_q.Execute(
list(
"time" = world.time,
"tick_usage" = world.tick_usage,
"type" = type,
"name" = name,
"loc_name" = locname,
"x" = x,
"y" = y,
"z" = z))
var/err = lprof_q.ErrorMsg()
if (err)
LOG_DEBUG("lprof_write: SQL Error: [err]")
message_admins(SPAN_DANGER("SQL Error during lighting profiling; disabling!"))
lighting_profiling = FALSE