From b2d2bff7a2724be9ad9e16bf227aa595d27125d5 Mon Sep 17 00:00:00 2001 From: SkyMarshal Date: Mon, 14 May 2012 12:19:15 -0700 Subject: [PATCH] Add the capability for the NT chatbot pAI to use the PDA's messaging function instead of the system it had been. Also, several bugfixes for runtimes. --- code/WorkInProgress/Tastyfish/Eliza_Data.dm | 36 +++++--- code/game/gamemodes/traitor/traitor.dm | 4 +- .../game/machinery/computer/buildandrepair.dm | 23 ++--- code/game/objects/devices/PDA/PDA.dm | 12 ++- code/game/objects/effect_system.dm | 15 ++-- code/modules/DetectiveWork/detective_work.dm | 89 ++++++++++--------- code/modules/chemical/Chemistry-Reagents.dm | 48 +++++----- 7 files changed, 122 insertions(+), 105 deletions(-) diff --git a/code/WorkInProgress/Tastyfish/Eliza_Data.dm b/code/WorkInProgress/Tastyfish/Eliza_Data.dm index f84b7b20aca..438dd1f18a9 100644 --- a/code/WorkInProgress/Tastyfish/Eliza_Data.dm +++ b/code/WorkInProgress/Tastyfish/Eliza_Data.dm @@ -380,23 +380,31 @@ return "I couldn't find [name]'s PDA." // send message - pda.tnote += "← From [eliza.callsign]:
[object]
" + if(!istype(eliza.speaker.loc.loc, /obj/item/device/pda))//Looking if we are in a PDA + pda.tnote += "← From [eliza.callsign]:
[object]
" - if(prob(15) && eliza.speaker) //Give the AI a chance of intercepting the message - var/who = eliza.speaker - if(prob(50)) - who = "[eliza.speaker:master] via [eliza.speaker]" - for(var/mob/living/silicon/ai/ai in world) - ai.show_message("Intercepted message from [who]: [object]") + if(prob(15) && eliza.speaker) //Give the AI a chance of intercepting the message + var/who = eliza.speaker + if(prob(50)) + who = "[eliza.speaker:master] via [eliza.speaker]" + for(var/mob/living/silicon/ai/ai in world) + ai.show_message("Intercepted message from [who]: [object]") - if (!pda.silent) - playsound(pda.loc, 'twobeep.ogg', 50, 1) - for (var/mob/O in hearers(3, pda.loc)) - O.show_message(text("\icon[pda] *[pda.ttone]*")) - - pda.overlays = null - pda.overlays += image('pda.dmi', "pda-r") + if (!pda.silent) + playsound(pda.loc, 'twobeep.ogg', 50, 1) + for (var/mob/O in hearers(3, pda.loc)) + O.show_message(text("\icon[pda] *[pda.ttone]*")) + pda.overlays = null + pda.overlays += image('pda.dmi', "pda-r") + else + var/list/href_list = list() + href_list["src"] = "\ref[eliza.speaker.loc.loc]" + href_list["choice"] = "Message" + href_list["target"] = "\ref[pda]" + href_list["pAI_mess"] = "\"[object]\" \[Via pAI Unit\]" + var/obj/item/device/pda/pda_im_in = eliza.speaker.loc.loc + pda_im_in.Topic("src=\ref[eliza.speaker.loc.loc];choice=Message;target=\ref[pda];pAI_mess=\"[object] \[Via pAI Unit\]",href_list) return "Told [name], [object]." /datum/text_parser/keyword/yes diff --git a/code/game/gamemodes/traitor/traitor.dm b/code/game/gamemodes/traitor/traitor.dm index 86a49e006da..c3d311e7adf 100644 --- a/code/game/gamemodes/traitor/traitor.dm +++ b/code/game/gamemodes/traitor/traitor.dm @@ -94,7 +94,7 @@ traitor.objectives += block_objective else - for(var/datum/objective/o in SelectObjectives((traitor.current:wear_id ? traitor.current:wear_id:assignment : traitor.assigned_role), traitor)) + for(var/datum/objective/o in SelectObjectives((istype(traitor.current:wear_id, /obj/item/weapon/card/id) ? traitor.current:wear_id:assignment : traitor.assigned_role), traitor)) o.owner = traitor traitor.objectives += o return @@ -238,7 +238,7 @@ if (!R && traitor_mob.w_uniform && istype(traitor_mob.belt, /obj/item/device/radio)) R = traitor_mob.belt loc = "on your belt" - if (!R && istype(traitor_mob.l_ear, /obj/item/device/radio) || prob(10)) + if (!R && istype(traitor_mob.l_ear, /obj/item/device/radio)) R = traitor_mob.l_ear loc = "on your head" if (!R && istype(traitor_mob.r_ear, /obj/item/device/radio)) diff --git a/code/game/machinery/computer/buildandrepair.dm b/code/game/machinery/computer/buildandrepair.dm index dfd1390958e..826eb0eb2ce 100644 --- a/code/game/machinery/computer/buildandrepair.dm +++ b/code/game/machinery/computer/buildandrepair.dm @@ -257,7 +257,7 @@ if(istype(P, /obj/item/weapon/circuitboard) && !circuit) var/obj/item/weapon/circuitboard/B = P if(B.board_type == "computer") - if(B.build_path != "") + if(B.build_path != "" && !isnull(B.build_path)) playsound(src.loc, 'Deconstruct.ogg', 50, 1) user << "\blue You place the circuit board inside the frame." src.icon_state = "1" @@ -324,13 +324,14 @@ if(istype(P, /obj/item/weapon/screwdriver)) playsound(src.loc, 'Screwdriver.ogg', 50, 1) user << "\blue You connect the monitor." - var/B = new src.circuit.build_path ( src.loc ) - if(circuit.powernet) B:powernet = circuit.powernet - if(circuit.id) B:id = circuit.id - if(circuit.records) B:records = circuit.records - if(circuit.frequency) B:frequency = circuit.frequency - if(istype(circuit,/obj/item/weapon/circuitboard/supplycomp)) - var/obj/machinery/computer/supplycomp/SC = B - var/obj/item/weapon/circuitboard/supplycomp/C = circuit - SC.can_order_contraband = C.contraband_enabled - del(src) + if(circuit && circuit.build_path) + var/B = new circuit.build_path (loc) + if(circuit.powernet) B:powernet = circuit.powernet + if(circuit.id) B:id = circuit.id + if(circuit.records) B:records = circuit.records + if(circuit.frequency) B:frequency = circuit.frequency + if(istype(circuit,/obj/item/weapon/circuitboard/supplycomp)) + var/obj/machinery/computer/supplycomp/SC = B + var/obj/item/weapon/circuitboard/supplycomp/C = circuit + SC.can_order_contraband = C.contraband_enabled + del(src) diff --git a/code/game/objects/devices/PDA/PDA.dm b/code/game/objects/devices/PDA/PDA.dm index 39cec7c3054..9658ed2205b 100755 --- a/code/game/objects/devices/PDA/PDA.dm +++ b/code/game/objects/devices/PDA/PDA.dm @@ -500,11 +500,15 @@ U << browse(null, "window=pda") return if("Message") - var/t = input(U, "Please enter message", name, null) as text - t = copytext(sanitize(t), 1, MAX_MESSAGE_LEN) + var/t + if(!href_list["pAI_mess"]) + t = input(U, "Please enter message", name, null) as text + t = copytext(sanitize(t), 1, MAX_MESSAGE_LEN) + else + t = href_list["pAI_mess"] if (!t) return - if (!in_range(src, U) && loc != U) + if (!in_range(src, U) && loc != U && !href_list["pAI_mess"]) return var/obj/item/device/pda/P = locate(href_list["target"]) @@ -697,7 +701,7 @@ honkamt-- playsound(loc, 'bikehorn.ogg', 30, 1) - if(U.machine == src)//Final safety. + if(U.machine == src && !href_list["pAI_mess"])//Final safety. attack_self(U)//It auto-closes the menu prior if the user is not in range and so on. else U.machine = null diff --git a/code/game/objects/effect_system.dm b/code/game/objects/effect_system.dm index ee5bee86a77..473a33c1e6c 100644 --- a/code/game/objects/effect_system.dm +++ b/code/game/objects/effect_system.dm @@ -411,15 +411,16 @@ steam.start() -- spawns the effect var/obj/R = new /obj() R.reagents = new/datum/reagents(500) R.reagents.my_atom = R - reagents.trans_to(R, reagents.total_volume/divisor) - for(var/atom/A in view(1, src)) - if(reagents.has_reagent("radium")||reagents.has_reagent("uranium")||reagents.has_reagent("carbon")||reagents.has_reagent("thermite"))//Prevents unholy radium spam by reducing the number of 'greenglows' down to something reasonable -Sieve - if(prob(5)) + if(reagents) + reagents.trans_to(R, reagents.total_volume/divisor) + for(var/atom/A in view(1, src)) + if(reagents.has_reagent("radium")||reagents.has_reagent("uranium")||reagents.has_reagent("carbon")||reagents.has_reagent("thermite"))//Prevents unholy radium spam by reducing the number of 'greenglows' down to something reasonable -Sieve + if(prob(5)) + R.reagents.reaction(A) + del(R) + else if(R && R.reagents) R.reagents.reaction(A) del(R) - else - R.reagents.reaction(A) - del(R) return /obj/effect/effect/chem_smoke/HasEntered(mob/living/carbon/M as mob ) diff --git a/code/modules/DetectiveWork/detective_work.dm b/code/modules/DetectiveWork/detective_work.dm index fba676fd9bb..deaa37ee5a2 100644 --- a/code/modules/DetectiveWork/detective_work.dm +++ b/code/modules/DetectiveWork/detective_work.dm @@ -353,51 +353,52 @@ obj/machinery/computer/forensic_scanning scan_data = null updateDialog() return - scan_process = 0 - scan_name = scanning.name - scan_data = "[scanning]

