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
This commit is contained in:
farie82
2020-03-21 17:28:20 -06:00
committed by GitHub
parent e691ea2b36
commit 604daa05e1
44 changed files with 419 additions and 42 deletions
+1
View File
@@ -26,6 +26,7 @@ GLOBAL_LIST_INIT(admin_verbs_admin, list(
/client/proc/cmd_admin_subtle_message, /*send an message to somebody as a 'voice in their head'*/
/client/proc/cmd_admin_delete, /*delete an instance/object/mob/etc*/
/client/proc/cmd_admin_check_contents, /*displays the contents of an instance*/
/client/proc/cmd_admin_open_logging_view,
/client/proc/getserverlogs, /*allows us to fetch server logs (diary) for other days*/
/client/proc/jumptocoord, /*we ghost and jump to a coordinate*/
/client/proc/Getmob, /*teleports a mob to our location*/
+10
View File
@@ -0,0 +1,10 @@
GLOBAL_LIST_INIT(open_logging_views, list())
/client/proc/cmd_admin_open_logging_view()
set category = "Admin"
set name = "Open Logging View"
set desc = "Opens the detailed logging viewer"
if(!GLOB.open_logging_views[usr.client.ckey])
GLOB.open_logging_views[usr.client.ckey] = new /datum/log_viewer()
GLOB.open_logging_views[usr.client.ckey].show_ui(usr)
+1 -1
View File
@@ -885,7 +885,7 @@ Traitors and the like can also be revived with the previous role mostly intact.
return
to_chat(usr, text("<span class='danger'>Attack Log for []</span>", mob))
for(var/t in M.attack_log)
for(var/t in M.attack_log_old)
to_chat(usr, t)
feedback_add_details("admin_verb","ATTL") //If you are copy-pasting this, ensure the 2nd parameter is unique to the new proc!
@@ -285,6 +285,7 @@
else //this looks ugly but it's better than a copy-pasted startgibbing proc override
occupant.create_attack_log("Was gibbed by <b>an autogibber (\the [src])</b>")
add_attack_logs(src, occupant, "gibbed")
occupant.emote("scream")
playsound(get_turf(src), 'sound/goonstation/effects/gib.ogg', 50, 1)
+4 -3
View File
@@ -53,7 +53,8 @@ GLOBAL_VAR_INIT(observer_default_invisibility, INVISIBILITY_OBSERVER)
var/turf/T
if(ismob(body))
T = get_turf(body) //Where is the body located?
attack_log = body.attack_log //preserve our attack logs by copying them to our ghost
attack_log_old = body.attack_log_old //preserve our attack logs by copying them to our ghost
logs = body.logs.Copy()
var/mutable_appearance/MA = copy_appearance(body)
if(body.mind && body.mind.name)
@@ -431,7 +432,7 @@ This is the proc mobs get to turn into a ghost. Forked from ghostize due to comp
set name = "Orbit" // "Haunt"
set desc = "Follow and orbit a mob."
var/list/mobs = getpois(skip_mindless=1)
var/list/mobs = getpois(FALSE, TRUE, TRUE, TRUE)
var/datum/async_input/A = input_autocomplete_async(usr, "Please, select a mob: ", mobs)
A.on_close(CALLBACK(src, .proc/ManualFollow))
@@ -506,7 +507,7 @@ This is the proc mobs get to turn into a ghost. Forked from ghostize due to comp
set desc = "Teleport to a mob"
if(isobserver(usr)) //Make sure they're an observer!
var/list/dest = getpois(mobs_only=1) //Fill list, prompt user with list
var/list/dest = getpois(mobs_only=TRUE) //Fill list, prompt user with list
var/datum/async_input/A = input_autocomplete_async(usr, "Enter a mob name: ", dest)
A.on_close(CALLBACK(src, .proc/jump_to_mob))
+1
View File
@@ -59,6 +59,7 @@
var/mob/living/L = src
L.say_log += "EMOTE: [input]" //say log too so it is easier on admins instead of having to merge the two with timestamps etc
L.emote_log += input //emote only log if an admin wants to search just for emotes they don't have to sift through the say
create_log(EMOTE_LOG, input) // TODO after #13047: Include the channel
// Hearing gasp and such every five seconds is not good emotes were not global for a reason.
// Maybe some people are okay with that.
for(var/mob/M in GLOB.player_list)
+1
View File
@@ -247,6 +247,7 @@
set hidden = 1
if(InCritical())
create_attack_log("[src] has ["succumbed to death"] with [round(health, 0.1)] points of health!")
create_log(MISC_LOG, "has succumbed to death with [round(health, 0.1)] points of health")
adjustOxyLoss(health - HEALTH_THRESHOLD_DEAD)
// super check for weird mobs, including ones that adjust hp
// we don't want to go overboard and gib them, though
+2
View File
@@ -276,6 +276,7 @@ proc/get_radio_key_from_channel(var/channel)
//Log of what we've said, plain message, no spans or junk
say_log += message
create_log(SAY_LOG, message) // TODO after #13047: Include the channel
log_say(message, src)
return 1
@@ -361,6 +362,7 @@ proc/get_radio_key_from_channel(var/channel)
say_log += "whisper: [message]"
log_whisper(message, src)
create_log(SAY_LOG, "WHISPER: [message]")
var/message_range = 1
var/eavesdropping_range = 2
var/watching_range = 5
@@ -30,6 +30,7 @@
to_chat(ghost, "<span class='ghostalert'>Your cyborg shell has been repaired, re-enter if you want to continue!</span> (Verbs -> Ghost -> Re-enter corpse)")
ghost << sound('sound/effects/genetics.ogg')
create_attack_log("revived, trigger reason: [reason]")
create_log(MISC_LOG, "revived, trigger reason: [reason]")
// diag_hud_set_status()
// diag_hud_set_health()
// update_health_hud()
+4 -1
View File
@@ -7,6 +7,7 @@
else if(stat == UNCONSCIOUS)
return 0
create_attack_log("<font color='red'>Fallen unconscious at [atom_loc_line(get_turf(src))]</font>")
add_attack_logs(src, null, "Fallen unconscious")
log_game("[key_name(src)] fell unconscious at [atom_loc_line(get_turf(src))]")
stat = UNCONSCIOUS
if(updating)
@@ -22,6 +23,7 @@
else if(stat == CONSCIOUS)
return 0
create_attack_log("<font color='red'>Woken up at [atom_loc_line(get_turf(src))]</font>")
add_attack_logs(src, null, "Woken up")
log_game("[key_name(src)] woke up at [atom_loc_line(get_turf(src))]")
stat = CONSCIOUS
if(updating)
@@ -45,6 +47,7 @@
if(!can_be_revived())
return 0
create_attack_log("<font color='red'>Came back to life at [atom_loc_line(get_turf(src))]</font>")
add_attack_logs(src, null, "Came back to life")
log_game("[key_name(src)] came back to life at [atom_loc_line(get_turf(src))]")
stat = CONSCIOUS
GLOB.dead_mob_list -= src
@@ -73,4 +76,4 @@
return 1
/mob/living/proc/check_death_method()
return TRUE
return TRUE
+1
View File
@@ -5,6 +5,7 @@
computer_id = client.computer_id
log_access_in(client)
create_attack_log("<font color='red'>Logged in at [atom_loc_line(get_turf(src))]</font>")
create_log(MISC_LOG, "Logged in")
if(config.log_access)
for(var/mob/M in GLOB.player_list)
if(M == src) continue
+1
View File
@@ -4,6 +4,7 @@
GLOB.player_list -= src
log_access_out(src)
create_attack_log("<font color='red'>Logged out at [atom_loc_line(get_turf(src))]</font>")
create_log(MISC_LOG, "Logged out")
// `holder` is nil'd out by now, so we check the `admin_datums` array directly
//Only report this stuff if we are currently playing.
if(GLOB.admin_datums[ckey] && SSticker && SSticker.current_state == GAME_STATE_PLAYING)
+10 -3
View File
@@ -22,6 +22,7 @@
for(var/datum/alternate_appearance/AA in viewing_alternate_appearances)
AA.viewers -= src
viewing_alternate_appearances = null
logs.Cut()
..()
return QDEL_HINT_HARDDEL
@@ -1257,14 +1258,20 @@ GLOBAL_LIST_INIT(slot_equipment_priority, list( \
return list() //must return list or IGNORE_ACCESS
/mob/proc/create_attack_log(text, collapse = TRUE)
LAZYINITLIST(attack_log)
create_log_in_list(attack_log, text, collapse, last_log)
LAZYINITLIST(attack_log_old)
create_log_in_list(attack_log_old, text, collapse, last_log)
last_log = world.timeofday
/mob/proc/create_debug_log(text, collapse = TRUE)
LAZYINITLIST(debug_log)
create_log_in_list(debug_log, text, collapse, world.timeofday)
/mob/proc/create_log(log_type, what, target = null, turf/where = get_turf(src))
LAZYINITLIST(logs[log_type])
var/list/log_list = logs[log_type]
var/datum/log_record/record = new(log_type, src, what, target, where, world.time)
log_list.Add(record)
/proc/create_log_in_list(list/target, text, collapse = TRUE, last_log)//forgive me code gods for this shitcode proc
//this proc enables lovely stuff like an attack log that looks like this: "[18:20:29-18:20:45]21x John Smith attacked Andrew Jackson with a crowbar."
//That makes the logs easier to read, but because all of this is stored in strings, weird things have to be used to get it all out.
@@ -1406,4 +1413,4 @@ GLOBAL_LIST_INIT(slot_equipment_priority, list( \
///Force set the mob nutrition
/mob/proc/set_nutrition(change)
nutrition = max(0, change)
nutrition = max(0, change)
+5 -2
View File
@@ -33,8 +33,11 @@
var/computer_id = null
var/lastattacker = null
var/lastattacked = null
var/list/attack_log = list( )
var/list/attack_log_old = list( )
var/list/debug_log = null
var/list/logs = list() // Logs for each log type defined in __DEFINES/logs.dm
var/last_log = 0
var/obj/machinery/machine = null
var/other_mobs = null
@@ -208,4 +211,4 @@
var/list/tkgrabbed_objects = list() // Assoc list of items to TK grabs
var/forced_look = null // This can either be a numerical direction or a soft object reference (UID). It makes the mob always face towards the selected thing.
var/registered_z
var/registered_z
@@ -51,6 +51,7 @@
user.visible_message("<span class='danger'>[user] zaps [user.p_them()]self with [src].</span>")
playsound(user, fire_sound, 50, 1)
user.create_attack_log("<b>[key_name(user)]</b> zapped [user.p_them()]self with a <b>[src]</b>")
add_attack_logs(null, user, "zapped [user.p_them()]self with a [src]")
/////////////////////////////////////
//WAND OF DEATH
+4 -2
View File
@@ -263,12 +263,14 @@
return
M.create_attack_log("<font color='orange'>[key_name(M)] became [new_mob.real_name].</font>")
new_mob.attack_log = M.attack_log
add_attack_logs(null, M, "became [new_mob.real_name]")
new_mob.a_intent = INTENT_HARM
if(M.mind)
M.mind.transfer_to(new_mob)
else
new_mob.attack_log_old = M.attack_log_old.Copy()
new_mob.logs = M.logs.Copy()
new_mob.key = M.key
to_chat(new_mob, "<B>Your form morphs into that of a [randomize].</B>")
@@ -344,4 +346,4 @@
to_chat(target, "<span class='notice'>You get splatted by [src].</span>")
M.Weaken(slip_weaken)
M.Stun(slip_stun)
. = ..()
. = ..()
+9 -3
View File
@@ -16,7 +16,7 @@
. = ..()
if(. && obj_integrity > 0)
if(tank_volume && (damage_flag == "bullet" || damage_flag == "laser"))
boom()
boom(FALSE, TRUE)
/obj/structure/reagent_dispensers/attackby(obj/item/I, mob/user, params)
if(I.is_refillable())
@@ -43,7 +43,7 @@
/obj/structure/reagent_dispensers/deconstruct(disassembled = TRUE)
if(!(flags & NODECONSTRUCT))
if(!disassembled)
boom()
boom(FALSE, TRUE)
else
qdel(src)
@@ -85,15 +85,19 @@
if(!QDELETED(src)) //wasn't deleted by the projectile's effects.
if(!P.nodamage && ((P.damage_type == BURN) || (P.damage_type == BRUTE)))
message_admins("[key_name_admin(P.firer)] triggered a fueltank explosion with [P.name] at [COORD(loc)] ")
add_attack_logs(P.firer, src, "shot with [P.name]")
log_game("[key_name(P.firer)] triggered a fueltank explosion with [P.name] at [COORD(loc)]")
investigate_log("[key_name(P.firer)] triggered a fueltank explosion with [P.name] at [COORD(loc)]", INVESTIGATE_BOMB)
boom()
/obj/structure/reagent_dispensers/fueltank/boom(rigtrigger = FALSE) // Prevent case where someone who rigged the tank is blamed for the explosion when the rig isn't what triggered the explosion
/obj/structure/reagent_dispensers/fueltank/boom(rigtrigger = FALSE, log_attack = FALSE) // Prevent case where someone who rigged the tank is blamed for the explosion when the rig isn't what triggered the explosion
if(rigtrigger) // If the explosion is triggered by an assembly holder
message_admins("A fueltank, last rigged by [lastrigger], was triggered at [COORD(loc)]") // Then admin is informed of the last person who rigged the fuel tank
log_game("A fueltank, last rigged by [lastrigger], triggered at [COORD(loc)]")
add_attack_logs(lastrigger, src, "rigged fuel tank exploded")
investigate_log("A fueltank, last rigged by [lastrigger], triggered at [COORD(loc)]", INVESTIGATE_BOMB)
if(log_attack)
add_attack_logs(usr, src, "blew up", ATKLOG_FEW)
if(reagents)
reagents.set_reagent_temp(1000) //uh-oh
qdel(src)
@@ -140,6 +144,7 @@
if(istype(H.a_left, /obj/item/assembly/igniter) || istype(H.a_right, /obj/item/assembly/igniter))
msg_admin_attack("[key_name_admin(user)] rigged [src.name] with [I.name] for explosion (<A HREF='?_src_=holder;adminplayerobservecoodjump=1;X=[x];Y=[y];Z=[z]'>JMP</a>)", ATKLOG_FEW)
log_game("[key_name(user)] rigged [src.name] with [I.name] for explosion at [COORD(loc)]")
add_attack_logs(user, src, "rigged fuel tank")
investigate_log("[key_name(user)] rigged [src.name] with [I.name] for explosion at [COORD(loc)]", INVESTIGATE_BOMB)
lastrigger = "[key_name(user)]"
@@ -163,6 +168,7 @@ obj/structure/reagent_dispensers/fueltank/welder_act(mob/user, obj/item/I)
user.visible_message("<span class='danger'>[user] catastrophically fails at refilling [user.p_their()] [I]!</span>", "<span class='userdanger'>That was stupid of you.</span>")
message_admins("[key_name_admin(user)] triggered a fueltank explosion at [COORD(loc)]")
log_game("[key_name(user)] triggered a fueltank explosion at [COORD(loc)]")
add_attack_logs(user, src, "hit with lit welder")
investigate_log("[key_name(user)] triggered a fueltank explosion at [COORD(loc)]", INVESTIGATE_BOMB)
boom()
else
@@ -221,6 +221,7 @@
user.visible_message("<span class='notice'>[user] wraps [target].</span>")
user.create_attack_log("<font color='blue'>Has used [name] on [target]</font>")
add_attack_logs(user, target, "used [name]")
if(amount <= 0 && !src.loc) //if we used our last wrapping paper, drop a cardboard tube
new /obj/item/c_tube( get_turf(user) )
+1
View File
@@ -216,6 +216,7 @@
deal_damage(damage)
visible_message("<span class='danger'>[user]</span> [user.attacktext] [src]!")
user.create_attack_log("<font color='red'>attacked [src.name]</font>")
add_attack_logs(user, src, "attacked")
return TRUE
/obj/spacepod/attack_alien(mob/user)
+1
View File
@@ -243,6 +243,7 @@
qdel(src)
src.visible_message("<span class='danger'>[M] has [M.attacktext] [src]!</span>")
M.create_attack_log("<font color='red'>attacked [src.name]</font>")
add_attack_logs(M, src, "attacked")
/obj/tram/bullet_act(var/obj/item/projectile/proj)
if(prob(proj.damage))