diff --git a/code/game/objects/items/devices/PDA/PDA.dm b/code/game/objects/items/devices/PDA/PDA.dm index 5fc226be190..2f06cceee73 100755 --- a/code/game/objects/items/devices/PDA/PDA.dm +++ b/code/game/objects/items/devices/PDA/PDA.dm @@ -41,7 +41,7 @@ var/global/list/obj/item/device/pda/PDAs = list() var/active_conversation = null // New variable that allows us to only view a single conversation. var/list/conversations = list() // For keeping up with who we have PDA messsages from. var/newmessage = 0 //To remove hackish overlay check - + var/obj/item/weapon/card/id/id = null //Making it possible to slot an ID card into the PDA so it can function as both. var/ownjob = null //related to above @@ -321,7 +321,7 @@ var/global/list/obj/item/device/pda/PDAs = list() /obj/item/device/pda/ui_interact(mob/user, ui_key = "main", var/datum/nanoui/ui = null) var/title = "Personal Data Assistant" - + var/data[0] // This is the data that will be sent to the PDA @@ -336,7 +336,7 @@ var/global/list/obj/item/device/pda/PDAs = list() data["silent"] = silent // does the pda make noise when it receives a message? data["toff"] = toff // is the messenger function turned off? data["active_conversation"] = active_conversation // Which conversation are we following right now? - + data["idInserted"] = (id ? 1 : 0) data["idLink"] = (id ? text("[id.registered_name], [id.assignment]") : "--------") @@ -375,10 +375,10 @@ var/global/list/obj/item/device/pda/PDAs = list() cartdata["type"] = cartridge.type cartdata["charges"] = cartridge.charges ? cartridge.charges : 0 data["cartridge"] = cartdata - + data["stationTime"] = worldtime2text() data["newMessage"] = newmessage - + if(mode==2) var/convopdas[0] var/pdas[0] @@ -388,7 +388,7 @@ var/global/list/obj/item/device/pda/PDAs = list() if(conversations.Find("\ref[P]")) convopdas.Add(list(list("Name" = "[P]", "Reference" = "\ref[P]", "Detonate" = "[P.detonate]", "inconvo" = "1"))) else - pdas.Add(list(list("Name" = "[P]", "Reference" = "\ref[P]", "Detonate" = "[P.detonate]", "inconvo" = "0"))) + pdas.Add(list(list("Name" = "[P]", "Reference" = "\ref[P]", "Detonate" = "[P.detonate]", "inconvo" = "0"))) count++ data["convopdas"] = convopdas @@ -411,7 +411,7 @@ var/global/list/obj/item/device/pda/PDAs = list() if(mode==41) data["manifest"] = data_core.get_manifest_json() - + if(mode==3) var/turf/T = get_turf_or_move(user.loc) if(!isnull(T) || mode!=3) @@ -438,15 +438,15 @@ var/global/list/obj/item/device/pda/PDAs = list() ) if(isnull(data["aircontents"])) data["aircontents"] = list("reading" = 0) - + // update the ui if it exists, returns null if no ui is passed/found - ui = nanomanager.try_update_ui(user, src, ui_key, ui, data) + ui = nanomanager.try_update_ui(user, src, ui_key, ui, data) if (!ui) // the ui does not exist, so we'll create a new() one // for a list of parameters and their descriptions see the code docs in \code\modules\nano\nanoui.dm ui = new(user, src, ui_key, "pda.tmpl", title, 520, 400) // when the ui is first opened this is the data it will use - ui.set_initial_data(data) + ui.set_initial_data(data) // open the new ui window ui.open() // auto update every Master Controller tick @@ -484,17 +484,17 @@ var/global/list/obj/item/device/pda/PDAs = list() U.unset_machine() ui.close() return 0 - + add_fingerprint(U) U.set_machine(src) switch(href_list["choice"]) - + //BASIC FUNCTIONS=================================== if("Close")//Self explanatory U.unset_machine() - ui.close() + ui.close() return 0 if("Refresh")//Refresh, goes to the end of the proc. if("Return")//Return @@ -518,7 +518,7 @@ var/global/list/obj/item/device/pda/PDAs = list() var/turf/T = loc if(ismob(T)) T = T.loc - cartridge.loc = T + cartridge.loc = T mode = 0 scanmode = 0 if (cartridge.radio) @@ -681,14 +681,14 @@ var/global/list/obj/item/device/pda/PDAs = list() else M.close() - if("Detonate")//Detonate PDA + if("Detonate")//Detonate PDA... maybe if(istype(cartridge, /obj/item/weapon/cartridge/syndicate)) var/obj/item/device/pda/P = locate(href_list["target"]) if(!isnull(P)) if (!P.toff && cartridge.charges > 0) cartridge.charges-- - var/difficulty = 0 + var/difficulty = 2 if(P.cartridge) difficulty += P.cartridge.access_medical @@ -696,22 +696,23 @@ var/global/list/obj/item/device/pda/PDAs = list() difficulty += P.cartridge.access_engine difficulty += P.cartridge.access_clown difficulty += P.cartridge.access_janitor - else - difficulty += 2 + difficulty += 3 * P.hidden_uplink - if(prob(difficulty * 12) || (P.hidden_uplink)) + if(prob(difficulty)) U.show_message("\red An error flashes on your [src].", 1) - else if (prob(difficulty * 3)) + else if (prob(difficulty * 7)) U.show_message("\red Energy feeds back into your [src]!", 1) ui.close() - explode() + detonate_act(src) log_admin("[key_name(U)] just attempted to blow up [P] with the Detomatix cartridge but failed, blowing themselves up") - message_admins("[key_name_admin(U)] just attempted to blow up [P] with the Detomatix cartridge but failed, blowing themselves up", 1) + message_admins("[key_name_admin(U)] just attempted to blow up [P] with the Detomatix cartridge but failed.", 1) else U.show_message("\blue Success!", 1) - log_admin("[key_name(U)] just attempted to blow up [P] with the Detomatix cartridge and succeded") - message_admins("[key_name_admin(U)] just attempted to blow up [P] with the Detomatix cartridge and succeded", 1) - P.explode() + log_admin("[key_name(U)] just attempted to blow up [P] with the Detomatix cartridge and succeeded") + message_admins("[key_name_admin(U)] just attempted to blow up [P] with the Detomatix cartridge and succeeded.", 1) + detonate_act(P) + else + U << "No charges left." else U << "PDA not found." else @@ -747,6 +748,69 @@ var/global/list/obj/item/device/pda/PDAs = list() return 1 // return 1 tells it to refresh the UI in NanoUI +/obj/item/device/pda/proc/detonate_act(var/obj/item/device/pda/P) + //TODO: sometimes these attacks show up on the message server + var/i = rand(1,100) + var/j = rand(0,1) //Possibility of losing the PDA after the detonation + var/message = "" + var/mob/living/M = null + if(ismob(P.loc)) + M = P.loc + + //switch(i) //Yes, the overlapping cases are intended. + if(i<=10) //The traditional explosion + P.explode() + message += "Your [P] suddenly explodes!" + if(i>=10 && i<= 20) //The PDA burns a hole in the holder. + j=1 + if(M && isliving(M)) + M.apply_damage( rand(30,60) , BURN) + message += "You feel a searing heat! Your [P] is burning!" + if(i>=20 && i<=25) //EMP + empulse(P.loc, 3, 6, 1) + message += "Your [P] emits a wave of electomagnetic energy!" + if(i>=25 && i<=40) //Smoke + var/datum/effect/effect/system/smoke_spread/chem/S = new /datum/effect/effect/system/smoke_spread/chem + S.attach(P.loc) + S.set_up(P, 10, 0, P.loc) + playsound(P.loc, 'sound/effects/smoke.ogg', 50, 1, -3) + S.start() + message += "Large clouds of smoke billow forth from your [P]!" + if(i>=40 && i<=45) //Bad smoke + var/datum/effect/effect/system/smoke_spread/bad/B = new /datum/effect/effect/system/smoke_spread/bad + B.attach(P.loc) + B.set_up(P, 10, 0, P.loc) + playsound(P.loc, 'sound/effects/smoke.ogg', 50, 1, -3) + B.start() + message += "Large clouds of noxious smoke billow forth from your [P]!" + if(i>=65 && i<=75) //Weaken + if(M && isliving(M)) + M.apply_effects(0,1) + message += "Your [P] flashes with a blinding white light! You feel weaker." + if(i>=75 && i<=85) //Stun and stutter + if(M && isliving(M)) + M.apply_effects(1,0,0,0,1) + message += "Your [P] flashes with a blinding white light! You feel weaker." + if(i>=85) //Sparks + var/datum/effect/effect/system/spark_spread/s = new /datum/effect/effect/system/spark_spread + s.set_up(2, 1, P.loc) + s.start() + message += "Your [P] begins to spark violently!" + if(i>45 && i<65 && prob(50)) //Nothing happens + message += "Your [P] bleeps loudly." + j = prob(10) + + if(j) //This kills the PDA + P.Del() + if(message) + message += "It melts in a puddle of plastic." + else + message += "Your [P] shatters in a thousand pieces!" + + if(M && isliving(M)) + message = "\red" + message + M.show_message(message, 1) + /obj/item/device/pda/proc/remove_id() if (id) if (ismob(loc)) @@ -774,7 +838,7 @@ var/global/list/obj/item/device/pda/PDAs = list() if(!can_use()) return - + last_text = world.time // check if telecomms I/O route 1459 is stable //var/telecomms_intact = telecomms_process(P.owner, owner, t) @@ -825,7 +889,7 @@ var/global/list/obj/item/device/pda/PDAs = list() if(ai.aiPDA != P && ai.aiPDA != src) ai.show_message("Intercepted message from [who]: [t]") - + if (!P.silent) playsound(P.loc, 'sound/machines/twobeep.ogg', 50, 1) for (var/mob/O in hearers(3, P.loc)) @@ -842,7 +906,7 @@ var/global/list/obj/item/device/pda/PDAs = list() if(L) L << "\icon[P] Message from [src.owner] ([ownjob]), \"[t]\" (Reply)" nanomanager.update_user_uis(L, P) // Update the recieving user's PDA UI so that they can see the new message - + nanomanager.update_user_uis(U, P) // Update the sending user's PDA UI so that they can see the new message log_pda("[usr] (PDA: [src.name]) sent \"[t]\" to [P.name]") @@ -924,7 +988,7 @@ var/global/list/obj/item/device/pda/PDAs = list() user << "You insert [cartridge] into [src]." nanomanager.update_uis(src) // update all UIs attached to src if(cartridge.radio) - cartridge.radio.hostpda = src + cartridge.radio.hostpda = src else if(istype(C, /obj/item/weapon/card/id)) var/obj/item/weapon/card/id/idcard = C @@ -1098,20 +1162,20 @@ var/global/list/obj/item/device/pda/PDAs = list() user << "\blue Paper scanned." //concept of scanning paper copyright brainoblivion 2009 -/obj/item/device/pda/proc/explode() //This needs tuning. +/obj/item/device/pda/proc/explode() //This needs tuning. //Sure did. if(!src.detonate) return var/turf/T = get_turf(src.loc) - if (ismob(loc)) var/mob/M = loc M.show_message("\red Your [src] explodes!", 1) - if(T) T.hotspot_expose(700,125) - - explosion(T, -1, -1, 2, 3) - - del(src) + explosion(T, 0, 0, 1, rand(1,2)) + if(prob(90)) //IDs are kept in 90% of the cases + Del() + else + PDAs -= src + del(src) return /obj/item/device/pda/Del()