" - if (scanning.blood_DNA) - scan_data += "Blood Found:
" - for(var/blood in scanning.blood_DNA) - scan_data += "Blood type: [scanning.blood_DNA[blood]]\nDNA: [blood]

" - else - scan_data += "No Blood Found

" - if(!scanning.fingerprints) - scan_data += "No Fingerprints Found

" - else - var/list/L = scanning.fingerprints - scan_data += "Isolated [L.len] Fingerprints. Loaded into database.
" - add_data(scanning) + if(scanning) + scan_process = 0 + scan_name = scanning.name + scan_data = "[scanning]

" + if (scanning.blood_DNA) + scan_data += "Blood Found:
" + for(var/blood in scanning.blood_DNA) + scan_data += "Blood type: [scanning.blood_DNA[blood]]\nDNA: [blood]

" + else + scan_data += "No Blood Found

" + if(!scanning.fingerprints) + scan_data += "No Fingerprints Found

" + else + var/list/L = scanning.fingerprints + scan_data += "Isolated [L.len] Fingerprints. Loaded into database.
" + add_data(scanning) - if(!scanning.suit_fibers) - /*if(istype(scanning,/obj/item/device/detective_scanner)) - var/obj/item/device/detective_scanner/scanner = scanning - if(scanner.stored_name) - scan_data += "Fibers/Materials Data - [scanner.stored_name]:
" - for(var/data in scanner.stored_fibers) - scan_data += "- [data]
" - else - scan_data += "No Fibers/Materials Data
" - else*/ - scan_data += "No Fibers/Materials Located
" - else - /*if(istype(scanning,/obj/item/device/detective_scanner)) - var/obj/item/device/detective_scanner/scanner = scanning - if(scanner.stored_name) - scan_data += "Fibers/Materials Data - [scanner.stored_name]:
" - for(var/data in scanner.stored_fibers) - scan_data += "- [data]
" - else - scan_data += "No Fibers/Materials Data
"*/ + if(!scanning.suit_fibers) + /*if(istype(scanning,/obj/item/device/detective_scanner)) + var/obj/item/device/detective_scanner/scanner = scanning + if(scanner.stored_name) + scan_data += "Fibers/Materials Data - [scanner.stored_name]:
" + for(var/data in scanner.stored_fibers) + scan_data += "- [data]
" + else + scan_data += "No Fibers/Materials Data
" + else*/ + scan_data += "No Fibers/Materials Located
" + else + /*if(istype(scanning,/obj/item/device/detective_scanner)) + var/obj/item/device/detective_scanner/scanner = scanning + if(scanner.stored_name) + scan_data += "Fibers/Materials Data - [scanner.stored_name]:
" + for(var/data in scanner.stored_fibers) + scan_data += "- [data]
" + else + scan_data += "No Fibers/Materials Data
"*/ - scan_data += "Fibers/Materials Found:
" - for(var/data in scanning.suit_fibers) - scan_data += "- [data]
" - if(istype(scanning,/obj/item/device/detective_scanner)) - scan_data += "
Data transfered from Scanner to Database.
" - add_data_scanner(scanning) - else if(!scanning.fingerprints) - scan_data += "
Add to Database?
" + scan_data += "Fibers/Materials Found:
" + for(var/data in scanning.suit_fibers) + scan_data += "- [data]
" + if(istype(scanning,/obj/item/device/detective_scanner)) + scan_data += "
Data transfered from Scanner to Database.
" + add_data_scanner(scanning) + else if(!scanning.fingerprints) + scan_data += "
Add to Database?
" else temp = "Scan Failed: No Object" @@ -467,7 +468,7 @@ obj/machinery/computer/forensic_scanning if(!blood[main_blood]) blood[main_blood] = atom_blood_DNA[blood] return 1 - var/list/templist[2] + var/list/templist[3] templist[1] = atom_suit_fibers templist[2] = atom_blood_DNA templist[3] = atom_name diff --git a/code/modules/chemical/Chemistry-Reagents.dm b/code/modules/chemical/Chemistry-Reagents.dm index ca89fcc58f3..e5273876fa8 100644 --- a/code/modules/chemical/Chemistry-Reagents.dm +++ b/code/modules/chemical/Chemistry-Reagents.dm @@ -102,7 +102,9 @@ datum reagent_state = LIQUID color = "#C80000" // rgb: 200, 0, 0 on_mob_life(var/mob/living/M) - if(istype(M, /mob/living/carbon/human) && blood_incompatible(data["blood_type"],M.dna.b_type)) + if(!data || !data["blood_type"]) + ..() + else if(istype(M, /mob/living/carbon/human) && blood_incompatible(data["blood_type"],M.dna.b_type)) M.adjustToxLoss(rand(0.5,1.5)) M.adjustOxyLoss(rand(1,1.5)) ..() @@ -3111,98 +3113,98 @@ datum description = "A spicy Vodka! Might be a little hot for the little guys!" reagent_state = LIQUID color = "#664300" // rgb: 102, 67, 0 - + on_mob_life(var/mob/living/M as mob) if (M.bodytemperature < 360) M.bodytemperature = min(360, M.bodytemperature+50) //310 is the normal bodytemp. 310.055 return - + devilskiss name = "Devils Kiss" id = "devilskiss" description = "Creepy time!" reagent_state = LIQUID color = "#A68310" // rgb: 166, 131, 16 - + red_mead name = "Red Mead" id = "red_mead" description = "The true Viking drink! Even though it has a strange red color." reagent_state = LIQUID color = "#664300" // rgb: 102, 67, 0 - + mead name = "Mead" id = "mead" description = "A Vikings drink, though a cheap one." reagent_state = LIQUID color = "#664300" // rgb: 102, 67, 0 - + iced_beer name = "Iced Beer" id = "iced_beer" description = "A beer which is so cold the air around it freezes." reagent_state = LIQUID color = "#664300" // rgb: 102, 67, 0 - + on_mob_life(var/mob/living/M as mob) if (M.bodytemperature < 270) M.bodytemperature = min(270, M.bodytemperature-40) //310 is the normal bodytemp. 310.055 return - + grog name = "Grog" id = "grog" description = "Watered down rum, NanoTrasen approves!" reagent_state = LIQUID color = "#664300" // rgb: 102, 67, 0 - + aloe name = "Aloe" id = "aloe" description = "So very, very, very good." reagent_state = LIQUID color = "#664300" // rgb: 102, 67, 0 - + andalusia name = "Andalusia" id = "andalusia" description = "A nice, strange named drink." reagent_state = LIQUID color = "#664300" // rgb: 102, 67, 0 - + alliescocktail name = "Allies Cocktail" id = "alliescocktail" description = "A drink made from your allies." reagent_state = LIQUID color = "#664300" // rgb: 102, 67, 0 - + acid_spit name = "Acid Spit" id = "acidspit" description = "A drink by Nanotrasen. Made from live aliens." reagent_state = LIQUID color = "#365000" // rgb: 54, 80, 0 - + amasec name = "Amasec" id = "amasec" description = "Official drink of the Imperium." reagent_state = LIQUID color = "#664300" // rgb: 102, 67, 0 - + on_mob_life(var/mob/living/M as mob) M.stunned = 4 return - + neurotoxin name = "Neurotoxin" id = "neurotoxin" description = "A strong neurotoxin that puts the subject into a death-like state." reagent_state = LIQUID color = "#2E2E61" // rgb: 46, 46, 97 - + on_mob_life(var/mob/living/M as mob) if(!M) M = holder.my_atom M:adjustOxyLoss(0.5) @@ -3224,14 +3226,14 @@ datum description = "A drink from Mime Heaven." nutriment_factor = 1 * REAGENTS_METABOLISM color = "#664300" // rgb: 102, 67, 0 - + changelingsting name = "Changeling Sting" id = "changelingsting" description = "A stingy drink." reagent_state = LIQUID color = "#2E6671" // rgb: 46, 102, 113 - + on_mob_life(var/mob/living/M as mob) if(!data) data = 1 data++ @@ -3243,14 +3245,14 @@ datum M.confused = max(M:confused+15,15) ..() return - + irishcarbomb name = "Irish Car Bomb" id = "irishcarbomb" description = "Mmm, tastes like chocolate cake..." reagent_state = LIQUID color = "#2E6671" // rgb: 46, 102, 113 - + on_mob_life(var/mob/living/M as mob) if(!data) data = 1 data++ @@ -3262,14 +3264,14 @@ datum M.confused = max(M:confused+15,15) ..() return - + syndicatebomb name = "Syndicate Bomb" id = "syndicatebomb" description = "A Syndicate bomb" reagent_state = LIQUID color = "#2E6671" // rgb: 46, 102, 113 - + erikasurprise name = "Erika Surprise" id = "erikasurprise" @@ -3416,4 +3418,4 @@ datum holder.remove_reagent(src.id, 0.2) data++ ..() - return + return