From f5f27fa186f1bb20048cf7a260b821ac6397f847 Mon Sep 17 00:00:00 2001 From: Markolie Date: Sun, 27 Sep 2015 04:48:42 +0200 Subject: [PATCH] Atmos analyzer update --- .../components/unary_devices/tank.dm | 7 ++ code/ATMOSPHERICS/pipes/pipe.dm | 10 +++ code/__HELPERS/unsorted.dm | 2 +- code/game/jobs/job_controller.dm | 1 - code/game/machinery/atmoalter/scrubber.dm | 5 +- code/game/objects/items/devices/PDA/PDA.dm | 80 +++---------------- 6 files changed, 32 insertions(+), 73 deletions(-) diff --git a/code/ATMOSPHERICS/components/unary_devices/tank.dm b/code/ATMOSPHERICS/components/unary_devices/tank.dm index 88f32eba44a..7c7298c511d 100644 --- a/code/ATMOSPHERICS/components/unary_devices/tank.dm +++ b/code/ATMOSPHERICS/components/unary_devices/tank.dm @@ -16,6 +16,13 @@ if(!istype(T)) return add_underlay(T, node, dir) + +/obj/machinery/atmospherics/unary/tank/attackby(obj/item/weapon/W, mob/user, params) + if(istype(W, /obj/item/device/analyzer)) + atmosanalyzer_scan(air_contents, user) + return + + return ..() /obj/machinery/atmospherics/unary/tank/air name = "Pressure Tank (Air)" diff --git a/code/ATMOSPHERICS/pipes/pipe.dm b/code/ATMOSPHERICS/pipes/pipe.dm index 3f3a21e7789..7041d13993d 100644 --- a/code/ATMOSPHERICS/pipes/pipe.dm +++ b/code/ATMOSPHERICS/pipes/pipe.dm @@ -36,6 +36,16 @@ if(parent && isnull(parent.gcDestroyed)) qdel(parent) parent = null + +/obj/machinery/atmospherics/pipe/attackby(obj/item/weapon/W, mob/user, params) + if(istype(W, /obj/item/device/analyzer)) + atmosanalyzer_scan(parent.air, user) + return + + if(istype(W,/obj/item/device/pipe_painter)) + return + + return ..() /obj/machinery/atmospherics/proc/pipeline_expansion() return null diff --git a/code/__HELPERS/unsorted.dm b/code/__HELPERS/unsorted.dm index 21de59e0216..0458944e956 100644 --- a/code/__HELPERS/unsorted.dm +++ b/code/__HELPERS/unsorted.dm @@ -334,7 +334,7 @@ Turf and target are seperate in case you want to teleport some distance from a t /obj/proc/atmosanalyzer_scan(var/datum/gas_mixture/air_contents, mob/user, var/obj/target = src) var/obj/icon = target - user.visible_message("[user] has used the analyzer on \icon[icon] [target].", "You use the analyzer on \icon[icon] [target].") + user.visible_message("[user] has used the analyzer on [target].", "You use the analyzer on [target].") var/pressure = air_contents.return_pressure() var/total_moles = air_contents.total_moles() diff --git a/code/game/jobs/job_controller.dm b/code/game/jobs/job_controller.dm index e80d9dfe889..03f4f6998a9 100644 --- a/code/game/jobs/job_controller.dm +++ b/code/game/jobs/job_controller.dm @@ -541,7 +541,6 @@ var/global/datum/controller/occupations/job_master pda.ownjob = C.assignment pda.ownrank = C.rank pda.name = "PDA-[H.real_name] ([pda.ownjob])" - pda.JFLOG("Created") return 1 diff --git a/code/game/machinery/atmoalter/scrubber.dm b/code/game/machinery/atmoalter/scrubber.dm index 5ab92bd3088..a62f87ee098 100644 --- a/code/game/machinery/atmoalter/scrubber.dm +++ b/code/game/machinery/atmoalter/scrubber.dm @@ -205,8 +205,9 @@ user << "You [anchored ? "wrench" : "unwrench"] \the [src]." return - ..() - + else if ((istype(W, /obj/item/device/analyzer)) && get_dist(user, src) <= 1) + atmosanalyzer_scan(air_contents, user) + /obj/machinery/portable_atmospherics/scrubber/huge/stationary name = "Stationary Air Scrubber" stationary = 1 \ No newline at end of file diff --git a/code/game/objects/items/devices/PDA/PDA.dm b/code/game/objects/items/devices/PDA/PDA.dm index 74c1f2f51ff..7928450f083 100755 --- a/code/game/objects/items/devices/PDA/PDA.dm +++ b/code/game/objects/items/devices/PDA/PDA.dm @@ -284,7 +284,6 @@ var/global/list/obj/item/device/pda/PDAs = list() if(usr.stat == 2) usr << "You can't do that because you are dead!" return - JFLOG("AI Showed Message Log") var/HTML = "AI PDA Message Log" for(var/index in tnote) if(index["sent"]) @@ -301,7 +300,6 @@ var/global/list/obj/item/device/pda/PDAs = list() if(usr.stat == 2) usr << "You can't do that because you are dead!" return - JFLOG("AI Toggled Receiver") toff = !toff usr << "PDA sender/receiver toggled [(toff ? "Off" : "On")]!" @@ -314,7 +312,6 @@ var/global/list/obj/item/device/pda/PDAs = list() usr << "You can't do that because you are dead!" return silent=!silent - JFLOG("AI toggled the silent option") usr << "PDA ringer toggled [(silent ? "Off" : "On")]!" /obj/item/device/pda/ai/can_use() @@ -325,7 +322,6 @@ var/global/list/obj/item/device/pda/PDAs = list() if ((honkamt > 0) && (prob(60)))//For clown virus. honkamt-- playsound(loc, 'sound/items/bikehorn.ogg', 30, 1) - JFLOG("[user] PDA honked") return @@ -528,15 +524,11 @@ var/global/list/obj/item/device/pda/PDAs = list() /obj/item/device/pda/attack_self(mob/user as mob) user.set_machine(src) if(active_uplink_check(user)) - JFLOG("[user] activated a syndicate uplink in their PDA") return - JFLOG("[user] activated PDA") ui_interact(user) //NanoUI requires this proc return /obj/item/device/pda/Topic(href, href_list) - if (href_list["choice"]!="Return") // We really don't need to see ten thousand return actions. - JFLOG("UI Action >>> HREF|[href] >>> HREF_LIST|[list2json(href_list)]") if(href_list["cartmenu"] && !isnull(cartridge)) cartridge.Topic(href, href_list) return 1 @@ -964,7 +956,6 @@ var/global/list/obj/item/device/pda/PDAs = list() if ( can_use(usr) ) if(id) - JFLOG("[usr] removed ID:[id]") remove_id() else usr << "This PDA does not have an ID in it." @@ -981,7 +972,6 @@ var/global/list/obj/item/device/pda/PDAs = list() return if ( can_use(usr) ) - JFLOG("[usr] removed pen") var/obj/item/weapon/pen/O = locate() in src if(O) if (istype(loc, /mob)) @@ -1021,7 +1011,6 @@ var/global/list/obj/item/device/pda/PDAs = list() /obj/item/device/pda/attackby(obj/item/C as obj, mob/user as mob, params) ..() if(istype(C, /obj/item/weapon/cartridge) && !cartridge) - JFLOG("[user] inserted Cartridge[cartridge]") cartridge = C user.drop_item() cartridge.loc = src @@ -1033,7 +1022,6 @@ var/global/list/obj/item/device/pda/PDAs = list() else if(istype(C, /obj/item/weapon/card/id)) var/obj/item/weapon/card/id/idcard = C if(!idcard.registered_name) - JFLOG("[user] tried to insert ID:[idcard] but it was rejected.") user << "\The [src] rejects the ID." return if(!owner) @@ -1042,14 +1030,12 @@ var/global/list/obj/item/device/pda/PDAs = list() ownrank = idcard.rank name = "PDA-[owner] ([ownjob])" user << "Card scanned." - JFLOG("[user] tried to insert ID:[idcard] and it was used to initialize this PDA.") else //Basic safety check. If either both objects are held by user or PDA is on ground and card is in hand. if(((src in user.contents) && (C in user.contents)) || (istype(loc, /turf) && in_range(src, user) && (C in user.contents)) ) if( can_use(user) )//If they can still act. id_check(user, 2) user << "You put the ID into \the [src]'s slot." - JFLOG("[user] inserted ID:[idcard].") updateSelfDialog()//Update self dialog on success. return //Return in case of failed check or when successful. updateSelfDialog()//For the non-input related code. @@ -1058,7 +1044,6 @@ var/global/list/obj/item/device/pda/PDAs = list() C.loc = src pai = C user << "You slot \the [C] into [src]." - JFLOG("[user] inserted PAI:[pai]") nanomanager.update_uis(src) // update all UIs attached to src else if(istype(C, /obj/item/weapon/pen)) var/obj/item/weapon/pen/O = locate() in src @@ -1067,7 +1052,6 @@ var/global/list/obj/item/device/pda/PDAs = list() else user.drop_item() C.loc = src - JFLOG("[user] inserted PEN:[C]") user << "You slide \the [C] into \the [src]." return @@ -1075,7 +1059,6 @@ var/global/list/obj/item/device/pda/PDAs = list() if (istype(C, /mob/living/carbon)) switch(scanmode) if(1) - JFLOG("[user] used the medical scanner on [C]") for (var/mob/O in viewers(C, null)) O.show_message("\red [user] has analyzed [C]'s vitals!", 1) @@ -1097,7 +1080,6 @@ var/global/list/obj/item/device/pda/PDAs = list() user.show_message("\blue \t Limbs are OK.",1) if(2) - JFLOG("[user] used the fingerprint scanner on [C]") if (!istype(C:dna, /datum/dna)) user << "\blue No fingerprints found on [C]" else @@ -1113,7 +1095,6 @@ var/global/list/obj/item/device/pda/PDAs = list() user << "\blue Blood type: [C:blood_DNA[blood]]\nDNA: [blood]" if(4) - JFLOG("[user] used the radiation scanner on [C]") for (var/mob/O in viewers(C, null)) O.show_message("\red [user] has analyzed [C]'s radiation levels!", 1) @@ -1128,22 +1109,18 @@ var/global/list/obj/item/device/pda/PDAs = list() switch(scanmode) if(3) - JFLOG("[user] used the reagent scanner on [A]") - if(!isobj(A)) - return if(!isnull(A.reagents)) if(A.reagents.reagent_list.len > 0) var/reagents_length = A.reagents.reagent_list.len - user << "\blue [reagents_length] chemical agent[reagents_length > 1 ? "s" : ""] found." + user << "[reagents_length] chemical agent[reagents_length > 1 ? "s" : ""] found." for (var/re in A.reagents.reagent_list) - user << "\blue \t [re]" + user << "\t [re]" else - user << "\blue No active chemical agents found in [A]." + user << "No active chemical agents found in [A]." else - user << "\blue No significant chemical agents found in [A]." + user << "No significant chemical agents found in [A]." if(5) - JFLOG("[user] used the air analysis scanner on [A]") if (istype(A, /obj/item/weapon/tank)) var/obj/item/weapon/tank/T = A atmosanalyzer_scan(T.air_contents, user, T) @@ -1159,59 +1136,51 @@ var/global/list/obj/item/device/pda/PDAs = list() else if (istype(A, /obj/item/weapon/flamethrower)) var/obj/item/weapon/flamethrower/T = A if(T.ptank) atmosanalyzer_scan(T.ptank.air_contents, user, T) + else if (istype(A, /obj/machinery/portable_atmospherics/scrubber/huge)) + var/obj/machinery/portable_atmospherics/scrubber/huge/T = A + atmosanalyzer_scan(T.air_contents, user, T) + else if (istype(A, /obj/machinery/atmospherics/unary/tank)) + var/obj/machinery/atmospherics/unary/tank/T = A + atmosanalyzer_scan(T.air_contents, user, T) if (!scanmode && istype(A, /obj/item/weapon/paper) && owner) - JFLOG("[user] used the document scanner on [A]") // JMO 20140705: Makes scanned document show up properly in the notes. Not pretty for formatted documents, // as this will clobber the HTML, but at least it lets you scan a document. You can restore the original // notes by editing the note again. (Was going to allow you to edit, but scanned documents are too long.) var/raw_scan = (A:info) var/formatted_scan = "" // Scrub out the tags (replacing a few formatting ones along the way) - // Find the beginning and end of the first tag. var/tag_start = findtext(raw_scan,"<") var/tag_stop = findtext(raw_scan,">") - // Until we run out of complete tags... while(tag_start&&tag_stop) var/pre = copytext(raw_scan,1,tag_start) // Get the stuff that comes before the tag var/tag = lowertext(copytext(raw_scan,tag_start+1,tag_stop)) // Get the tag so we can do intellegent replacement var/tagend = findtext(tag," ") // Find the first space in the tag if there is one. - // Anything that's before the tag can just be added as is. formatted_scan = formatted_scan+pre - // If we have a space after the tag (and presumably attributes) just crop that off. if (tagend) tag=copytext(tag,1,tagend) - if (tag=="p"||tag=="/p"||tag=="br") // Check if it's I vertical space tag. formatted_scan=formatted_scan+"
" // If so, add some padding in. - raw_scan = copytext(raw_scan,tag_stop+1) // continue on with the stuff after the tag - // Look for the next tag in what's left tag_start = findtext(raw_scan,"<") tag_stop = findtext(raw_scan,">") - // Anything that is left in the page. just tack it on to the end as is formatted_scan=formatted_scan+raw_scan - // If there is something in there already, pad it out. if (length(note)>0) note = note + "

