From 9d9a6c207882b4911d8a7007b076e16b03aa5900 Mon Sep 17 00:00:00 2001 From: SkyratBot <59378654+SkyratBot@users.noreply.github.com> Date: Tue, 2 Jul 2024 11:57:06 +0200 Subject: [PATCH] [MIRROR] adds swapping pens in PDAs (#28544) * adds swapping pens in PDAs (#84437) ## About The Pull Request Added the ability to swap items in PDAs
Videos https://github.com/tgstation/tgstation/assets/112967882/b3c63d7b-7913-42a6-83e7-d2989cdac8b2
## Why It's Good For The Game You can quickly change items stored in the PDA slots without doing unnecessary actions (pulling the pen out of the PDA, removing it, and inserting another pen) ## Changelog :cl: qol: you can now swap pens in pdas /:cl: --------- Co-authored-by: Ghom <42542238+Ghommie@ users.noreply.github.com> * adds swapping pens in PDAs --------- Co-authored-by: Kocma-san <112967882+Kocma-san@users.noreply.github.com> Co-authored-by: Ghom <42542238+Ghommie@ users.noreply.github.com> --- .../modular_computers/computers/item/pda.dm | 20 +++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/code/modules/modular_computers/computers/item/pda.dm b/code/modules/modular_computers/computers/item/pda.dm index a0c5284d93d..8df5cad8850 100644 --- a/code/modules/modular_computers/computers/item/pda.dm +++ b/code/modules/modular_computers/computers/item/pda.dm @@ -153,14 +153,14 @@ if(tool.w_class >= WEIGHT_CLASS_SMALL) // Anything equal to or larger than small won't work user.balloon_alert(user, "too big!") return ITEM_INTERACT_BLOCKING - if(inserted_item) - balloon_alert(user, "no room!") - return ITEM_INTERACT_BLOCKING if(!user.transferItemToLoc(tool, src)) return ITEM_INTERACT_BLOCKING - balloon_alert(user, "inserted [tool]") - inserted_item = tool - playsound(src, 'sound/machines/pda_button1.ogg', 50, TRUE) + if(inserted_item) + swap_pen(user, tool) + else + balloon_alert(user, "inserted [tool]") + inserted_item = tool + playsound(src, 'sound/machines/pda_button1.ogg', 50, TRUE) return ITEM_INTERACT_SUCCESS @@ -189,6 +189,14 @@ update_appearance() playsound(src, 'sound/machines/pda_button2.ogg', 50, TRUE) +/obj/item/modular_computer/pda/proc/swap_pen(mob/user, obj/item/tool) + if(inserted_item) + balloon_alert(user, "swapped pens") + user.put_in_hands(inserted_item) + inserted_item = tool + update_appearance() + playsound(src, 'sound/machines/pda_button1.ogg', 50, TRUE) + /obj/item/modular_computer/pda/proc/explode(mob/target, mob/bomber, from_message_menu = FALSE) var/turf/current_turf = get_turf(src)