From 746d8f171da8d215b530b07c273a9c10c01b4a4e Mon Sep 17 00:00:00 2001 From: SkyratBot <59378654+SkyratBot@users.noreply.github.com> Date: Sun, 23 May 2021 05:39:40 +0200 Subject: [PATCH] [MIRROR] Credits Put Into PDAs/Modular Computers Go Into Inserted IDs (#5872) * Credits Put Into PDAs/Modular Computers Go Into Inserted IDs (#59180) * Credits Put Into PDAs/Modular Computers Go Into Inserted IDs If a PDA or Modular Computer is attacked by something, it now checks to see if it can insert the object into the inserted ID * Commenting the code * Added Istype Checks Based on Feedback * Adding a return to match the style of code in the same block * Using Iscash instead of Istype spam Changes the ID, PDA, and Modular Computer code to use Iscash (Apparently this already existed!) Additionally, physical currency is checked internally instead of externall * Credits Put Into PDAs/Modular Computers Go Into Inserted IDs Co-authored-by: Beatrice <83368538+SpaceDragon00@users.noreply.github.com> --- code/game/objects/items/cards_ids.dm | 14 ++++++-------- code/game/objects/items/devices/PDA/PDA.dm | 3 +++ .../modular_computers/computers/item/computer.dm | 6 ++++++ 3 files changed, 15 insertions(+), 8 deletions(-) diff --git a/code/game/objects/items/cards_ids.dm b/code/game/objects/items/cards_ids.dm index 3fd02d43811..cec98e42b3e 100644 --- a/code/game/objects/items/cards_ids.dm +++ b/code/game/objects/items/cards_ids.dm @@ -431,15 +431,9 @@ if(istype(W, /obj/item/rupee)) to_chat(user, "Your ID smartly rejects the strange shard of glass. Who knew, apparently it's not ACTUALLY valuable!") return - else if(istype(W, /obj/item/holochip)) + else if(iscash(W)) insert_money(W, user) return - else if(istype(W, /obj/item/stack/spacecash)) - insert_money(W, user, TRUE) - return - else if(istype(W, /obj/item/coin)) - insert_money(W, user, TRUE) - return else if(istype(W, /obj/item/storage/bag/money)) var/obj/item/storage/bag/money/money_bag = W var/list/money_contained = money_bag.contents @@ -463,7 +457,11 @@ * user - The user inserting the item. * physical_currency - Boolean, whether this is a physical currency such as a coin and not a holochip. */ -/obj/item/card/id/proc/insert_money(obj/item/money, mob/user, physical_currency) +/obj/item/card/id/proc/insert_money(obj/item/money, mob/user) + var/physical_currency + if(istype(money, /obj/item/stack/spacecash) || istype(money, /obj/item/coin)) + physical_currency = TRUE + if(!registered_account) to_chat(user, "[src] doesn't have a linked account to deposit [money] into!") return diff --git a/code/game/objects/items/devices/PDA/PDA.dm b/code/game/objects/items/devices/PDA/PDA.dm index b9c5619e763..97c698b9973 100644 --- a/code/game/objects/items/devices/PDA/PDA.dm +++ b/code/game/objects/items/devices/PDA/PDA.dm @@ -1075,6 +1075,9 @@ GLOBAL_LIST_EMPTY(PDAs) var/obj/item/photo/P = C picture = P.picture to_chat(user, "You scan \the [C].") + // Check to see if we have an ID inside, and a valid input for money + else if(id && iscash(C)) + id.attackby(C, user) // If we do, try and put that attacking object in else return ..() diff --git a/code/modules/modular_computers/computers/item/computer.dm b/code/modules/modular_computers/computers/item/computer.dm index cc9051f04f0..8bfa86416da 100644 --- a/code/modules/modular_computers/computers/item/computer.dm +++ b/code/modules/modular_computers/computers/item/computer.dm @@ -548,6 +548,12 @@ to_chat(user, "You repair \the [src].") return + var/obj/item/computer_hardware/card_slot/card_slot = all_components[MC_CARD] + // Check to see if we have an ID inside, and a valid input for money + if(card_slot?.GetID() && iscash(W)) + var/obj/item/card/id/id = card_slot.GetID() + id.attackby(W, user) // If we do, try and put that attacking object in + return ..() // Used by processor to relay qdel() to machinery type.