From be76c3afccad42b5a08ece8767607b95250caf07 Mon Sep 17 00:00:00 2001 From: "giacomand@gmail.com" Date: Thu, 16 Aug 2012 21:57:27 +0000 Subject: [PATCH] Fixed issue 645. I changed how uplinks worked. Instead of there being a duplicate item which would switch out when it activates, there's an item called "obj/item/device/uplink/hidden". It is a hidden uplink which you can place in any obj/item. In "hidden" is where it will generate menus, check for triggers to show the menu and etc.. No need to switch out with duplicate items or add the menu onto the PDA's notes. How to create a new uplink item in 3 easy steps! 1. All obj/item 's have a hidden_uplink var. By default it's null. Give the item one with "new(src)", it must be in it's contents. Feel free to add/remove "uses". 2. Code in the triggers. Use check_trigger for this, I recommend closing the item's menu with "usr << browse(null, "window=windowname") if it returns true. The var/value is the value that will be compared with the var/target. If they are equal it will activate the menu. 3. If you want the menu to stay until the users locks his uplink, add an active_uplink_check(mob/user as mob) in your interact/attack_hand proc. Then check if it's true, if true return. This will stop the normal menu appearing and will instead show the uplink menu. I've given the recharge station's verbs a category so they don't create their own tab. I've added a mob/proc called put_in_any_hand_if_possible. Name speaks for itself. Returns true if successful, false otherwise. git-svn-id: http://tgstation13.googlecode.com/svn/trunk@4450 316c924e-a436-60f5-8080-3fe189b3f50e --- code/datums/mind.dm | 63 +- code/defines/obj.dm | 2 + code/game/gamemodes/traitor/traitor.dm | 66 +- code/game/machinery/rechargestation.dm | 2 + code/game/objects/closets/nuclear.dm | 4 +- code/game/objects/devices/PDA/PDA.dm | 34 +- .../objects/items/weapons/implants/implant.dm | 28 - code/game/objects/radio/radio.dm | 48 +- code/game/objects/uplinks.dm | 801 ++++++++---------- code/modules/mob/mob.dm | 56 +- 10 files changed, 410 insertions(+), 694 deletions(-) diff --git a/code/datums/mind.dm b/code/datums/mind.dm index 4bd110015a9..b254f09f105 100644 --- a/code/datums/mind.dm +++ b/code/datums/mind.dm @@ -299,14 +299,11 @@ datum/mind istype(current,/mob/living/carbon/human) ) text = "Uplink: give" - var/obj/item/device/uplink/suplink = find_syndicate_uplink() - var/obj/item/device/uplink/iuplink = find_integrated_uplink() + var/obj/item/device/uplink/hidden/suplink = find_syndicate_uplink() var/crystals if (suplink) crystals = suplink.uses - else if (iuplink) - crystals = iuplink.uses - if (suplink || iuplink) + if (suplink) text += "|take" if (usr.client.holder.level >= 3) text += ", [crystals] crystals" @@ -847,19 +844,14 @@ datum/mind memory = null//Remove any memory they may have had. if("crystals") if (usr.client.holder.level >= 3) - var/obj/item/device/uplink/suplink = find_syndicate_uplink() - var/obj/item/device/uplink/iuplink = find_integrated_uplink() + var/obj/item/device/uplink/hidden/suplink = find_syndicate_uplink() var/crystals if (suplink) crystals = suplink.uses - else if (iuplink) - crystals = iuplink.uses crystals = input("Amount of telecrystals for [key]","Syndicate uplink", crystals) as null|num if (!isnull(crystals)) if (suplink) suplink.uses = crystals - else if(iuplink) - iuplink.uses = crystals if("uplink") if (!ticker.mode.equip_traitor(current, !(src in ticker.mode.traitors))) usr << "\red Equipping a syndicate failed!" @@ -905,50 +897,17 @@ datum/mind */ proc/find_syndicate_uplink() - var/obj/item/device/uplink/radio/uplink = null var/list/L = current.get_contents() - for (var/obj/item/device/radio/radio in L) - uplink = radio.traitorradio - if (uplink) - return uplink - uplink = locate() in L - return uplink + for (var/obj/item/I in L) + if (I.hidden_uplink) + return I.hidden_uplink + return null - proc/find_integrated_uplink() - //world << "DEBUG: find_integrated_uplink()" - var/obj/item/device/uplink/uplink = null - var/list/L = current.get_contents() - for (var/obj/item/device/pda/pda in L) - uplink = pda.uplink - if (uplink) - return uplink - return uplink + proc/take_uplink() + var/obj/item/device/uplink/hidden/H = find_syndicate_uplink() + if(H) + del(H) - proc/take_uplink() //assuming only one uplink because I am tired of all this uplink shit --rastaf0 - var/list/L = current.get_contents() - var/obj/item/device/uplink/radio/suplink = null - var/obj/item/device/uplink/pda/iuplink = null - for (var/obj/item/device/radio/radio in L) - suplink = radio.traitorradio - if (suplink) - break - if (!suplink) - suplink = locate() in L - - for (var/obj/item/device/pda/pda in L) - iuplink = pda.uplink - if (iuplink) - break - if (!iuplink) - iuplink = locate() in L - - if (iuplink) - iuplink.shutdown_uplink() - del(iuplink) - else if (suplink) - suplink.shutdown_uplink() - del(suplink) - return proc/make_AI_Malf() if(!(src in ticker.mode.malf_ai)) diff --git a/code/defines/obj.dm b/code/defines/obj.dm index e79c82909f3..e4c787b0c11 100644 --- a/code/defines/obj.dm +++ b/code/defines/obj.dm @@ -332,10 +332,12 @@ var/canremove = 1 //Mostly for Ninja code at this point but basically will not allow the item to be removed if set to 0. /N var/armor = list(melee = 0, bullet = 0, laser = 0,energy = 0, bomb = 0, bio = 0, rad = 0) var/list/allowed = null //suit storage stuff. + var/obj/item/device/uplink/hidden/hidden_uplink = null // All items can have an uplink hidden inside, just remember to add the triggers. //the mob M is attempting to equip this item into the slot passed through as 'slot'. Return 1 if it can do this and 0 if it can't. //If you are making custom procs but would like to retain partial or complete functionality of this one, include a 'return ..()' to where you want this to happen. //Set disable_warning to 1 if you wish it to not give you outputs. + /obj/item/proc/mob_can_equip(M as mob, slot, disable_warning = 0) if(!slot) return 0 if(!M) return 0 diff --git a/code/game/gamemodes/traitor/traitor.dm b/code/game/gamemodes/traitor/traitor.dm index 230d479758e..b45c7eaaff0 100644 --- a/code/game/gamemodes/traitor/traitor.dm +++ b/code/game/gamemodes/traitor/traitor.dm @@ -221,55 +221,17 @@ // find a radio! toolbox(es), backpack, belt, headset var/loc = "" - var/obj/item/device/R = null //Hide the uplink in a PDA if available, otherwise radio - if (!R && istype(traitor_mob.belt, /obj/item/device/pda)) - R = traitor_mob.belt - loc = "on your belt" - if (!R && istype(traitor_mob.wear_id, /obj/item/device/pda)) - R = traitor_mob.wear_id - loc = "on your jumpsuit" - if (!R && istype(traitor_mob.wear_id, /obj/item/device/pda)) - R = traitor_mob.wear_id - loc = "on your jumpsuit" - if (!R && istype(traitor_mob.l_hand, /obj/item/weapon/storage)) - var/obj/item/weapon/storage/S = traitor_mob.l_hand - var/list/L = S.return_inv() - for (var/obj/item/device/radio/foo in L) - R = foo - loc = "in the [S.name] in your left hand" - break - if (!R && istype(traitor_mob.r_hand, /obj/item/weapon/storage)) - var/obj/item/weapon/storage/S = traitor_mob.r_hand - var/list/L = S.return_inv() - for (var/obj/item/device/radio/foo in L) - R = foo - loc = "in the [S.name] in your right hand" - break - if (!R && istype(traitor_mob.back, /obj/item/weapon/storage)) - var/obj/item/weapon/storage/S = traitor_mob.back - var/list/L = S.return_inv() - for (var/obj/item/device/radio/foo in L) - R = foo - loc = "in the [S.name] on your back" - break - if (!R && istype(traitor_mob.l_store, /obj/item/device/pda)) - R = traitor_mob.l_store - loc = "in your pocket" - if (!R && istype(traitor_mob.r_store, /obj/item/device/pda)) - R = traitor_mob.r_store - loc = "in your pocket" - 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.ears, /obj/item/device/radio)) || prob(10)) - R = traitor_mob.ears - loc = "on your head" + var/obj/item/R = locate(/obj/item/device/pda) in traitor_mob.contents //Hide the uplink in a PDA if available, otherwise radio + if(!R) + R = locate(/obj/item/device/radio) in traitor_mob.contents + if (!R) traitor_mob << "Unfortunately, the Syndicate wasn't able to get you a radio." . = 0 else if (istype(R, /obj/item/device/radio)) // generate list of radio freqs + var/obj/item/device/radio/target_radio = R var/freq = 1441 var/list/freqlist = list() while (freq <= 1489) @@ -280,22 +242,20 @@ freq += 1 freq = freqlist[rand(1, freqlist.len)] - var/obj/item/device/uplink/radio/T = new /obj/item/device/uplink/radio(R) - R:traitorradio = T - R:traitor_frequency = freq - T.name = R.name - T.icon_state = R.icon_state - T.origradio = R + var/obj/item/device/uplink/hidden/T = new(R) + target_radio.hidden_uplink = T + target_radio.traitor_frequency = freq traitor_mob << "The Syndicate have cunningly disguised a Syndicate Uplink as your [R.name] [loc]. Simply dial the frequency [format_frequency(freq)] to unlock its hidden features." traitor_mob.mind.store_memory("Radio Freq: [format_frequency(freq)] ([R.name] [loc]).") else if (istype(R, /obj/item/device/pda)) // generate a passcode if the uplink is hidden in a PDA var/pda_pass = "[rand(100,999)] [pick("Alpha","Bravo","Delta","Omega")]" - var/obj/item/device/uplink/pda/T = new /obj/item/device/uplink/pda(R) - R:uplink = T - T.lock_code = pda_pass - T.hostpda = R + var/obj/item/device/uplink/hidden/T = new(R) + R.hidden_uplink = T + var/obj/item/device/pda/P = R + P.lock_code = pda_pass + traitor_mob << "The Syndicate have cunningly disguised a Syndicate Uplink as your [R.name] [loc]. Simply enter the code \"[pda_pass]\" into the ringtone select to unlock its hidden features." traitor_mob.mind.store_memory("Uplink Passcode: [pda_pass] ([R.name] [loc]).") //Begin code phrase. diff --git a/code/game/machinery/rechargestation.dm b/code/game/machinery/rechargestation.dm index aee8875eae4..95d0f342e87 100644 --- a/code/game/machinery/rechargestation.dm +++ b/code/game/machinery/rechargestation.dm @@ -129,6 +129,7 @@ verb move_eject() + set category = "Object" set src in oview(1) if (usr.stat != 0) return @@ -137,6 +138,7 @@ return move_inside() + set category = "Object" set src in oview(1) if (usr.stat == 2) //Whoever had it so that a borg with a dead cell can't enter this thing should be shot. --NEO diff --git a/code/game/objects/closets/nuclear.dm b/code/game/objects/closets/nuclear.dm index cbe8b8ebd1c..ae1720bfbee 100644 --- a/code/game/objects/closets/nuclear.dm +++ b/code/game/objects/closets/nuclear.dm @@ -19,6 +19,6 @@ new /obj/item/weapon/pinpointer/nukeop(src) new /obj/item/weapon/pinpointer/nukeop(src) new /obj/item/device/pda/syndicate(src) - var/obj/item/device/uplink/radio/U = new /obj/item/device/uplink/radio(src) - U.uses = 40 + var/obj/item/device/radio/uplink/U = new(src) + U.hidden_uplink.uses = 40 return diff --git a/code/game/objects/devices/PDA/PDA.dm b/code/game/objects/devices/PDA/PDA.dm index 60a874e5c7b..ddcb3678a6d 100644 --- a/code/game/objects/devices/PDA/PDA.dm +++ b/code/game/objects/devices/PDA/PDA.dm @@ -30,6 +30,7 @@ var/global/list/obj/item/device/pda/PDAs = list() var/last_text //No text spamming var/last_honk //Also no honk spamming that's bad too var/ttone = "beep" //The ringtone! + var/lock_code = "" // Lockcode to unlock uplink var/honkamt = 0 //How many honks left when infected with honk.exe var/mimeamt = 0 //How many silence left when infected with mime.exe var/note = "Congratulations, your station has chosen the Thinktronic 5230 Personal Data Assistant!" //Current note in the notepad function @@ -37,8 +38,6 @@ var/global/list/obj/item/device/pda/PDAs = list() var/cart = "" //A place to stick cartridge menu information var/detonate = 1 // Can the PDA be blown up? - var/obj/item/device/uplink/pda/uplink = null - 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 @@ -236,6 +235,9 @@ var/global/list/obj/item/device/pda/PDAs = list() user.machine = src + if(active_uplink_check(user)) + return + var/dat = "Personal Data Assistant" dat += " Close" @@ -330,10 +332,7 @@ var/global/list/obj/item/device/pda/PDAs = list() if (1) dat += "

