From b523a59ae5c3f5c837ae7b4494a5954629a6b3fc Mon Sep 17 00:00:00 2001 From: ShizCalev Date: Sat, 30 Jun 2018 15:09:29 -0400 Subject: [PATCH 1/2] Fixes PDA ID teleporting (#38795) --- code/game/objects/items/devices/PDA/PDA.dm | 85 +++++++++------------- 1 file changed, 35 insertions(+), 50 deletions(-) diff --git a/code/game/objects/items/devices/PDA/PDA.dm b/code/game/objects/items/devices/PDA/PDA.dm index 6731caffd7..db86adab07 100644 --- a/code/game/objects/items/devices/PDA/PDA.dm +++ b/code/game/objects/items/devices/PDA/PDA.dm @@ -533,10 +533,10 @@ GLOBAL_LIST_EMPTY(PDAs) U << browse(null, "window=pda") return if("Message") - src.create_message(U, locate(href_list["target"])) + create_message(U, locate(href_list["target"])) if("MessageAll") - src.send_to_all(U) + send_to_all(U) if("cart") if(cartridge) @@ -562,7 +562,7 @@ GLOBAL_LIST_EMPTY(PDAs) if("1") // Configure pAI device pai.attack_self(U) if("2") // Eject pAI device - var/turf/T = get_turf(src.loc) + var/turf/T = get_turf(loc) if(T) pai.forceMove(T) @@ -593,13 +593,13 @@ GLOBAL_LIST_EMPTY(PDAs) return /obj/item/pda/proc/remove_id() + + if(issilicon(usr) || !usr.canUseTopic(src, BE_CLOSE)) + return + if (id) - if (ismob(loc)) - var/mob/M = loc - M.put_in_hands(id) - to_chat(usr, "You remove the ID from the [name].") - else - id.forceMove(drop_location()) + usr.put_in_hands(id) + to_chat(usr, "You remove the ID from the [name].") id = null update_icon() @@ -607,9 +607,7 @@ GLOBAL_LIST_EMPTY(PDAs) var/t = stripped_input(U, "Please enter message", name) if (!t || toff) return - if (!in_range(src, U) && loc != U) - return - if(!U.canUseTopic(src)) + if(!U.canUseTopic(src, BE_CLOSE)) return if(emped) t = Gibberish(t, 100) @@ -707,57 +705,44 @@ GLOBAL_LIST_EMPTY(PDAs) /obj/item/pda/AltClick() ..() - if(issilicon(usr)) - return - - if(usr.canUseTopic(src)) - if(id) - remove_id() - else - remove_pen() + if(id) + remove_id() + else + remove_pen() /obj/item/pda/CtrlClick() ..() - if(issilicon(usr)) + if(isturf(loc)) //stops the user from dragging the PDA by ctrl-clicking it. return - if(usr.canUseTopic(src) && !isturf(loc)) - remove_pen() + remove_pen() /obj/item/pda/verb/verb_remove_id() set category = "Object" set name = "Eject ID" set src in usr - if(issilicon(usr)) - return - - if (usr.canUseTopic(src)) - if(id) - remove_id() - else - to_chat(usr, "This PDA does not have an ID in it!") + if(id) + remove_id() + else + to_chat(usr, "This PDA does not have an ID in it!") /obj/item/pda/verb/verb_remove_pen() set category = "Object" set name = "Remove Pen" set src in usr - if(issilicon(usr)) - return - - if (usr.canUseTopic(src)) - remove_pen() + remove_pen() /obj/item/pda/proc/remove_pen() + + if(issilicon(usr) || !usr.canUseTopic(src, BE_CLOSE)) + return + if(inserted_item) - if(ismob(loc)) - var/mob/M = loc - M.put_in_hands(inserted_item) - else - inserted_item.forceMove(drop_location()) - to_chat(usr, "You remove \the [inserted_item] from \the [src].") + usr.put_in_hands(inserted_item) + to_chat(usr, "You remove [inserted_item] from [src].") inserted_item = null update_icon() else @@ -768,7 +753,7 @@ GLOBAL_LIST_EMPTY(PDAs) if(!I) if(id) remove_id() - return 1 + return TRUE else var/obj/item/card/id/C = user.get_active_held_item() if(istype(C)) @@ -776,13 +761,13 @@ GLOBAL_LIST_EMPTY(PDAs) if(I && I.registered_name) if(!user.transferItemToLoc(I, src)) - return 0 + return FALSE var/obj/old_id = id id = I if(old_id) user.put_in_hands(old_id) update_icon() - return 1 + return TRUE // access to status display signals /obj/item/pda/attackby(obj/item/C, mob/user, params) @@ -813,7 +798,7 @@ GLOBAL_LIST_EMPTY(PDAs) updateSelfDialog()//Update self dialog on success. return //Return in case of failed check or when successful. updateSelfDialog()//For the non-input related code. - else if(istype(C, /obj/item/paicard) && !src.pai) + else if(istype(C, /obj/item/paicard) && !pai) if(!user.transferItemToLoc(C, src)) return pai = C @@ -926,14 +911,14 @@ GLOBAL_LIST_EMPTY(PDAs) var/list/plist = list() var/list/namecounts = list() - if(src.aiPDA.toff) + if(aiPDA.toff) to_chat(user, "Turn on your receiver in order to send messages.") return for (var/obj/item/pda/P in get_viewable_pdas()) if (P == src) continue - else if (P == src.aiPDA) + else if (P == aiPDA) continue plist[avoid_assoc_duplicate_keys(P.owner, namecounts)] = P @@ -949,12 +934,12 @@ GLOBAL_LIST_EMPTY(PDAs) var/add_photo = input(user,"Do you want to attach a photo?","Photo","No") as null|anything in list("Yes","No") if(add_photo=="Yes") var/datum/picture/Pic = aicamera.selectpicture(aicamera) - src.aiPDA.photo = Pic.fields["img"] + aiPDA.photo = Pic.fields["img"] if(incapacitated()) return - src.aiPDA.create_message(src, selected) + aiPDA.create_message(src, selected) /mob/living/silicon/ai/verb/cmd_toggle_pda_receiver()