Files
Paradise/code/datums/log_record.dm
farie82 604daa05e1 Adds a new logging system and a logging view (#13115)
* Super early initial commit

* Why do I keep comitting this

* in between

* In between

* Sort fix. Transfer fix. HTML and more

* Scrolling + define values change

* Search fixes and time input fixes

* Minor tweaks. Fuel tank inclusion. Fixes

* derp

* Extra logging to fuel tank

* minor stuff

* add the message to admins for fueltanks

* Don't keep mob/atom references + fixes

* line fixes?

* Review improvements

* pois comment
2020-03-21 17:28:20 -06:00

38 lines
1.0 KiB
Plaintext

/datum/log_record
var/log_type // Type of log
var/raw_time // When did this happen?
var/what // What happened
var/who // Who did it
var/target // Who/what was targeted (can be a string)
var/turf/where // Where did it happen
/datum/log_record/New(_log_type, _who, _what, _target, _where, _raw_time)
log_type = _log_type
who = get_subject_text(_who)
what = _what
target = get_subject_text(_target)
if(!_where)
_where = get_turf(_who)
where = _where
if(!_raw_time)
_raw_time = world.time
raw_time = _raw_time
/datum/log_record/proc/get_subject_text(subject)
if(ismob(subject) || isclient(subject) || istype(subject, /datum/mind))
return key_name_admin(subject)
if(isatom(subject))
var/atom/A = subject
return A.name
if(istype(subject, /datum))
var/datum/D = subject
return D.type
return subject
/proc/compare_log_record(datum/log_record/A, datum/log_record/B)
var/time_diff = A.raw_time - B.raw_time
if(!time_diff) // Same time
return cmp_text_asc(A.log_type, B.log_type)
return time_diff