diff --git a/code/game/cellautomata.dm b/code/game/cellautomata.dm index 7edc875697..894c7819b7 100644 --- a/code/game/cellautomata.dm +++ b/code/game/cellautomata.dm @@ -79,12 +79,12 @@ src.load_motd() src.load_rules() src.load_admins() + investigate_reset() if (config.usewhitelist) load_whitelist() LoadBansjob() Get_Holiday() //~Carn, needs to be here when the station is named so :P src.update_status() - makepowernets() sun = new /datum/sun() diff --git a/code/game/objects/storage/backpack.dm b/code/game/objects/storage/backpack.dm index 388ce03811..2ca0a6e1c0 100644 --- a/code/game/objects/storage/backpack.dm +++ b/code/game/objects/storage/backpack.dm @@ -46,6 +46,7 @@ user << "\red The Bluespace generator isn't working." return 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!" del(W) var/obj/machinery/singularity/singulo = new /obj/machinery/singularity (get_turf(src)) diff --git a/code/modules/admin/admin_investigate.dm b/code/modules/admin/admin_investigate.dm new file mode 100644 index 0000000000..b2d7975584 --- /dev/null +++ b/code/modules/admin/admin_investigate.dm @@ -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]
" + + + +//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 << "Error: admin_investigate: [INVESTIGATE_DIR][subject] is an invalid path or cannot be accessed." + return + src << browse(F,"window=investigate;title='investigate [subject]'") + + diff --git a/code/modules/admin/admin_verbs.dm b/code/modules/admin/admin_verbs.dm index 5da52a016f..9e6e535884 100644 --- a/code/modules/admin/admin_verbs.dm +++ b/code/modules/admin/admin_verbs.dm @@ -102,6 +102,7 @@ //Admin Observer if (holder.level >= -1) + verbs += /client/proc/investigate_show verbs += /client/proc/cmd_admin_say verbs += /client/proc/cmd_admin_gib_self verbs += /client/proc/deadmin_self @@ -400,10 +401,11 @@ verbs -= /client/proc/jumptocoord verbs -= /client/proc/everyone_random verbs -= /client/proc/Set_Holiday - verbs -= /client/proc/giveruntimelog //used by coders to retrieve runtime logs + verbs -= /client/proc/giveruntimelog //used by coders to retrieve runtime logs verbs -= /client/proc/getserverlog verbs -= /client/proc/cinematic //show a cinematic sequence verbs -= /client/proc/admin_memo + verbs -= /client/proc/investigate_show //investigate in-game mishaps using various logs. verbs -= /proc/possess verbs -= /proc/release //verbs -= /client/proc/give_spell --Merged with view variables diff --git a/code/modules/power/singularity/collector.dm b/code/modules/power/singularity/collector.dm index d68cc23e78..1912a7a10e 100644 --- a/code/modules/power/singularity/collector.dm +++ b/code/modules/power/singularity/collector.dm @@ -33,6 +33,7 @@ toggle_power() user.visible_message("[user.name] turns the [src.name] [active? "on":"off"].", \ "You turn the [src.name] [active? "on":"off"].") + investigate_log("turned [active?"on":"off"] by [user.key]. [P?"It contains [P]":"It is empty"].","singulo") return else user << "\red The controls are locked!" @@ -135,7 +136,6 @@ if(active) icon_state = "ca_on" flick("ca_active", src) - else icon_state = "ca" flick("ca_deactive", src) diff --git a/code/modules/power/singularity/emitter.dm b/code/modules/power/singularity/emitter.dm index 24b6ed1be9..4196e8d8a9 100644 --- a/code/modules/power/singularity/emitter.dm +++ b/code/modules/power/singularity/emitter.dm @@ -37,6 +37,9 @@ ..() return + Del() + investigate_log("deleted at ([x],[y],[z])","singulo") + ..() update_icon() if (active && !(stat & (NOPOWER|BROKEN))) @@ -53,12 +56,14 @@ src.active = 0 user << "You turn off the [src]." src.use_power = 1 + investigate_log("turned off by [user.key]","singulo") else src.active = 1 user << "You turn on the [src]." src.shot_number = 0 src.fire_delay = 100 src.use_power = 2 + investigate_log("turned on by [user.key]","singulo") update_icon() else user << "\red The controls are locked!" diff --git a/code/modules/power/singularity/field_generator.dm b/code/modules/power/singularity/field_generator.dm index 993eb2c3a0..adce022bb8 100644 --- a/code/modules/power/singularity/field_generator.dm +++ b/code/modules/power/singularity/field_generator.dm @@ -87,6 +87,8 @@ field_generator power level display "You turn on the [src.name].", \ "You hear heavy droning") turn_on() + investigate_log("activated by [user.key].","singulo") + src.add_fingerprint(user) else 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)) M.show_message("\red The [src.name] shuts down!") turn_off() + investigate_log("ran out of power and deactivated","singulo") src.power = 0 return 0 @@ -344,4 +347,5 @@ field_generator power level display if((world.time - O.last_warning) > 50) //to stop message-spam temp = 0 message_admins("A singulo exists and a containment field has failed.",1) + investigate_log("has failed whilst a singulo exists.","singulo") O.last_warning = world.time diff --git a/code/modules/power/singularity/investigate.dm b/code/modules/power/singularity/investigate.dm new file mode 100644 index 0000000000..e601e21068 --- /dev/null +++ b/code/modules/power/singularity/investigate.dm @@ -0,0 +1,4 @@ +/area/engine/engineering/poweralert(var/state, var/source) + if (state != poweralm) + investigate_log("has a power alarm!","singulo") + ..() \ No newline at end of file diff --git a/code/modules/power/singularity/particle_accelerator/particle_accelerator.dm b/code/modules/power/singularity/particle_accelerator/particle_accelerator.dm index cd7066a313..6e3c7a2952 100644 --- a/code/modules/power/singularity/particle_accelerator/particle_accelerator.dm +++ b/code/modules/power/singularity/particle_accelerator/particle_accelerator.dm @@ -152,6 +152,12 @@ So, hopefully this is helpful if any more icons are to be added/changed/wonderin return + Move() + ..() + if(master && master.active) + master.toggle_power() + investigate_log("was moved whilst active; it powered down.","singulo") + ex_act(severity) switch(severity) if(1.0) @@ -182,9 +188,7 @@ So, hopefully this is helpful if any more icons are to be added/changed/wonderin update_icon() switch(construction_state) - if(0) - icon_state="[reference]" - if(1) + if(0,1) icon_state="[reference]" if(2) 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) return - proc update_state() return 0 diff --git a/code/modules/power/singularity/particle_accelerator/particle_control.dm b/code/modules/power/singularity/particle_accelerator/particle_control.dm index 3d24df1abc..c55a889923 100644 --- a/code/modules/power/singularity/particle_accelerator/particle_control.dm +++ b/code/modules/power/singularity/particle_accelerator/particle_control.dm @@ -49,7 +49,6 @@ if(use_power) icon_state = "[reference]p" else - icon_state = "[reference]c" switch(construction_state) if(0) icon_state = "[reference]" @@ -57,7 +56,7 @@ icon_state = "[reference]" if(2) icon_state = "[reference]w" - if(3) + else icon_state = "[reference]c" return @@ -79,28 +78,28 @@ return if(href_list["togglep"]) src.toggle_power() - if(href_list["scan"]) + investigate_log("turned [active?"ON":"OFF"] by [usr.key]","singulo") else if(href_list["scan"]) src.part_scan() - if(href_list["strengthup"]) - src.strength++ + else if(href_list["strengthup"]) + strength++ + if(strength > 2) + strength = 2 + else + investigate_log("increased to [strength] by [usr.key]","singulo") + strength = min(2,strength+1) for(var/obj/structure/particle_accelerator/part in connected_parts) - part.strength++ + part.strength = strength part.update_icon() - if(src.strength > 2) - src.strength = 2 - for(var/obj/structure/particle_accelerator/part in connected_parts) - part.strength = 2 - part.update_icon() - if(href_list["strengthdown"]) - src.strength-- + + else if(href_list["strengthdown"]) + strength++ + if(strength < 0) + strength = 0 + else + investigate_log("decreased to [strength] by [usr.key]","singulo") for(var/obj/structure/particle_accelerator/part in connected_parts) - part.strength-- + part.strength = 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() src.updateDialog() src.update_icon() return @@ -118,14 +117,15 @@ process() if(src.active) + //a part is missing! + if( length(connected_parts) < 6 ) + investigate_log("lost a connected part; It powered down.","singulo") + src.toggle_power() + return + //emit some particles for(var/obj/structure/particle_accelerator/particle_emitter/PE in connected_parts) if(PE) 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 diff --git a/code/modules/power/singularity/singularity.dm b/code/modules/power/singularity/singularity.dm index 51f9cfec47..82edb57622 100644 --- a/code/modules/power/singularity/singularity.dm +++ b/code/modules/power/singularity/singularity.dm @@ -40,6 +40,7 @@ var/global/list/uneatable = list( count = 1 break if(!count) message_admins("A singulo has been created without containment fields active ([x],[y],[z])",1) + investigate_log("was created. [count?"":"No containment fields were active"]","singulo") src.energy = starting_energy if(temp) diff --git a/code/modules/power/smes.dm b/code/modules/power/smes.dm index 37b00465ba..925325e1ce 100644 --- a/code/modules/power/smes.dm +++ b/code/modules/power/smes.dm @@ -294,7 +294,7 @@ output += d output = max(0, min(SMESMAXOUTPUT, output)) // clamp to range - + investigate_log("input/output; [chargelevel>output?"":""][chargelevel]/[output] | Output-mode: [online?"on":"off"] | Input-mode: [chargemode?"auto":"off"] by [usr.key]","singulo") src.updateUsrDialog() else diff --git a/code/modules/research/rdconsole.dm b/code/modules/research/rdconsole.dm index 9148b4bf13..cbfa7e9b55 100644 --- a/code/modules/research/rdconsole.dm +++ b/code/modules/research/rdconsole.dm @@ -343,6 +343,7 @@ won't update every console in existence) but it's more of a hassle to do. Also, screen = 0.3 linked_lathe.busy = 1 flick("protolathe_n",linked_lathe) + var/key = usr.key //so we don't lose the info during the spawn delay spawn(16) use_power(power) 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) 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 if(linked_lathe.hacked) being_built.reliability = max((reliability / 2), 0) if(being_built.locked) diff --git a/tgstation.dme b/tgstation.dme index b1a59d520a..276a434d2f 100644 --- a/tgstation.dme +++ b/tgstation.dme @@ -739,6 +739,7 @@ #include "code\js\byjax.dm" #include "code\js\menus.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_verbs.dm" #include "code\modules\admin\banjob.dm" @@ -1011,6 +1012,7 @@ #include "code\modules\power\singularity\emitter.dm" #include "code\modules\power\singularity\field_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\particle_accelerator\particle.dm" #include "code\modules\power\singularity\particle_accelerator\particle_accelerator.dm"