Added a new logging system that can be used for various things in the game (such as the singularity engine, AI interactions, anything-else that may be suggested to me :P).

At the moment it only logs some singularity things. Please let me know if there are any important methods of singulo-grief which I may have missed.

The "Investigate" verb is available to everyone of rank "Admin observer" and upwards. Just type "Investigate" and select the subject you'd like to see logs for. Typing "Investigate singulo" will also work as a shortcut.


git-svn-id: http://tgstation13.googlecode.com/svn/trunk@3679 316c924e-a436-60f5-8080-3fe189b3f50e
This commit is contained in:
elly1989@rocketmail.com
2012-05-27 01:31:57 +00:00
parent 6b9895ecb4
commit d7c9e72a29
14 changed files with 100 additions and 32 deletions

View File

@@ -79,12 +79,12 @@
src.load_motd() src.load_motd()
src.load_rules() src.load_rules()
src.load_admins() src.load_admins()
investigate_reset()
if (config.usewhitelist) if (config.usewhitelist)
load_whitelist() load_whitelist()
LoadBansjob() LoadBansjob()
Get_Holiday() //~Carn, needs to be here when the station is named so :P Get_Holiday() //~Carn, needs to be here when the station is named so :P
src.update_status() src.update_status()
makepowernets() makepowernets()
sun = new /datum/sun() sun = new /datum/sun()

View File

@@ -46,6 +46,7 @@
user << "\red The Bluespace generator isn't working." user << "\red The Bluespace generator isn't working."
return return
if(istype(W, /obj/item/weapon/storage/backpack/holding) && !W.crit_fail) if(istype(W, /obj/item/weapon/storage/backpack/holding) && !W.crit_fail)
investigate_log("has become a singularity. Caused by [user.key]","singulo")
user << "\red The Bluespace interfaces of the two devices catastrophically malfunction!" user << "\red The Bluespace interfaces of the two devices catastrophically malfunction!"
del(W) del(W)
var/obj/machinery/singularity/singulo = new /obj/machinery/singularity (get_turf(src)) var/obj/machinery/singularity/singulo = new /obj/machinery/singularity (get_turf(src))

View File

@@ -0,0 +1,43 @@
//By Carnwennan
//This system was made as an alternative to all the in-game lists and variables used to log stuff in-game.
//lists and variables are great. However, they have several major flaws:
//Firstly, they use memory. TGstation has one of the highest memory usage of all the ss13 branches.
//Secondly, they are usually stored in an object. This means that they aren't centralised. It also means that
//the data is lost when the object is deleted! This is especially annoying for things like the singulo engine!
#define INVESTIGATE_DIR "data/investigate/"
//SYSTEM
/proc/investigate_subject2file(var/subject)
switch(subject)
if("singulo")
return file("[INVESTIGATE_DIR]singulo.html")
if("silicon")
return file("[INVESTIGATE_DIR]silicon.html")
else
return
/proc/investigate_reset()
if(fdel(INVESTIGATE_DIR)) return 1
return 0
/atom/proc/investigate_log(var/message, var/subject)
if(!message) return
var/F = investigate_subject2file(subject)
if(!F) return
F << "[src] \ref[src] ([x],[y],[z]) [message]<br>"
//ADMINVERBS
/client/proc/investigate_show( subject in list("singulo","silicon") )
set name = "Investigate"
set category = "Admin"
if(!holder) return
var/F = investigate_subject2file(subject)
if(!F)
src << "<font color='red'>Error: admin_investigate: [INVESTIGATE_DIR][subject] is an invalid path or cannot be accessed.</font>"
return
src << browse(F,"window=investigate;title='investigate [subject]'")

View File