Notekeeper V2.1

" - if ((!isnull(uplink)) && uplink.active) - dat += " Lock
" - else - dat += " Edit
" + dat += " Edit
" dat += note if (2) @@ -552,13 +551,9 @@ var/global/list/obj/item/device/pda/PDAs = list() var/t = input(U, "Please enter new ringtone", name, ttone) as text if (in_range(src, U) && loc == U) if (t) - if ((uplink) && (cmptext(t,uplink.lock_code))) - if(uplink.active) - U << "The PDA uplink is already unlocked." - mode = 1 - else - U << "The PDA softly beeps." - uplink.unlock() + if(src.hidden_uplink && hidden_uplink.check_trigger(U, t, lock_code)) + U << "The PDA softly beeps." + U << browse(null, "window=pda") else t = copytext(sanitize(t), 1, 20) ttone = t @@ -610,11 +605,7 @@ var/global/list/obj/item/device/pda/PDAs = list() else spawn(0) M.close() - if("Lock") - if(uplink) - uplink.active = 0 - note = uplink.orignote - mode = 0 // To stop people metagaming that PDAs on the note screen means it is an uplink PDA. + if("Detonate")//Detonate PDA if(istype(cartridge, /obj/item/weapon/cartridge/syndicate)) var/obj/item/device/pda/P = locate(href_list["target"]) @@ -634,7 +625,7 @@ var/global/list/obj/item/device/pda/PDAs = list() else difficulty += 2 - if ((prob(difficulty * 12)) || (P.uplink)) + if ((prob(difficulty * 12)) || (P.hidden_uplink)) U.show_message("\red An error flashes on your [src].", 1) else if (prob(difficulty * 3)) U.show_message("\red Energy feeds back into your [src]!", 1) @@ -980,10 +971,7 @@ var/global/list/obj/item/device/pda/PDAs = list() user << "\blue No significant chemical agents found in [A]." if (!scanmode && istype(A, /obj/item/weapon/paper) && owner) - if ((!isnull(uplink)) && (uplink.active)) - uplink.orignote = A:info - else - note = A:info + note = A:info user << "\blue Paper scanned." //concept of scanning paper copyright brainoblivion 2009 diff --git a/code/game/objects/items/weapons/implants/implant.dm b/code/game/objects/items/weapons/implants/implant.dm index 3f80a108b7d..de4773218f0 100644 --- a/code/game/objects/items/weapons/implants/implant.dm +++ b/code/game/objects/items/weapons/implants/implant.dm @@ -39,34 +39,6 @@ -/obj/item/weapon/implant/uplink - name = "uplink" - desc = "Summon things." - var/activation_emote = "chuckle" - var/obj/item/device/uplink/radio/uplink = null - - - New() - activation_emote = pick("blink", "blink_r", "eyebrow", "chuckle", "twitch_s", "frown", "nod", "blush", "giggle", "grin", "groan", "shrug", "smile", "pale", "sniff", "whimper", "wink") - uplink = new /obj/item/device/uplink/radio/implanted(src) - ..() - return - - - implanted(mob/source) - activation_emote = input("Choose activation emote:") in list("blink", "blink_r", "eyebrow", "chuckle", "twitch_s", "frown", "nod", "blush", "giggle", "grin", "groan", "shrug", "smile", "pale", "sniff", "whimper", "wink") - source.mind.store_memory("Uplink implant can be activated by using the [src.activation_emote] emote, say *[src.activation_emote] to attempt to activate.", 0, 0) - source << "The implanted uplink implant can be activated by using the [src.activation_emote] emote, say *[src.activation_emote] to attempt to activate." - return 1 - - - trigger(emote, mob/source as mob) - if(emote == activation_emote) - uplink.attack_self(source) - return - - - /obj/item/weapon/implant/tracking name = "tracking" desc = "Track with this." diff --git a/code/game/objects/radio/radio.dm b/code/game/objects/radio/radio.dm index 4b3421d71e4..21af3526715 100644 --- a/code/game/objects/radio/radio.dm +++ b/code/game/objects/radio/radio.dm @@ -15,7 +15,6 @@ var/GLOBAL_RADIO_TYPE = 1 // radio type to use var/traitor_frequency = 0 //tune to frequency to unlock traitor supplies var/canhear_range = 3 // the range which mobs can hear this radio from var/obj/item/device/radio/patch_link = null - var/obj/item/device/uplink/traitorradio = null var/wires = WIRE_SIGNAL | WIRE_RECEIVE | WIRE_TRANSMIT var/b_stat = 0 var/broadcasting = 0 @@ -79,6 +78,9 @@ var/GLOBAL_RADIO_TYPE = 1 // radio type to use if(!on) return + if(active_uplink_check(user)) + return + var/dat = "[src]" if(!istype(src, /obj/item/device/radio/headset)) //Headsets dont get a mic button @@ -157,23 +159,11 @@ var/GLOBAL_RADIO_TYPE = 1 // radio type to use if (!freerange || (frequency < 1200 || frequency > 1600)) new_frequency = sanitize_frequency(new_frequency, maxf) set_frequency(new_frequency) + if(hidden_uplink) + if(hidden_uplink.check_trigger(usr, frequency, traitor_frequency)) + usr << browse(null, "window=radio") + return - if (traitor_frequency && frequency == traitor_frequency) - usr.machine = null - usr << browse(null, "window=radio") - // now transform the regular radio, into a (disguised)syndicate uplink! - var/obj/item/device/uplink/radio/T = traitorradio - var/obj/item/device/radio/R = src - - usr.u_equip(R) - R.loc = T - if(usr.r_hand == R) - usr.put_in_r_hand(T) - else - usr.put_in_l_hand(T) - - T.attack_self(usr) - return else if (href_list["talk"]) broadcasting = text2num(href_list["talk"]) else if (href_list["listen"]) @@ -244,7 +234,7 @@ var/GLOBAL_RADIO_TYPE = 1 // radio type to use if (!connection) return - + var/turf/position = get_turf(src) //#### Tagging the signal with all appropriate identity values ####// @@ -328,24 +318,19 @@ var/GLOBAL_RADIO_TYPE = 1 // radio type to use "traffic" = 0, // dictates the total traffic sum that the signal went through "type" = 0, // determines what type of radio input it is: normal broadcast "server" = null, // the last server to log this signal - "reject" = 0 // if nonzero, the signal will not be accepted by any broadcasting machinery + "reject" = 0, // if nonzero, the signal will not be accepted by any broadcasting machinery + "level" = position.z // The source's z level ) signal.frequency = connection.frequency // Quick frequency set //#### Sending the signal to all subspace receivers ####// - var/turf/position = get_turf(src) - for(var/obj/machinery/telecomms/receiver/R in telecomms_list) - var/turf/receiver_turf = get_turf(R) - if(position.z == receiver_turf.z) - R.receive_signal(signal) + R.receive_signal(signal) // Allinone can act as receivers. for(var/obj/machinery/telecomms/allinone/R in telecomms_list) - var/turf/receiver_turf = get_turf(R) - if(position.z == receiver_turf.z) - R.receive_signal(signal) + R.receive_signal(signal) // Receiving code can be located in Telecommunications.dm return @@ -386,16 +371,13 @@ var/GLOBAL_RADIO_TYPE = 1 // radio type to use "traffic" = 0, "type" = 0, "server" = null, - "reject" = 0 + "reject" = 0, + "level" = position.z ) signal.frequency = connection.frequency // Quick frequency set - var/turf/position = get_turf(src) - for(var/obj/machinery/telecomms/receiver/R in telecomms_list) - var/turf/receiver_turf = get_turf(R) - if(position.z == receiver_turf.z) - R.receive_signal(signal) + R.receive_signal(signal) sleep(rand(10,25)) // wait a little... diff --git a/code/game/objects/uplinks.dm b/code/game/objects/uplinks.dm index 88859f82936..40d2cd2e599 100644 --- a/code/game/objects/uplinks.dm +++ b/code/game/objects/uplinks.dm @@ -19,7 +19,6 @@ A list of items and costs is stored under the datum of every game mode, alongsid /obj/item/device/uplink var/welcome // Welcoming menu message - var/menu_message = "" // The actual menu text var/items // List of items var/item_data // raw item text var/list/ItemList // Parsed list of items @@ -27,520 +26,384 @@ A list of items and costs is stored under the datum of every game mode, alongsid // List of items not to shove in their hands. var/list/NotInHand = list(/obj/machinery/singularity_beacon/syndicate) - New() - welcome = ticker.mode.uplink_welcome - if(!item_data) - items = dd_replacetext(ticker.mode.uplink_items, "\n", "") // Getting the text string of items - else - items = dd_replacetext(item_data) - ItemList = dd_text2list(src.items, ";") // Parsing the items text string - uses = ticker.mode.uplink_uses +/obj/item/device/uplink/New() + welcome = ticker.mode.uplink_welcome + if(!item_data) + items = dd_replacetext(ticker.mode.uplink_items, "\n", "") // Getting the text string of items + else + items = dd_replacetext(item_data) + ItemList = dd_text2list(src.items, ";") // Parsing the items text string + uses = ticker.mode.uplink_uses //Let's build a menu! - proc/generate_menu() - src.menu_message = "[src.welcome]
" - src.menu_message += "Tele-Crystals left: [src.uses]
" - src.menu_message += "
" - src.menu_message += "Request item:
" - src.menu_message += "Each item costs a number of tele-crystals as indicated by the number following their name.

