forked from DaedalusDock/daedalusdock
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathadmin_investigate.dm
66 lines (54 loc) · 1.77 KB
/
admin_investigate.dm
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
/atom/proc/investigate_log(message, subject)
if(!message || !subject)
return
var/source = "[src]"
if(isliving(src))
var/mob/living/source_mob = src
source += " ([source_mob.ckey ? source_mob.ckey : "*no key*"])"
rustg_file_append("[time_stamp("YYYY-MM-DD hh:mm:ss")] [REF(src)] ([x],[y],[z]) || [source] [message]<br>", "[GLOB.log_directory]/[subject].html")
/client/proc/investigate_show()
set name = "Investigate"
set category = "Admin.Game"
if(!holder)
return
var/list/investigates = list(
INVESTIGATE_ACCESSCHANGES,
INVESTIGATE_ATMOS,
INVESTIGATE_BOTANY,
INVESTIGATE_CARGO,
INVESTIGATE_CRAFTING,
INVESTIGATE_ENGINE,
INVESTIGATE_EXPERIMENTOR,
INVESTIGATE_GRAVITY,
INVESTIGATE_HALLUCINATIONS,
INVESTIGATE_HYPERTORUS,
INVESTIGATE_PORTAL,
INVESTIGATE_PRESENTS,
INVESTIGATE_RADIATION,
INVESTIGATE_RECORDS,
INVESTIGATE_RESEARCH,
INVESTIGATE_WIRES,
)
var/list/logs_present = list("notes, memos, watchlist")
var/list/logs_missing = list("---")
for(var/subject in investigates)
var/temp_file = file("[GLOB.log_directory]/[subject].html")
if(fexists(temp_file))
logs_present += subject
else
logs_missing += "[subject] (empty)"
var/list/combined = sort_list(logs_present) + sort_list(logs_missing)
var/selected = tgui_input_list(src, "Investigate what?", "Investigation", combined)
if(isnull(selected))
return
if(!(selected in combined) || selected == "---")
return
selected = replacetext(selected, " (empty)", "")
if(selected == "notes, memos, watchlist" && check_rights(R_ADMIN))
browse_messages()
return
var/F = file("[GLOB.log_directory]/[selected].html")
if(!fexists(F))
to_chat(src, span_danger("No [selected] logfile was found."), confidential = TRUE)
return
src << browse(F,"window=investigate[selected];size=800x300")