@@ -102,6 +102,7 @@
//Admin Observer //Admin Observer
if (holder.level >= -1) if (holder.level >= -1)
verbs += /client/proc/investigate_show
verbs += /client/proc/cmd_admin_say verbs += /client/proc/cmd_admin_say
verbs += /client/proc/cmd_admin_gib_self verbs += /client/proc/cmd_admin_gib_self
verbs += /client/proc/deadmin_self verbs += /client/proc/deadmin_self
@@ -404,6 +405,7 @@
verbs -= /client/proc/getserverlog verbs -= /client/proc/getserverlog
verbs -= /client/proc/cinematic //show a cinematic sequence verbs -= /client/proc/cinematic //show a cinematic sequence
verbs -= /client/proc/admin_memo verbs -= /client/proc/admin_memo
verbs -= /client/proc/investigate_show //investigate in-game mishaps using various logs.
verbs -= /proc/possess verbs -= /proc/possess
verbs -= /proc/release verbs -= /proc/release
//verbs -= /client/proc/give_spell --Merged with view variables //verbs -= /client/proc/give_spell --Merged with view variables

View File

@@ -33,6 +33,7 @@
toggle_power() toggle_power()
user.visible_message("[user.name] turns the [src.name] [active? "on":"off"].", \ user.visible_message("[user.name] turns the [src.name] [active? "on":"off"].", \
"You turn the [src.name] [active? "on":"off"].") "You turn the [src.name] [active? "on":"off"].")
investigate_log("turned [active?"<font color='green'>on</font>":"<font color='red'>off</font>"] by [user.key]. [P?"It contains [P]":"It is empty"].","singulo")
return return
else else
user << "\red The controls are locked!" user << "\red The controls are locked!"
@@ -135,7 +136,6 @@
if(active) if(active)
icon_state = "ca_on" icon_state = "ca_on"
flick("ca_active", src) flick("ca_active", src)
else else
icon_state = "ca" icon_state = "ca"
flick("ca_deactive", src) flick("ca_deactive", src)

View File

@@ -37,6 +37,9 @@
..() ..()
return return
Del()
investigate_log("<font color='red'>deleted</font> at ([x],[y],[z])","singulo")
..()
update_icon() update_icon()
if (active && !(stat & (NOPOWER|BROKEN))) if (active && !(stat & (NOPOWER|BROKEN)))
@@ -53,12 +56,14 @@
src.active = 0 src.active = 0
user << "You turn off the [src]." user << "You turn off the [src]."
src.use_power = 1 src.use_power = 1
investigate_log("turned <font color='red'>off</font> by [user.key]","singulo")
else else
src.active = 1 src.active = 1
user << "You turn on the [src]." user << "You turn on the [src]."
src.shot_number = 0 src.shot_number = 0
src.fire_delay = 100 src.fire_delay = 100
src.use_power = 2 src.use_power = 2
investigate_log("turned <font color='green'>on</font> by [user.key]","singulo")
update_icon() update_icon()
else else
user << "\red The controls are locked!" user << "\red The controls are locked!"

View File

@@ -87,6 +87,8 @@ field_generator power level display
"You turn on the [src.name].", \ "You turn on the [src.name].", \
"You hear heavy droning") "You hear heavy droning")
turn_on() turn_on()
investigate_log("<font color='green'>activated</font> by [user.key].","singulo")
src.add_fingerprint(user) src.add_fingerprint(user)
else else
user << "The [src] needs to be firmly secured to the floor first." user << "The [src] needs to be firmly secured to the floor first."
@@ -214,6 +216,7 @@ field_generator power level display
for(var/mob/M in viewers(src)) for(var/mob/M in viewers(src))
M.show_message("\red The [src.name] shuts down!") M.show_message("\red The [src.name] shuts down!")
turn_off() turn_off()
investigate_log("ran out of power and <font color='red'>deactivated</font>","singulo")
src.power = 0 src.power = 0
return 0 return 0
@@ -344,4 +347,5 @@ field_generator power level display
if((world.time - O.last_warning) > 50) //to stop message-spam if((world.time - O.last_warning) > 50) //to stop message-spam
temp = 0 temp = 0
message_admins("A singulo exists and a containment field has failed.",1) message_admins("A singulo exists and a containment field has failed.",1)
investigate_log("has <font color='red'>failed</font> whilst a singulo exists.","singulo")
O.last_warning = world.time O.last_warning = world.time