" +/obj/item/device/uplink/proc/generate_menu() - var/cost - var/item - var/name - var/path_obj - var/path_text - var/category_items = 1 //To prevent stupid :P + var/dat = "[src.welcome]
" + dat += "Tele-Crystals left: [src.uses]
" + dat += "
" + dat += "Request item:
" + dat += "Each item costs a number of tele-crystals as indicated by the number following their name.

" - for(var/D in ItemList) - var/list/O = stringsplit(D, ":") - if(O.len != 3) //If it is not an actual item, make a break in the menu. - if(O.len == 1) //If there is one item, it's probably a title - src.menu_message += "[O[1]]
" - category_items = 0 - else //Else, it's a white space. - if(category_items < 1) //If there were no itens in the last category... - src.menu_message += "We apologize, as you could not afford anything from this category.
" - src.menu_message += "
" - continue + var/cost + var/item + var/name + var/path_obj + var/path_text + var/category_items = 1 //To prevent stupid :P - path_text = O[1] - cost = text2num(O[2]) + for(var/D in ItemList) + var/list/O = stringsplit(D, ":") + if(O.len != 3) //If it is not an actual item, make a break in the menu. + if(O.len == 1) //If there is one item, it's probably a title + dat += "[O[1]]
" + category_items = 0 + else //Else, it's a white space. + if(category_items < 1) //If there were no itens in the last category... + dat += "We apologize, as you could not afford anything from this category.
" + dat += "
" + continue - if(cost>uses) - continue + path_text = O[1] + cost = text2num(O[2]) - path_obj = text2path(path_text) - item = new path_obj() - name = O[3] - del item + if(cost>uses) + continue - src.menu_message += "[name] ([cost])
" - category_items++ + path_obj = text2path(path_text) + item = new path_obj() + name = O[3] + del item - src.menu_message += "Random Item (??)
" - src.menu_message += "
" - return + dat += "[name] ([cost])
" + category_items++ + + dat += "Random Item (??)
" + dat += "
" + return dat //If 'random' was selected - proc/chooseRandomItem() - var/list/randomItems = list() +/obj/item/device/uplink/proc/chooseRandomItem() + var/list/randomItems = list() - //Sorry for all the ifs, but it makes it 1000 times easier for other people/servers to add or remove items from this list - //Add only items the player can afford: - if(uses > 19) - randomItems.Add("/obj/item/weapon/circuitboard/teleporter") //Teleporter Circuit Board (costs 20, for nuke ops) + //Sorry for all the ifs, but it makes it 1000 times easier for other people/servers to add or remove items from this list + //Add only items the player can afford: + if(uses > 19) + randomItems.Add("/obj/item/weapon/circuitboard/teleporter") //Teleporter Circuit Board (costs 20, for nuke ops) - if(uses > 9) - randomItems.Add("/obj/item/toy/syndicateballoon")//Syndicate Balloon - randomItems.Add("/obj/item/weapon/storage/syndie_kit/imp_uplink") //Uplink Implanter - randomItems.Add("/obj/item/weapon/storage/box/syndicate") //Syndicate bundle + if(uses > 9) + randomItems.Add("/obj/item/toy/syndicateballoon")//Syndicate Balloon + randomItems.Add("/obj/item/weapon/storage/syndie_kit/imp_uplink") //Uplink Implanter + randomItems.Add("/obj/item/weapon/storage/box/syndicate") //Syndicate bundle - //if(uses > 8) //Nothing... yet. - //if(uses > 7) //Nothing... yet. + //if(uses > 8) //Nothing... yet. + //if(uses > 7) //Nothing... yet. - if(uses > 6) - randomItems.Add("/obj/item/weapon/aiModule/syndicate") //Hacked AI Upload Module - randomItems.Add("/obj/item/device/radio/beacon/syndicate") //Singularity Beacon + if(uses > 6) + randomItems.Add("/obj/item/weapon/aiModule/syndicate") //Hacked AI Upload Module + randomItems.Add("/obj/item/device/radio/beacon/syndicate") //Singularity Beacon - if(uses > 5) - randomItems.Add("/obj/item/weapon/gun/projectile") //Revolver + if(uses > 5) + randomItems.Add("/obj/item/weapon/gun/projectile") //Revolver - if(uses > 4) - randomItems.Add("/obj/item/weapon/gun/energy/crossbow") //Energy Crossbow - randomItems.Add("/obj/item/device/powersink") //Powersink + if(uses > 4) + randomItems.Add("/obj/item/weapon/gun/energy/crossbow") //Energy Crossbow + randomItems.Add("/obj/item/device/powersink") //Powersink - if(uses > 3) - randomItems.Add("/obj/item/weapon/melee/energy/sword") //Energy Sword - randomItems.Add("/obj/item/clothing/mask/gas/voice") //Voice Changer - randomItems.Add("/obj/item/device/chameleon") //Chameleon Projector + if(uses > 3) + randomItems.Add("/obj/item/weapon/melee/energy/sword") //Energy Sword + randomItems.Add("/obj/item/clothing/mask/gas/voice") //Voice Changer + randomItems.Add("/obj/item/device/chameleon") //Chameleon Projector - if(uses > 2) - randomItems.Add("/obj/item/weapon/storage/emp_kit") //EMP Grenades - randomItems.Add("/obj/item/weapon/pen/paralysis") //Paralysis Pen - randomItems.Add("/obj/item/weapon/cartridge/syndicate") //Detomatix Cartridge - randomItems.Add("/obj/item/clothing/under/chameleon") //Chameleon Jumpsuit - randomItems.Add("/obj/item/weapon/card/id/syndicate") //Agent ID Card - randomItems.Add("/obj/item/weapon/card/emag") //Cryptographic Sequencer - randomItems.Add("/obj/item/weapon/storage/syndie_kit/space") //Syndicate Space Suit - randomItems.Add("/obj/item/device/encryptionkey/binary") //Binary Translator Key - randomItems.Add("/obj/item/weapon/storage/syndie_kit/imp_freedom") //Freedom Implant - randomItems.Add("/obj/item/clothing/glasses/thermal/syndi") //Thermal Imaging Goggles + if(uses > 2) + randomItems.Add("/obj/item/weapon/storage/emp_kit") //EMP Grenades + randomItems.Add("/obj/item/weapon/pen/paralysis") //Paralysis Pen + randomItems.Add("/obj/item/weapon/cartridge/syndicate") //Detomatix Cartridge + randomItems.Add("/obj/item/clothing/under/chameleon") //Chameleon Jumpsuit + randomItems.Add("/obj/item/weapon/card/id/syndicate") //Agent ID Card + randomItems.Add("/obj/item/weapon/card/emag") //Cryptographic Sequencer + randomItems.Add("/obj/item/weapon/storage/syndie_kit/space") //Syndicate Space Suit + randomItems.Add("/obj/item/device/encryptionkey/binary") //Binary Translator Key + randomItems.Add("/obj/item/weapon/storage/syndie_kit/imp_freedom") //Freedom Implant + randomItems.Add("/obj/item/clothing/glasses/thermal/syndi") //Thermal Imaging Goggles - if(uses > 1) + if(uses > 1) /* - var/list/usrItems = usr.get_contents() //Checks to see if the user has a revolver before giving ammo - var/hasRevolver = 0 - for(var/obj/I in usrItems) //Only add revolver ammo if the user has a gun that can shoot it - if(istype(I,/obj/item/weapon/gun/projectile)) - hasRevolver = 1 + var/list/usrItems = usr.get_contents() //Checks to see if the user has a revolver before giving ammo + var/hasRevolver = 0 + for(var/obj/I in usrItems) //Only add revolver ammo if the user has a gun that can shoot it + if(istype(I,/obj/item/weapon/gun/projectile)) + hasRevolver = 1 - if(hasRevolver) randomItems.Add("/obj/item/ammo_magazine/a357") //Revolver ammo + if(hasRevolver) randomItems.Add("/obj/item/ammo_magazine/a357") //Revolver ammo */ - randomItems.Add("/obj/item/ammo_magazine/a357") //Revolver ammo - randomItems.Add("/obj/item/clothing/shoes/syndigaloshes") //No-Slip Syndicate Shoes - randomItems.Add("/obj/item/weapon/plastique") //C4 + randomItems.Add("/obj/item/ammo_magazine/a357") //Revolver ammo + randomItems.Add("/obj/item/clothing/shoes/syndigaloshes") //No-Slip Syndicate Shoes + randomItems.Add("/obj/item/weapon/plastique") //C4 - if(uses > 0) - randomItems.Add("/obj/item/weapon/soap/syndie") //Syndicate Soap - randomItems.Add("/obj/item/weapon/storage/toolbox/syndicate") //Syndicate Toolbox + if(uses > 0) + randomItems.Add("/obj/item/weapon/soap/syndie") //Syndicate Soap + randomItems.Add("/obj/item/weapon/storage/toolbox/syndicate") //Syndicate Toolbox - if(!randomItems.len) - del(randomItems) - return 0 - else - var/buyItem = pick(randomItems) + if(!randomItems.len) + del(randomItems) + return 0 + else + var/buyItem = pick(randomItems) - switch(buyItem) //Ok, this gets a little messy, sorry. - if("/obj/item/weapon/circuitboard/teleporter") - uses -= 20 - if("/obj/item/toy/syndicateballoon" , "/obj/item/weapon/storage/syndie_kit/imp_uplink" , "/obj/item/weapon/storage/box/syndicate") - uses -= 10 - if("/obj/item/weapon/aiModule/syndicate" , "/obj/item/device/radio/beacon/syndicate") - uses -= 7 - if("/obj/item/weapon/gun/projectile") - uses -= 6 - if("/obj/item/weapon/gun/energy/crossbow" , "/obj/item/device/powersink") - uses -= 5 - if("/obj/item/weapon/melee/energy/sword" , "/obj/item/clothing/mask/gas/voice" , "/obj/item/device/chameleon") - uses -= 4 - if("/obj/item/weapon/storage/emp_kit" , "/obj/item/weapon/pen/paralysis" , "/obj/item/weapon/cartridge/syndicate" , "/obj/item/clothing/under/chameleon" , \ - "/obj/item/weapon/card/id/syndicate" , "/obj/item/weapon/card/emag" , "/obj/item/weapon/storage/syndie_kit/space" , "/obj/item/device/encryptionkey/binary" , \ - "/obj/item/weapon/storage/syndie_kit/imp_freedom" , "/obj/item/clothing/glasses/thermal/syndi") - uses -= 3 - if("/obj/item/ammo_magazine/a357" , "/obj/item/clothing/shoes/syndigaloshes" , "/obj/item/weapon/plastique") - uses -= 2 - if("/obj/item/weapon/soap/syndie" , "/obj/item/weapon/storage/toolbox/syndicate") - uses -= 1 - del(randomItems) - return buyItem - - proc/handleStatTracking(var/boughtItem) - //For stat tracking, sorry for making it so ugly - if(!boughtItem) return - - switch(boughtItem) + switch(buyItem) //Ok, this gets a little messy, sorry. if("/obj/item/weapon/circuitboard/teleporter") - feedback_add_details("traitor_uplink_items_bought","TP") - if("/obj/item/toy/syndicateballoon") - feedback_add_details("traitor_uplink_items_bought","BS") - if("/obj/item/weapon/storage/syndie_kit/imp_uplink") - feedback_add_details("traitor_uplink_items_bought","UI") - if("/obj/item/weapon/storage/box/syndicate") - feedback_add_details("traitor_uplink_items_bought","BU") - if("/obj/item/weapon/aiModule/syndicate") - feedback_add_details("traitor_uplink_items_bought","AI") - if("/obj/item/device/radio/beacon/syndicate") - feedback_add_details("traitor_uplink_items_bought","SB") + uses -= 20 + if("/obj/item/toy/syndicateballoon" , "/obj/item/weapon/storage/syndie_kit/imp_uplink" , "/obj/item/weapon/storage/box/syndicate") + uses -= 10 + if("/obj/item/weapon/aiModule/syndicate" , "/obj/item/device/radio/beacon/syndicate") + uses -= 7 if("/obj/item/weapon/gun/projectile") - feedback_add_details("traitor_uplink_items_bought","RE") - if("/obj/item/weapon/gun/energy/crossbow") - feedback_add_details("traitor_uplink_items_bought","XB") - if("/obj/item/device/powersink") - feedback_add_details("traitor_uplink_items_bought","PS") - if("/obj/item/weapon/melee/energy/sword") - feedback_add_details("traitor_uplink_items_bought","ES") - if("/obj/item/clothing/mask/gas/voice") - feedback_add_details("traitor_uplink_items_bought","VC") - if("/obj/item/device/chameleon") - feedback_add_details("traitor_uplink_items_bought","CP") - if("/obj/item/weapon/storage/emp_kit") - feedback_add_details("traitor_uplink_items_bought","EM") - if("/obj/item/weapon/pen/paralysis") - feedback_add_details("traitor_uplink_items_bought","PP") - if("/obj/item/weapon/cartridge/syndicate") - feedback_add_details("traitor_uplink_items_bought","DC") - if("/obj/item/clothing/under/chameleon") - feedback_add_details("traitor_uplink_items_bought","CJ") - if("/obj/item/weapon/card/id/syndicate") - feedback_add_details("traitor_uplink_items_bought","AC") - if("/obj/item/weapon/card/emag") - feedback_add_details("traitor_uplink_items_bought","EC") - if("/obj/item/weapon/storage/syndie_kit/space") - feedback_add_details("traitor_uplink_items_bought","SS") - if("/obj/item/device/encryptionkey/binary") - feedback_add_details("traitor_uplink_items_bought","BT") - if("/obj/item/weapon/storage/syndie_kit/imp_freedom") - feedback_add_details("traitor_uplink_items_bought","FI") - if("/obj/item/clothing/glasses/thermal/syndi") - feedback_add_details("traitor_uplink_items_bought","TM") - if("/obj/item/ammo_magazine/a357") - feedback_add_details("traitor_uplink_items_bought","RA") - if("/obj/item/clothing/shoes/syndigaloshes") - feedback_add_details("traitor_uplink_items_bought","SH") - if("/obj/item/weapon/plastique") - feedback_add_details("traitor_uplink_items_bought","C4") - if("/obj/item/weapon/soap/syndie") - feedback_add_details("traitor_uplink_items_bought","SP") - if("/obj/item/weapon/storage/toolbox/syndicate") - feedback_add_details("traitor_uplink_items_bought","ST") + uses -= 6 + if("/obj/item/weapon/gun/energy/crossbow" , "/obj/item/device/powersink") + uses -= 5 + if("/obj/item/weapon/melee/energy/sword" , "/obj/item/clothing/mask/gas/voice" , "/obj/item/device/chameleon") + uses -= 4 + if("/obj/item/weapon/storage/emp_kit" , "/obj/item/weapon/pen/paralysis" , "/obj/item/weapon/cartridge/syndicate" , "/obj/item/clothing/under/chameleon" , \ + "/obj/item/weapon/card/id/syndicate" , "/obj/item/weapon/card/emag" , "/obj/item/weapon/storage/syndie_kit/space" , "/obj/item/device/encryptionkey/binary" , \ + "/obj/item/weapon/storage/syndie_kit/imp_freedom" , "/obj/item/clothing/glasses/thermal/syndi") + uses -= 3 + if("/obj/item/ammo_magazine/a357" , "/obj/item/clothing/shoes/syndigaloshes" , "/obj/item/weapon/plastique") + uses -= 2 + if("/obj/item/weapon/soap/syndie" , "/obj/item/weapon/storage/toolbox/syndicate") + uses -= 1 + del(randomItems) + return buyItem - Topic(href, href_list) - if (href_list["buy_item"]) - if(href_list["buy_item"] == "random") - var/boughtItem = chooseRandomItem() - if(boughtItem) - href_list["buy_item"] = boughtItem - feedback_add_details("traitor_uplink_items_bought","RN") - return 1 - else - return 0 +/obj/item/device/uplink/proc/handleStatTracking(var/boughtItem) +//For stat tracking, sorry for making it so ugly + if(!boughtItem) return + switch(boughtItem) + if("/obj/item/weapon/circuitboard/teleporter") + feedback_add_details("traitor_uplink_items_bought","TP") + if("/obj/item/toy/syndicateballoon") + feedback_add_details("traitor_uplink_items_bought","BS") + if("/obj/item/weapon/storage/syndie_kit/imp_uplink") + feedback_add_details("traitor_uplink_items_bought","UI") + if("/obj/item/weapon/storage/box/syndicate") + feedback_add_details("traitor_uplink_items_bought","BU") + if("/obj/item/weapon/aiModule/syndicate") + feedback_add_details("traitor_uplink_items_bought","AI") + if("/obj/item/device/radio/beacon/syndicate") + feedback_add_details("traitor_uplink_items_bought","SB") + if("/obj/item/weapon/gun/projectile") + feedback_add_details("traitor_uplink_items_bought","RE") + if("/obj/item/weapon/gun/energy/crossbow") + feedback_add_details("traitor_uplink_items_bought","XB") + if("/obj/item/device/powersink") + feedback_add_details("traitor_uplink_items_bought","PS") + if("/obj/item/weapon/melee/energy/sword") + feedback_add_details("traitor_uplink_items_bought","ES") + if("/obj/item/clothing/mask/gas/voice") + feedback_add_details("traitor_uplink_items_bought","VC") + if("/obj/item/device/chameleon") + feedback_add_details("traitor_uplink_items_bought","CP") + if("/obj/item/weapon/storage/emp_kit") + feedback_add_details("traitor_uplink_items_bought","EM") + if("/obj/item/weapon/pen/paralysis") + feedback_add_details("traitor_uplink_items_bought","PP") + if("/obj/item/weapon/cartridge/syndicate") + feedback_add_details("traitor_uplink_items_bought","DC") + if("/obj/item/clothing/under/chameleon") + feedback_add_details("traitor_uplink_items_bought","CJ") + if("/obj/item/weapon/card/id/syndicate") + feedback_add_details("traitor_uplink_items_bought","AC") + if("/obj/item/weapon/card/emag") + feedback_add_details("traitor_uplink_items_bought","EC") + if("/obj/item/weapon/storage/syndie_kit/space") + feedback_add_details("traitor_uplink_items_bought","SS") + if("/obj/item/device/encryptionkey/binary") + feedback_add_details("traitor_uplink_items_bought","BT") + if("/obj/item/weapon/storage/syndie_kit/imp_freedom") + feedback_add_details("traitor_uplink_items_bought","FI") + if("/obj/item/clothing/glasses/thermal/syndi") + feedback_add_details("traitor_uplink_items_bought","TM") + if("/obj/item/ammo_magazine/a357") + feedback_add_details("traitor_uplink_items_bought","RA") + if("/obj/item/clothing/shoes/syndigaloshes") + feedback_add_details("traitor_uplink_items_bought","SH") + if("/obj/item/weapon/plastique") + feedback_add_details("traitor_uplink_items_bought","C4") + if("/obj/item/weapon/soap/syndie") + feedback_add_details("traitor_uplink_items_bought","SP") + if("/obj/item/weapon/storage/toolbox/syndicate") + feedback_add_details("traitor_uplink_items_bought","ST") + +/obj/item/device/uplink/Topic(href, href_list) + + if (href_list["buy_item"]) + if(href_list["buy_item"] == "random") + var/boughtItem = chooseRandomItem() + if(boughtItem) + href_list["buy_item"] = boughtItem + feedback_add_details("traitor_uplink_items_bought","RN") + return 1 else - if(text2num(href_list["cost"]) > uses) // Not enough crystals for the item - return 0 + return 0 - //if(usr:mind && ticker.mode.traitors[usr:mind]) - //var/datum/traitorinfo/info = ticker.mode.traitors[usr:mind] - //info.spawnlist += href_list["buy_item"] - - uses -= text2num(href_list["cost"]) - handleStatTracking(href_list["buy_item"]) //Note: chooseRandomItem handles it's own stat tracking. This proc is not meant for 'random'. - return 1 - - -/* - *PDA uplink - */ - -//Syndicate uplink hidden inside a traitor PDA -//Communicate with traitor through the PDA's note function. - -/obj/item/device/uplink/pda - name = "uplink module" - desc = "An electronic uplink system of unknown origin." - icon = 'icons/obj/module.dmi' - icon_state = "power_mod" - var/obj/item/device/pda/hostpda = null - - var/orignote = null //Restore original notes when locked. - var/active = 0 //Are we currently active? - var/lock_code = "" //The unlocking password. - - proc - unlock() - if ((isnull(src.hostpda)) || (src.active)) - return - - src.orignote = src.hostpda.note - src.active = 1 - src.hostpda.mode = 1 //Switch right to the notes program - - src.generate_menu() - print_to_host(menu_message) - - for (var/mob/M in viewers(1, src.hostpda.loc)) - if (M.client && M.machine == src.hostpda) - src.hostpda.attack_self(M) - - return - - print_to_host(var/text) - if (isnull(hostpda)) - return - hostpda.note = text - - for (var/mob/M in viewers(1, hostpda.loc)) - if (M.client && M.machine == hostpda) - hostpda.attack_self(M) - return - - shutdown_uplink() - if (isnull(src.hostpda)) - return - active = 0 - hostpda.note = orignote - if (hostpda.mode==1) - hostpda.mode = 0 - hostpda.updateDialog() - return - - attack_self(mob/user as mob) - src.generate_menu() - src.hostpda.note = src.menu_message - - - Topic(href, href_list) - if ((isnull(src.hostpda)) || (!src.active)) - return - - if (usr.stat || usr.restrained() || !in_range(src.hostpda, usr)) - return - - if(..() == 1) // We can afford the item - var/path_obj = text2path(href_list["buy_item"]) - var/mob/A = src.hostpda.loc - var/item = new path_obj(get_turf(src.hostpda)) - if(ismob(A) && !(locate(item) in NotInHand)) //&& !istype(item, /obj/spawner)) - if(!A.r_hand) - item:loc = A - A.r_hand = item - item:layer = 20 - A.update_inv_r_hand() - else if(!A.l_hand) - item:loc = A - A.l_hand = item - item:layer = 20 - A.update_inv_l_hand() - else - item:loc = get_turf(A) - // usr.client.onBought("[item:name]") When we have the stats again, uncomment. - /* if(istype(item, /obj/spawner)) // Spawners need to have del called on them to avoid leaving a marker behind - del item*/ - //HEADFINDBACK - src.attack_self(usr) - src.hostpda.attack_self(usr) - return - - -/* - *Portable radio uplink - */ - -//A Syndicate uplink disguised as a portable radio -/obj/item/device/uplink/radio/implanted - New() - ..() - uses = 5 - return - - explode() - var/obj/item/weapon/implant/uplink/U = src.loc - var/mob/living/A = U.imp_in - A.gib() - ..() -// var/turf/location = get_turf(src.loc) -// if(location) -// location.hotspot_expose(700,125) -// explosion(location, 0, 0, 2, 4, 1) - -// var/obj/item/weapon/implant/uplink/U = src.loc -// var/mob/living/A = U.imp_in -// var/datum/organ/external/head = A:organs["head"] -// head.destroyed = 1 -// spawn(2) -// head.droplimb() -// del(src.master) -// del(src) -// return - - -/obj/item/device/uplink/radio - name = "ship bounced radio" - icon = 'icons/obj/radio.dmi' - icon_state = "radio" - var/temp = null //Temporary storage area for a message offering the option to destroy the radio - var/selfdestruct = 0 //Set to 1 while the radio is self destructing itself. - var/obj/item/device/radio/origradio = null - flags = FPRINT | TABLEPASS | CONDUCT - slot_flags = SLOT_BELT - w_class = 2.0 - item_state = "radio" - throwforce = 5 - throw_speed = 4 - throw_range = 20 - m_amt = 100 - - attack_self(mob/user as mob) - var/dat - - if (src.selfdestruct) - dat = "Self Destructing..." else - if (src.temp) - dat = "[src.temp]

