mirror of
https://github.com/ParadiseSS13/Paradise.git
synced 2026-08-23 03:57:13 +01:00
Merge pull request #13175 from farie82/logging-improvements
Logging view improvements
This commit is contained in:
@@ -1919,6 +1919,16 @@ GLOBAL_DATUM_INIT(dview_mob, /mob/dview, new)
|
||||
|
||||
return pois
|
||||
|
||||
/*
|
||||
* Returns all player mobs in an assoc list with ckey as key and the mob as value
|
||||
*/
|
||||
/proc/get_assoc_mob_list_by_ckey()
|
||||
var/list/mob/mobs = list()
|
||||
for(var/i in GLOB.player_list)
|
||||
var/mob/M = i
|
||||
mobs[M.ckey] = M
|
||||
return mobs
|
||||
|
||||
/proc/flash_color(mob_or_client, flash_color="#960000", flash_time=20)
|
||||
var/client/C
|
||||
if(istype(mob_or_client, /mob))
|
||||
|
||||
@@ -81,7 +81,7 @@
|
||||
user.do_attack_animation(M)
|
||||
. = M.attacked_by(src, user, def_zone)
|
||||
|
||||
add_attack_logs(user, M, "Attacked with [name] (INTENT: [uppertext(user.a_intent)]) (DAMTYPE: [uppertext(damtype)])", (M.ckey && force > 0 && damtype != STAMINA) ? null : ATKLOG_ALMOSTALL)
|
||||
add_attack_logs(user, M, "Attacked with [name] ([uppertext(user.a_intent)]) ([uppertext(damtype)])", (M.ckey && force > 0 && damtype != STAMINA) ? null : ATKLOG_ALMOSTALL)
|
||||
|
||||
add_fingerprint(user)
|
||||
|
||||
|
||||
@@ -8,10 +8,10 @@
|
||||
|
||||
/datum/log_record/New(_log_type, _who, _what, _target, _where, _raw_time)
|
||||
log_type = _log_type
|
||||
|
||||
who = get_subject_text(_who)
|
||||
|
||||
who = get_subject_text(_who, _log_type)
|
||||
what = _what
|
||||
target = get_subject_text(_target)
|
||||
target = get_subject_text(_target, _log_type)
|
||||
if(!_where)
|
||||
_where = get_turf(_who)
|
||||
where = _where
|
||||
@@ -19,16 +19,31 @@
|
||||
_raw_time = world.time
|
||||
raw_time = _raw_time
|
||||
|
||||
/datum/log_record/proc/get_subject_text(subject)
|
||||
/datum/log_record/proc/get_subject_text(subject, log_type)
|
||||
if(ismob(subject) || isclient(subject) || istype(subject, /datum/mind))
|
||||
return key_name_admin(subject)
|
||||
if(isatom(subject))
|
||||
. = key_name_admin(subject)
|
||||
if(should_log_health(log_type) && isliving(subject))
|
||||
. += get_health_string(subject)
|
||||
else if(isatom(subject))
|
||||
var/atom/A = subject
|
||||
return A.name
|
||||
if(istype(subject, /datum))
|
||||
. = A.name
|
||||
else if(istype(subject, /datum))
|
||||
var/datum/D = subject
|
||||
return D.type
|
||||
return subject
|
||||
else
|
||||
. = subject
|
||||
|
||||
/datum/log_record/proc/get_health_string(var/mob/living/L)
|
||||
var/OX = L.getOxyLoss() > 50 ? "<b>[L.getOxyLoss()]</b>" : L.getOxyLoss()
|
||||
var/TX = L.getToxLoss() > 50 ? "<b>[L.getToxLoss()]</b>" : L.getToxLoss()
|
||||
var/BU = L.getFireLoss() > 50 ? "<b>[L.getFireLoss()]</b>" : L.getFireLoss()
|
||||
var/BR = L.getBruteLoss() > 50 ? "<b>[L.getBruteLoss()]</b>" : L.getBruteLoss()
|
||||
return " ([L.health]: <font color='deepskyblue'>[OX]</font> - <font color='green'>[TX]</font> - <font color='#FFA500'>[BU]</font> - <font color='red'>[BR]</font>)"
|
||||
|
||||
/datum/log_record/proc/should_log_health(log_type)
|
||||
if(log_type == ATTACK_LOG || log_type == DEFENSE_LOG)
|
||||
return TRUE
|
||||
return FALSE
|
||||
|
||||
/proc/compare_log_record(datum/log_record/A, datum/log_record/B)
|
||||
var/time_diff = A.raw_time - B.raw_time
|
||||
|
||||
@@ -4,13 +4,13 @@
|
||||
var/time_from = 0
|
||||
var/time_to = 4 HOURS // 4 Hours should be enough. INFINITY would screw the UI up
|
||||
var/list/selected_mobs = list() // The mobs in question
|
||||
var/list/selected_log_types = list() // The log types being searched for
|
||||
var/list/selected_log_types = ALL_LOGS // The log types being searched for
|
||||
|
||||
var/list/log_records = list() // Found and sorted records
|
||||
|
||||
/datum/log_viewer/proc/clear_all()
|
||||
selected_mobs.Cut()
|
||||
selected_log_types.Cut()
|
||||
selected_log_types = ALL_LOGS
|
||||
time_from = initial(time_from)
|
||||
time_to = initial(time_to)
|
||||
log_records.Cut()
|
||||
@@ -91,6 +91,14 @@
|
||||
return start
|
||||
return 0
|
||||
|
||||
/datum/log_viewer/proc/add_mobs(list/mob/mobs)
|
||||
if(!mobs?.len)
|
||||
return
|
||||
for(var/i in mobs)
|
||||
var/mob/M = i
|
||||
if(istype(M))
|
||||
selected_mobs |= M
|
||||
|
||||
/datum/log_viewer/proc/add_mob(mob/user, mob/M)
|
||||
if(!M || !user)
|
||||
return
|
||||
@@ -103,8 +111,8 @@
|
||||
var/trStyleTop = "border-top:2px solid; border-bottom:2px solid; padding-top: 5px; padding-bottom: 5px;"
|
||||
var/trStyle = "border-top:1px solid; border-bottom:1px solid; padding-top: 5px; padding-bottom: 5px;"
|
||||
var/dat
|
||||
dat += "<head><style>.adminticket{border:2px solid} td{border:1px solid grey;} th{border:1px solid grey;} span{float:left;width:150px;}</style></head>"
|
||||
dat += "<div style='height:15vh'>"
|
||||
dat += "<head><meta http-equiv='X-UA-Compatible' content='IE=edge'><style>.adminticket{border:2px solid} td{border:1px solid grey;} th{border:1px solid grey;} span{float:left;width:150px;}</style></head>"
|
||||
dat += "<div style='min-height:95px'>"
|
||||
dat += "<span>Time Search Range:</span> <a href='?src=[UID()];start_time=1'>[gameTimestamp(wtime = time_from)]</a>"
|
||||
dat += " To: <a href='?src=[UID()];end_time=1'>[gameTimestamp(wtime = time_to)]</a>"
|
||||
dat += "<BR>"
|
||||
@@ -115,8 +123,9 @@
|
||||
if(QDELETED(M))
|
||||
selected_mobs -= i
|
||||
continue
|
||||
dat += "<a href='?src=[UID()];remove_mob=\ref[M]'>[M.name]</a>"
|
||||
dat += "<a href='?src=[UID()];remove_mob=\ref[M]'>[get_display_name(M)]</a>"
|
||||
dat += "<a href='?src=[UID()];add_mob=1'>Add Mob</a>"
|
||||
dat += "<a href='?src=[UID()];add_mob_ckey=1'>Add Mob (by ckey)</a>"
|
||||
dat += "<a href='?src=[UID()];clear_mobs=1'>Clear All Mobs</a>"
|
||||
dat += "<BR>"
|
||||
|
||||
@@ -142,9 +151,9 @@
|
||||
// Search results
|
||||
var/tdStyleTime = "width:80px; text-align:center;"
|
||||
var/tdStyleType = "width:80px; text-align:center;"
|
||||
var/tdStyleWho = "width:300px; text-align:center;"
|
||||
var/tdStyleWho = "width:400px; text-align:center;"
|
||||
var/tdStyleWhere = "width:150px; text-align:center;"
|
||||
dat += "<div style='overflow-y: auto; max-height:76vh;'>"
|
||||
dat += "<div style='overflow-y: auto; max-height:calc(100vh - 145px);'>"
|
||||
dat += "<table style='width:100%; border: 1px solid;'>"
|
||||
dat += "<tr style='[trStyleTop]'><th style='[tdStyleTime]'>When</th><th style='[tdStyleType]'>Type</th><th style='[tdStyleWho]'>Who</th><th>What</th><th>Target</th><th style='[tdStyleWhere]'>Where</th></tr>"
|
||||
for(var/i in log_records)
|
||||
@@ -158,7 +167,7 @@
|
||||
dat += "</table>"
|
||||
dat += "</div>"
|
||||
|
||||
var/datum/browser/popup = new(user, "Log viewer", "Log viewer", 1400, 600)
|
||||
var/datum/browser/popup = new(user, "Log Viewer", "Log Viewer", 1500, 600)
|
||||
popup.set_content(dat)
|
||||
popup.open()
|
||||
|
||||
@@ -203,6 +212,11 @@
|
||||
var/datum/async_input/A = input_autocomplete_async(usr, "Please, select a mob: ", mobs)
|
||||
A.on_close(CALLBACK(src, .proc/add_mob, usr))
|
||||
return
|
||||
if(href_list["add_mob_ckey"])
|
||||
var/list/mobs = get_assoc_mob_list_by_ckey()
|
||||
var/datum/async_input/A = input_autocomplete_async(usr, "Please, select a ckey: ", mobs)
|
||||
A.on_close(CALLBACK(src, .proc/add_mob, usr))
|
||||
return
|
||||
if(href_list["remove_mob"])
|
||||
var/mob/M = locate(href_list["remove_mob"])
|
||||
if(M)
|
||||
@@ -233,3 +247,11 @@
|
||||
if(MISC_LOG)
|
||||
return "gray"
|
||||
return "slategray"
|
||||
|
||||
/datum/log_viewer/proc/get_display_name(mob/M)
|
||||
var/name = M.name
|
||||
if(M.name != M.real_name)
|
||||
name = "[name] ([M.real_name])"
|
||||
if(isobserver(M))
|
||||
name = "[name] (DEAD)"
|
||||
return name
|
||||
|
||||
@@ -94,7 +94,7 @@
|
||||
/obj/item/mecha_parts/mecha_equipment/drill/proc/drill_mob(mob/living/target, mob/user)
|
||||
target.visible_message("<span class='danger'>[chassis] is drilling [target] with [src]!</span>",
|
||||
"<span class='userdanger'>[chassis] is drilling you with [src]!</span>")
|
||||
add_attack_logs(user, target, "DRILLED with [src] (INTENT: [uppertext(user.a_intent)]) (DAMTYPE: [uppertext(damtype)])")
|
||||
add_attack_logs(user, target, "DRILLED with [src] ([uppertext(user.a_intent)]) ([uppertext(damtype)])")
|
||||
if(target.stat == DEAD && target.getBruteLoss() >= 200)
|
||||
add_attack_logs(user, target, "gibbed")
|
||||
if(LAZYLEN(target.butcher_results))
|
||||
|
||||
@@ -60,7 +60,7 @@
|
||||
target.visible_message("<span class='danger'>[chassis] squeezes [target].</span>", \
|
||||
"<span class='userdanger'>[chassis] squeezes [target].</span>",\
|
||||
"<span class='italics'>You hear something crack.</span>")
|
||||
add_attack_logs(chassis.occupant, M, "Squeezed with [src] (INTENT: [uppertext(chassis.occupant.a_intent)]) (DAMTYE: [uppertext(damtype)])")
|
||||
add_attack_logs(chassis.occupant, M, "Squeezed with [src] ([uppertext(chassis.occupant.a_intent)]) ([uppertext(damtype)])")
|
||||
start_cooldown()
|
||||
else
|
||||
step_away(M,chassis)
|
||||
|
||||
@@ -870,7 +870,7 @@
|
||||
return 0
|
||||
use_power(melee_energy_drain)
|
||||
if(M.damtype == BRUTE || M.damtype == BURN)
|
||||
add_attack_logs(M.occupant, src, "Mecha-attacked with [M] (INTENT: [uppertext(M.occupant.a_intent)]) (DAMTYPE: [uppertext(M.damtype)])")
|
||||
add_attack_logs(M.occupant, src, "Mecha-attacked with [M] ([uppertext(M.occupant.a_intent)]) ([uppertext(M.damtype)])")
|
||||
. = ..()
|
||||
|
||||
/obj/mecha/emag_act(mob/user)
|
||||
|
||||
@@ -506,7 +506,7 @@ GLOBAL_DATUM_INIT(fire_overlay, /image, image("icon" = 'icons/goonstation/effect
|
||||
"<span class='userdanger'>You stab yourself in the eyes with [src]!</span>" \
|
||||
)
|
||||
|
||||
add_attack_logs(user, M, "Eye-stabbed with [src] (INTENT: [uppertext(user.a_intent)])")
|
||||
add_attack_logs(user, M, "Eye-stabbed with [src] ([uppertext(user.a_intent)])")
|
||||
|
||||
if(istype(H))
|
||||
var/obj/item/organ/internal/eyes/eyes = H.get_int_organ(/obj/item/organ/internal/eyes)
|
||||
|
||||
@@ -29,7 +29,7 @@
|
||||
"<span class='userdanger'>[user] has prodded you with [src]!</span>")
|
||||
|
||||
playsound(loc, 'sound/weapons/egloves.ogg', 50, 1, -1)
|
||||
add_attack_logs(user, M, "Stunned with [src] (INTENT: [uppertext(user.a_intent)])")
|
||||
add_attack_logs(user, M, "Stunned with [src] ([uppertext(user.a_intent)])")
|
||||
|
||||
/obj/item/borg/overdrive
|
||||
name = "Overdrive"
|
||||
|
||||
@@ -78,6 +78,7 @@ GLOBAL_VAR_INIT(nologevent, 0)
|
||||
body += " \[<A href='?_src_=holder;revive=[M.UID()]'>Heal</A>\] "
|
||||
|
||||
body += "<br><br>\[ "
|
||||
body += "<a href='?_src_=holder;open_logging_view=[M.UID()];'>LOGS</a> - "
|
||||
body += "<a href='?_src_=vars;Vars=[M.UID()]'>VV</a> - "
|
||||
body += "[ADMIN_TP(M,"TP")] - "
|
||||
if(M.client)
|
||||
|
||||
@@ -911,6 +911,11 @@
|
||||
//M.client = null
|
||||
qdel(M.client)
|
||||
|
||||
else if(href_list["open_logging_view"])
|
||||
var/mob/M = locateUID(href_list["open_logging_view"])
|
||||
if(ismob(M))
|
||||
usr.client.open_logging_view(list(M), TRUE)
|
||||
|
||||
//Player Notes
|
||||
else if(href_list["addnote"])
|
||||
var/target_ckey = href_list["addnote"]
|
||||
|
||||
@@ -2,10 +2,20 @@ GLOBAL_LIST_INIT(open_logging_views, list())
|
||||
|
||||
/client/proc/cmd_admin_open_logging_view()
|
||||
set category = "Admin"
|
||||
set name = "Open Logging View"
|
||||
set name = "Logging View"
|
||||
set desc = "Opens the detailed logging viewer"
|
||||
open_logging_view()
|
||||
|
||||
if(!GLOB.open_logging_views[usr.client.ckey])
|
||||
GLOB.open_logging_views[usr.client.ckey] = new /datum/log_viewer()
|
||||
var/datum/log_viewer/LV = GLOB.open_logging_views[usr.client.ckey]
|
||||
LV.show_ui(usr)
|
||||
/client/proc/open_logging_view(list/mob/mobs_to_add = null, clear_view = FALSE)
|
||||
var/datum/log_viewer/cur_view = GLOB.open_logging_views[usr.client.ckey]
|
||||
if(!cur_view)
|
||||
cur_view = new /datum/log_viewer()
|
||||
GLOB.open_logging_views[usr.client.ckey] = cur_view
|
||||
else if(clear_view)
|
||||
cur_view.clear_all()
|
||||
|
||||
if(mobs_to_add?.len)
|
||||
cur_view.add_mobs(mobs_to_add)
|
||||
|
||||
cur_view.show_ui(usr)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user