View File

@@ -0,0 +1,4 @@
/area/engine/engineering/poweralert(var/state, var/source)
if (state != poweralm)
investigate_log("has a power alarm!","singulo")
..()

View File

@@ -152,6 +152,12 @@ So, hopefully this is helpful if any more icons are to be added/changed/wonderin
return return
Move()
..()
if(master && master.active)
master.toggle_power()
investigate_log("was moved whilst active; it <font color='red'>powered down</font>.","singulo")
ex_act(severity) ex_act(severity)
switch(severity) switch(severity)
if(1.0) if(1.0)
@@ -182,9 +188,7 @@ So, hopefully this is helpful if any more icons are to be added/changed/wonderin
update_icon() update_icon()
switch(construction_state) switch(construction_state)
if(0) if(0,1)
icon_state="[reference]"
if(1)
icon_state="[reference]" icon_state="[reference]"
if(2) if(2)
icon_state="[reference]w" icon_state="[reference]w"
@@ -376,7 +380,6 @@ So, hopefully this is helpful if any more icons are to be added/changed/wonderin
del(src) del(src)
return return
proc proc
update_state() update_state()
return 0 return 0

View File

@@ -49,7 +49,6 @@
if(use_power) if(use_power)
icon_state = "[reference]p" icon_state = "[reference]p"
else else
icon_state = "[reference]c"
switch(construction_state) switch(construction_state)
if(0) if(0)
icon_state = "[reference]" icon_state = "[reference]"
@@ -57,7 +56,7 @@
icon_state = "[reference]" icon_state = "[reference]"
if(2) if(2)
icon_state = "[reference]w" icon_state = "[reference]w"
if(3) else
icon_state = "[reference]c" icon_state = "[reference]c"
return return
@@ -79,27 +78,27 @@
return return
if(href_list["togglep"]) if(href_list["togglep"])
src.toggle_power() src.toggle_power()
if(href_list["scan"]) investigate_log("turned [active?"<font color='red'>ON</font>":"<font color='green'>OFF</font>"] by [usr.key]","singulo") else if(href_list["scan"])
src.part_scan() src.part_scan()
if(href_list["strengthup"]) else if(href_list["strengthup"])
src.strength++ strength++
if(strength > 2)
strength = 2
else
investigate_log("increased to <font color='red'>[strength]</font> by [usr.key]","singulo")
strength = min(2,strength+1)
for(var/obj/structure/particle_accelerator/part in connected_parts) for(var/obj/structure/particle_accelerator/part in connected_parts)
part.strength++ part.strength = strength
part.update_icon() part.update_icon()
if(src.strength > 2)
src.strength = 2 else if(href_list["strengthdown"])
strength++
if(strength < 0)
strength = 0
else
investigate_log("decreased to <font color='green'>[strength]</font> by [usr.key]","singulo")
for(var/obj/structure/particle_accelerator/part in connected_parts) for(var/obj/structure/particle_accelerator/part in connected_parts)
part.strength = 2 part.strength = strength
part.update_icon()
if(href_list["strengthdown"])
src.strength--
for(var/obj/structure/particle_accelerator/part in connected_parts)
part.strength--
part.update_icon()
if(src.strength < 0)
src.strength = 0
for(var/obj/structure/particle_accelerator/part in connected_parts)
part.strength = 0
part.update_icon() part.update_icon()
src.updateDialog() src.updateDialog()
src.update_icon() src.update_icon()
@@ -118,14 +117,15 @@
process() process()
if(src.active) if(src.active)
//a part is missing!
if( length(connected_parts) < 6 )
investigate_log("lost a connected part; It <font color='red'>powered down</font>.","singulo")
src.toggle_power()
return
//emit some particles
for(var/obj/structure/particle_accelerator/particle_emitter/PE in connected_parts) for(var/obj/structure/particle_accelerator/particle_emitter/PE in connected_parts)
if(PE) if(PE)
PE.emit_particle(src.strength) PE.emit_particle(src.strength)
// for(var/obj/structure/particle_accelerator/fuel_chamber/PF in connected_parts)
// PF.doshit()
// for(var/obj/structure/particle_accelerator/power_box/PB in connected_parts)
// PB.doshit()
//finish up putting the fuel run and power use things in here
return return

