Merge pull request #691 from jack-fractal/pda_logs

Adding extra logging information to PDA for refactor prep
This commit is contained in:
ZomgPonies
2015-03-29 01:02:05 -04:00
2 changed files with 54 additions and 6 deletions
+53 -6
View File
@@ -275,6 +275,7 @@ 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"])
@@ -291,6 +292,7 @@ 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>"
@@ -303,6 +305,7 @@ 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()
@@ -313,6 +316,7 @@ 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
@@ -520,16 +524,17 @@ var/global/list/obj/item/device/pda/PDAs = list()
//NOTE: graphic resources are loaded on client login
/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
@@ -879,7 +884,9 @@ var/global/list/obj/item/device/pda/PDAs = list()
message += "It melts in a puddle of plastic."
else
message += "Your [P] shatters in a thousand pieces!"
JFLOG("[M]'s PDA Detonated >>> [message]")
if(M && isliving(M))
message = "\red" + message
M.show_message(message, 1)
@@ -1003,6 +1010,7 @@ 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>"
@@ -1019,6 +1027,7 @@ 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))
@@ -1058,6 +1067,7 @@ 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
@@ -1069,6 +1079,7 @@ 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)
@@ -1077,12 +1088,14 @@ 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.
@@ -1091,6 +1104,7 @@ 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
@@ -1099,6 +1113,7 @@ 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
@@ -1106,7 +1121,7 @@ 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)
@@ -1128,6 +1143,7 @@ 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 if(!istype(C, /mob/living/carbon/monkey))
@@ -1146,6 +1162,7 @@ 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)
@@ -1160,6 +1177,7 @@ 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))
@@ -1174,6 +1192,7 @@ var/global/list/obj/item/device/pda/PDAs = list()
user << "\blue 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)) || (istype(A, /obj/machinery/portable_atmospherics)))
var/obj/icon = A
for (var/mob/O in viewers(user, null))
@@ -1232,6 +1251,7 @@ var/global/list/obj/item/device/pda/PDAs = list()
user << "\blue Tank is empty!"
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.)
@@ -1294,11 +1314,12 @@ var/global/list/obj/item/device/pda/PDAs = list()
T.hotspot_expose(700,125)
explosion(T, -1, -1, 2, 3)
JFLOG("Exploded")
del(src)
return
/obj/item/device/pda/Destroy()
JFLOG("Destroyed")
PDAs -= src
if (src.id)
src.id.loc = get_turf(src.loc)
@@ -1318,6 +1339,7 @@ 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)
@@ -1378,3 +1400,28 @@ 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]")