Atmos analyzer update

This commit is contained in:
Markolie
2015-09-27 04:48:42 +02:00
parent ee130ccbbe
commit f5f27fa186
6 changed files with 32 additions and 73 deletions
+11 -69
View File
@@ -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 = "<html><head><title>AI PDA Message Log</title></head><body>"
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 << "<span class='notice'>PDA sender/receiver toggled [(toff ? "Off" : "On")]!</span>"
@@ -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 << "<span class='notice'>PDA ringer toggled [(silent ? "Off" : "On")]!</span>"
/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 << "<span class='notice'>This PDA does not have an ID in it.</span>"
@@ -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 << "<span class='notice'>\The [src] rejects the ID.</span>"
return
if(!owner)
@@ -1042,14 +1030,12 @@ var/global/list/obj/item/device/pda/PDAs = list()
ownrank = idcard.rank
name = "PDA-[owner] ([ownjob])"
user << "<span class='notice'>Card scanned.</span>"
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 << "<span class='notice'>You put the ID into \the [src]'s slot.</span>"
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 << "<span class='notice'>You slot \the [C] into [src].</span>"
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 << "<span class='notice'>You slide \the [C] into \the [src].</span>"
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 << "<span class='notice'>[reagents_length] chemical agent[reagents_length > 1 ? "s" : ""] found.</span>"
for (var/re in A.reagents.reagent_list)
user << "\blue \t [re]"
user << "<span class='notice'>\t [re]</span>"
else
user << "\blue No active chemical agents found in [A]."
user << "<span class='notice'>No active chemical agents found in [A].</span>"
else
user << "\blue No significant chemical agents found in [A]."
user << "<span class='notice'>No significant chemical agents found in [A].</span>"
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+"<br>" // 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 + "<br><br>"
// Store the scanned document to the notes
note = "Scanned Document. Edit to restore previous notes/delete scan.<br>----------<br>" + formatted_scan + "<br>"
// 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]")