diff --git a/code/game/objects/structures/displaycase.dm b/code/game/objects/structures/displaycase.dm
index 47c08123618..b4eb488adf0 100644
--- a/code/game/objects/structures/displaycase.dm
+++ b/code/game/objects/structures/displaycase.dm
@@ -367,7 +367,7 @@
name = "vend-a-tray"
icon = 'icons/obj/stationobjs.dmi'
icon_state = "laserbox0"
- desc = "A display case with an ID-card swipe, to purchase the contents. Ctrl-Click to purchase the contained item."
+ desc = "A display case with an ID-card swiper. Use your ID to purchase the contents."
density = FALSE
max_integrity = 100
req_access = list(ACCESS_KITCHEN)
@@ -396,28 +396,55 @@
/obj/structure/displaycase/forsale/attackby(obj/item/I, mob/living/user, params)
if(istype(I, /obj/item/card/id))
+ //Card Registration
var/obj/item/card/id/potential_acc = I
+ if(!potential_acc.registered_account)
+ to_chat(user, "This ID card has no account registered!")
+ return
+ if(payments_acc != potential_acc.registered_account && payments_acc)
+ to_chat(user, "This Vend-a-tray is already registered!")
+ return
if(!payments_acc && potential_acc.registered_account)
payments_acc = potential_acc.registered_account
playsound(src, 'sound/machines/click.ogg', 20, TRUE)
- to_chat(user, "Vend-a-tray registered. Use a PDA with your ID inside to change the sale price.")
- else if(!potential_acc.registered_account)
- to_chat(user, "This ID card has no account registered!")
+ to_chat(user, "Vend-a-tray registered. Use your ID on grab intent to change the sale price, or disarm intent to open the tray.")
return
- else if(payments_acc != potential_acc.registered_account)
- to_chat(user, "This Vend-a-tray is already registered!")
- return
- if(istype(I, /obj/item/pda))
- var/obj/item/pda/pda = I
- if(pda.id.registered_account != payments_acc)
- to_chat(user, "You don't own [src].")
- return
- var/new_price = input("Set the sale price for this vend-a-tray.","new price") as num|null
- if(!new_price || (get_dist(src,user) > 1))
- return
- sale_price = CLAMP(round(new_price, 1), 10, 1000)
- to_chat(user, "The cost is now set to [sale_price].")
- return 1
+ //Buying the contained item with the ID.
+ if(user.a_intent == INTENT_HELP)
+ if(!showpiece)
+ to_chat(user, "There's nothing for sale.")
+ return 1
+ if(broken)
+ to_chat(user, "[src] appears to be broken.")
+ return 1
+ var/confirm = alert(user, "Purchase [showpiece] for [sale_price]?", "Purchase?", "Confirm", "Cancel")
+ if(confirm == "Cancel")
+ return 1
+ var/datum/bank_account/account = potential_acc.registered_account
+ if(!account.has_money(sale_price))
+ to_chat(user, "You do not possess the funds to purchase this.")
+ return 1
+ else
+ account.adjust_money(-sale_price)
+ if(payments_acc)
+ payments_acc.adjust_money(sale_price)
+ user.put_in_hands(showpiece)
+ to_chat(user, "You purchase [showpiece] for [sale_price] credits.")
+ playsound(src, 'sound/effects/cashregister.ogg', 40, TRUE)
+ icon = 'icons/obj/stationobjs.dmi'
+ flick("laserbox_vend", src)
+ showpiece = null
+ update_icon()
+ return 1
+ //Setting the object's price.
+ if(user.a_intent == INTENT_GRAB)
+ var/new_price_input = input(user,"Set the sale price for this vend-a-tray.","new price",0) as num|null
+ if(isnull(new_price_input) || !user.canUseTopic(src, BE_CLOSE, FALSE, NO_TK))
+ return
+ new_price_input = CLAMP(round(new_price_input, 1), 10, 1000)
+ sale_price = new_price_input
+ to_chat(user, "The cost is now set to [sale_price].")
+ return 1
if(I.tool_behaviour == TOOL_WRENCH && open && user.a_intent == INTENT_HELP )
if(anchored)
to_chat(user, "You start unsecuring [src]...")
@@ -435,6 +462,8 @@
else if(I.tool_behaviour == TOOL_WRENCH && !open && user.a_intent == INTENT_HELP)
to_chat(user, "[src] must be open to move it.")
return
+ if(istype(I, /obj/item/pda))
+ return 1
. = ..()
/obj/structure/displaycase/forsale/multitool_act(mob/living/user, obj/item/I)
@@ -460,37 +489,6 @@
if(broken)
. += "[src] is sparking and the hover field generator seems to be overloaded. Use a multitool to fix it."
-/obj/structure/displaycase/forsale/CtrlClick(mob/user)
- if(ishuman(user))
- var/mob/living/carbon/human/customer = user
- if(!showpiece)
- to_chat(user, "There's nothing for sale.")
- return
- if(broken)
- to_chat(user, "[src] appears to be broken.")
- return
- if(customer.get_idcard(TRUE))
- var/obj/item/card/id/C = customer.get_idcard(TRUE)
- var/confirm = alert(user, "Purchase [showpiece] for [sale_price]?", "Purchase?", "Confirm", "Cancel")
- if(confirm == "Cancel")
- return
- if(C.registered_account)
- var/datum/bank_account/account = C.registered_account
- if(!account.has_money(sale_price))
- to_chat(user, "You do not possess the funds to purchase this.")
- return
- else
- account.adjust_money(-sale_price)
- if(payments_acc)
- payments_acc.adjust_money(sale_price)
- customer.put_in_hands(showpiece)
- to_chat(user, "You purchase [showpiece] for [sale_price] credits.")
- playsound(src, 'sound/effects/cashregister.ogg', 40, TRUE)
- icon = 'icons/obj/stationobjs.dmi'
- flick("laserbox_vend", src)
- showpiece = null
- update_icon()
-
/obj/structure/displaycase/forsale/obj_break(damage_flag)
if(!broken && !(flags_1 & NODECONSTRUCT_1))
broken = TRUE