" - // Store the scanned document to the notes note = "Scanned Document. Edit to restore previous notes/delete scan.
----------
" + formatted_scan + "
" // notehtml ISN'T set to allow user to get their old notes back. A better implementation would add a "scanned documents" // feature to the PDA, which would better convey the availability of the feature, but this will work for now. - // Inform the user user << "\blue Paper scanned and OCRed to notekeeper." //concept of scanning paper copyright brainoblivion 2009 - - /obj/item/device/pda/proc/explode() //This needs tuning. if(!src.detonate) return var/turf/T = get_turf(src.loc) @@ -1224,12 +1193,10 @@ var/global/list/obj/item/device/pda/PDAs = list() T.hotspot_expose(700,125) explosion(T, -1, -1, 2, 3) - JFLOG("Exploded") qdel(src) return /obj/item/device/pda/Destroy() - JFLOG("Destroyed") PDAs -= src if (src.id) src.id.loc = get_turf(src.loc) @@ -1249,7 +1216,6 @@ var/global/list/obj/item/device/pda/PDAs = list() M.stop_pulling() M << "\blue You slipped on the PDA!" - JFLOG("Clown PDA Slipped [M]") playsound(src.loc, 'sound/misc/slip.ogg', 50, 1, -3) M.Stun(8) M.Weaken(5) @@ -1310,28 +1276,4 @@ var/global/list/obj/item/device/pda/PDAs = list() /obj/item/device/pda/emp_act(severity) for(var/atom/A in src) A.emp_act(severity) - -/** -* -* JFLOG -* -* These functions as well as all the log statements are being used to gather user data for how -* people are using the PDA files with the intent of revising them based on this data. -* -* They are being added on 28/03/2015 and the intent is to remove them in two weeks. If you're -* reading this and it's substantially past that point, you should remove anything marked with -* 'JFLOG'. -* -* All changes should be contained to PDA.dm except the creation function which is contained in -* job_controller.dm. -* -* - Jack Fractal -**/ - - -/obj/item/device/pda/proc/JFLOG_DescribeSelf() - return "([src]|[cartridge ? cartridge.name : "None"])" - -/obj/item/device/pda/proc/JFLOG(message as text) - if (config) - log_pda("[JFLOG_DescribeSelf()] >>> [message]") + \ No newline at end of file