Clear" - else - src.generate_menu() - dat = src.menu_message - if (src.origradio) // Checking because sometimes the radio uplink may be spawned by itself, not as a normal unlockable radio - dat += "Lock
" - dat += "
" - dat += "Self-Destruct" + if(text2num(href_list["cost"]) > uses) // Not enough crystals for the item + return 0 - user << browse(dat, "window=radio") - onclose(user, "radio") + //if(usr:mind && ticker.mode.traitors[usr:mind]) + //var/datum/traitorinfo/info = ticker.mode.traitors[usr:mind] + //info.spawnlist += href_list["buy_item"] + + uses -= text2num(href_list["cost"]) + handleStatTracking(href_list["buy_item"]) //Note: chooseRandomItem handles it's own stat tracking. This proc is not meant for 'random'. + return 1 + + + +// HIDDEN UPLINK - Can be stored in anything but the host item has to have a trigger for it. +/* How to create an uplink in 3 easy steps! + + 1. All obj/item 's have a hidden_uplink var. By default it's null. Give the item one with "new(src)", it must be in it's contents. Feel free to add "uses". + + 2. Code in the triggers. Use check_trigger for this, I recommend closing the item's menu with "usr << browse(null, "window=windowname") if it returns true. + The var/value is the value that will be compared with the var/target. If they are equal it will activate the menu. + + 3. If you want the menu to stay until the users locks his uplink, add an active_uplink_check(mob/user as mob) in your interact/attack_hand proc. + Then check if it's true, if true return. This will stop the normal menu appearing and will instead show the uplink menu. +*/ + +/obj/item/device/uplink/hidden + name = "Hidden Uplink." + desc = "There is something wrong if you're examining this." + var/active = 0 + +// The hidden uplink MUST be inside an obj/item's contents. +/obj/item/device/uplink/hidden/New() + spawn(2) + if(!istype(src.loc, /obj/item)) + del(src) + ..() + +// Toggles the uplink on and off. Normally this will bypass the item's normal functions and go to the uplink menu, if activated. +/obj/item/device/uplink/hidden/proc/toggle() + active = !active + +// Directly trigger the uplink. Turn on if it isn't already. +/obj/item/device/uplink/hidden/proc/trigger(mob/user as mob) + if(!active) + toggle() + interact(user) + +// Checks to see if the value meets the target. Like a frequency being a traitor_frequency, in order to unlock a headset. +// If true, it accesses trigger() and returns 1. If it fails, it returns false. Use this to see if you need to close the +// current item's menu. +/obj/item/device/uplink/hidden/proc/check_trigger(mob/user as mob, var/value, var/target) + if(value == target) + trigger(user) + return 1 + return 0 + +// Interaction code. Gathers a list of items purchasable from the paren't uplink and displays it. It also adds a lock button. +/obj/item/device/uplink/hidden/proc/interact(mob/user as mob) + + var/dat = "" + dat += src.generate_menu() + dat += "Lock" + dat += "" + user << browse(dat, "window=hidden") + onclose(user, "hidden") + return + +// The purchasing code. +/obj/item/device/uplink/hidden/Topic(href, href_list) + + if (usr.stat || usr.restrained()) return - Topic(href, href_list) - if (usr.stat || usr.restrained()) - return + if (!( istype(usr, /mob/living/carbon/human))) + return 0 - if (!( istype(usr, /mob/living/carbon/human))) + if ((usr.contents.Find(src.loc) || (in_range(src.loc, usr) && istype(src.loc.loc, /turf)))) + usr.machine = src + if(href_list["lock"]) + toggle() + usr << browse(null, "window=hidden") return 1 - if ((usr.contents.Find(src) || (in_range(src, usr) && istype(src.loc, /turf)) || istype(src.loc,/obj/item/weapon/implant/uplink))) - usr.machine = src + if(..(href, href_list) == 1) + var/path_obj = text2path(href_list["buy_item"]) + var/obj/I = new path_obj(get_turf(usr)) + if(ishuman(usr)) + var/mob/living/carbon/human/A = usr + A.put_in_any_hand_if_possible(I) + interact(usr) + return - if(href_list["buy_item"]) - if(..() == 1) // We can afford the item - var/path_obj = text2path(href_list["buy_item"]) - var/item = new path_obj(get_turf(src.loc)) - var/mob/A = src.loc - if(istype(src.loc,/obj/item/weapon/implant/uplink)) - var/obj/item/weapon/implant/uplink/U = src.loc - A = U.imp_in - if(ismob(A) && !(locate(item) in NotInHand)) //&& !istype(item, /obj/spawner)) - if(!A.r_hand) - item:loc = A - A.r_hand = item - A.update_inv_r_hand() - item:layer = 20 - else if(!A.l_hand) - item:loc = A - A.l_hand = item - A.update_inv_l_hand() - item:layer = 20 - else - item:loc = get_turf(A) - /* if(istype(item, /obj/spawner)) // Spawners need to have del called on them to avoid leaving a marker behind - del item*/ - // usr.client.onBought("[item:name]") When we have the stats again, uncomment. - src.attack_self(usr) - return +// I placed this here because of how relevant it is. +// You place this in your uplinkable item to check if an uplink is active or not. +// If it is, it will display the uplink menu and return 1, else it'll return false. +// If it returns true, I recommend closing the item's normal menu with "user << browse(null, "window=name")" +/obj/item/proc/active_uplink_check(mob/user as mob) + // Activates the uplink if it's active + if(src.hidden_uplink) + if(src.hidden_uplink.active) + src.hidden_uplink.trigger(user) + return 1 + return 0 - else if (href_list["lock"] && src.origradio) - // presto chango, a regular radio again! (reset the freq too...) - usr.machine = null - usr << browse(null, "window=radio") - var/obj/item/device/radio/T = src.origradio - var/obj/item/device/uplink/radio/R = src - R.loc = T - T.loc = usr - // R.layer = initial(R.layer) - R.layer = 0 - if (usr.client) - usr.client.screen -= R - if (usr.r_hand == R) - usr.u_equip(R) - usr.r_hand = T -// usr.update_inv_r_hand() - else - usr.u_equip(R) - usr.l_hand = T -// usr.update_inv_l_hand() - R.loc = T - T.layer = 20 - T.set_frequency(initial(T.frequency)) - T.attack_self(usr) - return +// PRESET UPLINKS +// A collection of preset uplinks. +// +// Includes normal radio uplink, multitool uplink, +// implant uplink (not the implant tool) and a preset headset uplink. - else if (href_list["selfdestruct"]) - src.temp = "Self-Destruct" +/obj/item/device/radio/uplink/New() + hidden_uplink = new(src) - else if (href_list["selfdestruct2"]) - src.selfdestruct = 1 - spawn (100) - explode() - return +/obj/item/device/radio/uplink/attack_self(mob/user as mob) + if(hidden_uplink) + hidden_uplink.trigger(user) - else if (href_list["clear_selfdestruct"]) - src.temp = null +/obj/item/device/multitool/uplink/New() + hidden_uplink = new(src) - attack_self(usr) -// if (istype(src.loc, /mob)) -// attack_self(src.loc) -// else -// for(var/mob/M in viewers(1, src)) -// if (M.client) -// src.attack_self(M) - return +/obj/item/device/multitool/uplink/attack_self(mob/user as mob) + if(hidden_uplink) + hidden_uplink.trigger(user) - proc/explode() - var/turf/location = get_turf(src.loc) - if(location) - location.hotspot_expose(700,125) - explosion(location, 0, 0, 2, 4, 1) +/obj/item/weapon/implant/uplink + name = "uplink" + desc = "Summon things." + var/activation_emote = "chuckle" + +/obj/item/weapon/implant/uplink/New() + activation_emote = pick("blink", "blink_r", "eyebrow", "chuckle", "twitch_s", "frown", "nod", "blush", "giggle", "grin", "groan", "shrug", "smile", "pale", "sniff", "whimper", "wink") + hidden_uplink = new(src) + hidden_uplink.uses = 5 + ..() + return + +// Moved the Uplink Implant here + +/obj/item/weapon/implant/uplink/implanted(mob/source) + activation_emote = input("Choose activation emote:") in list("blink", "blink_r", "eyebrow", "chuckle", "twitch_s", "frown", "nod", "blush", "giggle", "grin", "groan", "shrug", "smile", "pale", "sniff", "whimper", "wink") + source.mind.store_memory("Uplink implant can be activated by using the [src.activation_emote] emote, say *[src.activation_emote] to attempt to activate.", 0, 0) + source << "The implanted uplink implant can be activated by using the [src.activation_emote] emote, say *[src.activation_emote] to attempt to activate." + return 1 + + +/obj/item/weapon/implant/uplink/trigger(emote, mob/source as mob) + if(hidden_uplink && usr == source) // Let's not have another people activate our uplink + hidden_uplink.check_trigger(source, emote, activation_emote) + return + +/obj/item/device/radio/headset/uplink + traitor_frequency = 1445 + +/obj/item/device/radio/headset/uplink/New() + ..() + hidden_uplink = new(src) + hidden_uplink.uses = 10 - del(src.master) - del(src) - return - proc/shutdown_uplink() - if (!src.origradio) - return - var/list/nearby = viewers(1, src) - for(var/mob/M in nearby) - if (M.client && M.machine == src) - M << browse(null, "window=radio") - M.machine = null - var/obj/item/device/radio/T = src.origradio - var/obj/item/device/uplink/radio/R = src - var/mob/L = src.loc - R.loc = T - T.loc = L - // R.layer = initial(R.layer) //TODO: CARN - R.layer = 0 - if (istype(L)) - if (L.client) - L.client.screen -= R - if (L.r_hand == R) - L.u_equip(R) - L.r_hand = T - L.update_inv_r_hand() - else - L.u_equip(R) - L.l_hand = T - L.update_inv_l_hand() - T.layer = 20 - T.set_frequency(initial(T.frequency)) - return \ No newline at end of file diff --git a/code/modules/mob/mob.dm b/code/modules/mob/mob.dm index d58ea1f4824..2b7e616e688 100644 --- a/code/modules/mob/mob.dm +++ b/code/modules/mob/mob.dm @@ -102,6 +102,13 @@ if(istype(W)) equip_to_slot_if_possible(W, slot) +/mob/proc/put_in_any_hand_if_possible(obj/item/W as obj, del_on_fail = 0, disable_warning = 1, redraw_mob = 1) + if(equip_to_slot_if_possible(W, slot_l_hand, del_on_fail, disable_warning, redraw_mob)) + return 1 + else if(equip_to_slot_if_possible(W, slot_r_hand, del_on_fail, disable_warning, redraw_mob)) + return 1 + return 0 + //This is a SAFE proc. Use this instead of equip_to_splot()! //set del_on_fail to have it delete W if it fails to equip //set disable_warning to disable the 'you are unable to equip that' warning. @@ -406,7 +413,7 @@ var/list/slot_equipment_priority = list( \ for (var/obj/item/weapon/disk/nuclear/D in world) var/name = "Nuclear Disk" - if (name in names) + if (names.Find(name)) namecounts[name]++ name = "[name] ([namecounts[name]])" else @@ -416,7 +423,7 @@ var/list/slot_equipment_priority = list( \ for (var/obj/machinery/singularity/S in world) var/name = "Singularity" - if (name in names) + if (names.Find(name)) namecounts[name]++ name = "[name] ([namecounts[name]])" else @@ -426,7 +433,7 @@ var/list/slot_equipment_priority = list( \ for (var/obj/machinery/bot/B in world) var/name = "BOT: [B.name]" - if (name in names) + if (names.Find(name)) namecounts[name]++ name = "[name] ([namecounts[name]])" else @@ -436,7 +443,7 @@ var/list/slot_equipment_priority = list( \ /* for (var/mob/living/silicon/decoy/D in world) var/name = "[D.name]" - if (name in names) + if (names.Find(name)) namecounts[name]++ name = "[name] ([namecounts[name]])" else @@ -451,54 +458,35 @@ var/list/slot_equipment_priority = list( \ for(var/mob/M in sortAtom(mob_list)) var/name = M.name - if (name in names) + if (names.Find(name)) namecounts[name]++ name = "[name] ([namecounts[name]])" else names.Add(name) namecounts[name] = 1 + creatures[name] = M + //THIS IS THE MOBS PART: LOOK IN HELPERS.DM client.perspective = EYE_PERSPECTIVE var/eye_name = null - if (is_admin) - eye_name = input("Please, select a player!", "Admin Observe", null, null) as null|anything in creatures - else - eye_name = input("Please, select a player!", "Observe", null, null) as null|anything in creatures + var/ok = "[is_admin ? "Admin Observe" : "Observe"]" + eye_name = input("Please, select a player!", ok, null, null) as null|anything in creatures if (!eye_name) return - var/mob/eye = creatures[eye_name] - if (is_admin) - if (eye) - reset_view(eye) + var/mob/mob_eye = creatures[eye_name] + + if(client && mob_eye) + client.eye = mob_eye + if (is_admin) client.adminobs = 1 - if(eye == client.mob) + if(mob_eye == client.mob || client.eye == client.mob) client.adminobs = 0 - else - reset_view(null) - client.adminobs = 0 - else - if(ticker) -// world << "there's a ticker" - if(ticker.mode.name == "AI malfunction") -// world << "ticker says its malf" - var/datum/game_mode/malfunction/malf = ticker.mode - for (var/datum/mind/B in malf.malf_ai) -// world << "comparing [B.current] to [eye]" - if (B.current == eye) - for (var/mob/living/silicon/decoy/D in world) - if (eye) - eye = D - if (client) - if (eye) - client.eye = eye - else - client.eye = client.mob /mob/verb/cancel_camera() set name = "Cancel Camera View"