View File

@@ -40,6 +40,7 @@ var/global/list/uneatable = list(
count = 1 count = 1
break break
if(!count) message_admins("A singulo has been created without containment fields active ([x],[y],[z])",1) if(!count) message_admins("A singulo has been created without containment fields active ([x],[y],[z])",1)
investigate_log("was created. [count?"":"<font color='red'>No containment fields were active</font>"]","singulo")
src.energy = starting_energy src.energy = starting_energy
if(temp) if(temp)

View File

@@ -294,7 +294,7 @@
output += d output += d
output = max(0, min(SMESMAXOUTPUT, output)) // clamp to range output = max(0, min(SMESMAXOUTPUT, output)) // clamp to range
investigate_log("input/output; [chargelevel>output?"<font color='green'>":"<font color='red'>"][chargelevel]/[output]</font> | Output-mode: [online?"<font color='green'>on</font>":"<font color='red'>off</font>"] | Input-mode: [chargemode?"<font color='green'>auto</font>":"<font color='red'>off</font>"] by [usr.key]","singulo")
src.updateUsrDialog() src.updateUsrDialog()
else else

View File

@@ -343,6 +343,7 @@ won't update every console in existence) but it's more of a hassle to do. Also,
screen = 0.3 screen = 0.3
linked_lathe.busy = 1 linked_lathe.busy = 1
flick("protolathe_n",linked_lathe) flick("protolathe_n",linked_lathe)
var/key = usr.key //so we don't lose the info during the spawn delay
spawn(16) spawn(16)
use_power(power) use_power(power)
spawn(16) spawn(16)
@@ -369,6 +370,8 @@ won't update every console in existence) but it's more of a hassle to do. Also,
if(being_built.build_path) if(being_built.build_path)
var/obj/new_item = new being_built.build_path(src) var/obj/new_item = new being_built.build_path(src)
if( new_item.type == /obj/item/weapon/storage/backpack/holding )
new_item.investigate_log("built by [key]","singulo")
new_item.reliability = being_built.reliability new_item.reliability = being_built.reliability
if(linked_lathe.hacked) being_built.reliability = max((reliability / 2), 0) if(linked_lathe.hacked) being_built.reliability = max((reliability / 2), 0)
if(being_built.locked) if(being_built.locked)

View File

@@ -739,6 +739,7 @@
#include "code\js\byjax.dm" #include "code\js\byjax.dm"
#include "code\js\menus.dm" #include "code\js\menus.dm"
#include "code\modules\admin\admin.dm" #include "code\modules\admin\admin.dm"
#include "code\modules\admin\admin_investigate.dm"
#include "code\modules\admin\admin_memo.dm" #include "code\modules\admin\admin_memo.dm"
#include "code\modules\admin\admin_verbs.dm" #include "code\modules\admin\admin_verbs.dm"
#include "code\modules\admin\banjob.dm" #include "code\modules\admin\banjob.dm"
@@ -1011,6 +1012,7 @@
#include "code\modules\power\singularity\emitter.dm" #include "code\modules\power\singularity\emitter.dm"
#include "code\modules\power\singularity\field_generator.dm" #include "code\modules\power\singularity\field_generator.dm"
#include "code\modules\power\singularity\generator.dm" #include "code\modules\power\singularity\generator.dm"
#include "code\modules\power\singularity\investigate.dm"
#include "code\modules\power\singularity\singularity.dm" #include "code\modules\power\singularity\singularity.dm"
#include "code\modules\power\singularity\particle_accelerator\particle.dm" #include "code\modules\power\singularity\particle_accelerator\particle.dm"
#include "code\modules\power\singularity\particle_accelerator\particle_accelerator.dm" #include "code\modules\power\singularity\particle_accelerator\particle_accelerator.dm"