diff --git a/code/modules/economy/pay_stand.dm b/code/modules/economy/pay_stand.dm index e703477ab3f2f8..550dce39232d64 100644 --- a/code/modules/economy/pay_stand.dm +++ b/code/modules/economy/pay_stand.dm @@ -5,46 +5,54 @@ icon_state = "card_scanner" density = TRUE anchored = TRUE - var/price = 0 + var/locked = FALSE var/obj/item/card/id/my_card + var/obj/item/assembly/signaler/signaler //attached signaler, let people attach signalers that get activated if the user's transaction limit is achieved. + var/signaler_threshold = 0 //signaler threshold amount + var/amount_deposited = 0 //keep track of the amount deposited over time so you can pay multiple times to reach the signaler threshold /obj/machinery/paystand/attackby(obj/item/W, mob/user, params) if(istype(W, /obj/item/card/id)) + if(W == my_card) + locked = !locked + to_chat(user, "You [src.locked ? "lock" : "unlock"] the bolts on the paystand.") + return if(!my_card) var/obj/item/card/id/assistant_mains_need_to_die = W if(assistant_mains_need_to_die.registered_account) var/msg = stripped_input(user, "Name of pay stand:", "Paystand Naming", "[user]'s Awesome Paystand") if(!msg) return - var/price2 = input(user, "Enter price.", "Paystand Pricing", 25) as num - if(!price2 || price2 < 0) - return - name = "[msg] ($[price2])" - desc = "Owned by [assistant_mains_need_to_die.registered_account.account_holder]. Pays directly into [user.p_their()] account when swiped with an ID card." - price = price2 + name = msg + desc = "Owned by [assistant_mains_need_to_die.registered_account.account_holder], pays directly into [user.p_their()] account." my_card = assistant_mains_need_to_die to_chat(user, "You link the stand to your account.") return var/obj/item/card/id/vbucks = W if(vbucks.registered_account) - if(vbucks.registered_account.adjust_money(-price)) - purchase(vbucks.registered_account.account_holder) + var/momsdebitcard = input(user, "How much would you like to deposit?", "Money Deposit") as null|num + if(momsdebitcard < 1) + to_chat(user, "ERROR: Invalid amount designated.") + return + if(vbucks.registered_account.adjust_money(-momsdebitcard)) + purchase(vbucks.registered_account.account_holder, momsdebitcard) to_chat(user, "Thanks for purchasing! The vendor has been informed.") return else - to_chat(user, "You trying to punk me, kid? Come back when you have the cash.") + to_chat(user, "ERROR: Account has insufficient funds to make transaction.") return else - to_chat(user, "You're going to need an actual bank account for that one, buddy.") + to_chat(user, "ERROR: No bank account assigned to identification card.") return if(istype(W, /obj/item/holochip)) var/obj/item/holochip/H = W - if(H.spend(price, FALSE)) - purchase(user) + var/cashmoney = input(user, "How much would you like to deposit?", "Money Deposit") as null|num + if(H.spend(cashmoney, FALSE)) + purchase(user, cashmoney) to_chat(user, "Thanks for purchasing! The vendor has been informed.") return else - to_chat(user, "You trying to punk me, kid? Come back when you have the cash.") + to_chat(user, "ERROR: Insufficient funds to make transaction.") return if(istype(W, /obj/item/stack/spacecash)) to_chat(user, "What is this, the 2000s? We only take card here.") @@ -52,7 +60,27 @@ if(istype(W, /obj/item/coin)) to_chat(user, "What is this, the 1800s? We only take card here.") return - + if(istype(W, /obj/item/assembly/signaler)) + if(signaler.secured) + to_chat(user, "The signaler needs to be in attachable mode to add it to the paystand!") + return + if(!my_card) + to_chat(user, "ERROR: No identification card has been assigned to this paystand yet!") + return + if(!signaler) + var/cash_limit = input(user, "Enter the minimum amount of cash needed to deposit before the signaler is activated.", "Signaler Activation Threshold") as null|num + if(cash_limit < 1) + to_chat(user, "ERROR: Invalid amount designated.") + return + if(cash_limit) + W.forceMove(src) + signaler = W + signaler_threshold = cash_limit + to_chat(user, "You attach the signaler to the paystand.") + desc += " A signaler appears to be attached to the scanner." + else + to_chat(user, "A signaler is already attached to this unit!") + if(default_deconstruction_screwdriver(user, "card_scanner", "card_scanner", W)) return @@ -67,7 +95,17 @@ else return ..() -/obj/machinery/paystand/proc/purchase(buyer) +/obj/machinery/paystand/proc/purchase(buyer, price) my_card.registered_account.adjust_money(price) my_card.registered_account.bank_card_talk("Purchase made at your vendor by [buyer] for [price] credits.") + amount_deposited = amount_deposited + price + if(signaler && amount_deposited >= signaler_threshold) + signaler.activate() + amount_deposited = 0 + +/obj/machinery/paystand/default_unfasten_wrench(mob/user, obj/item/I, time = 20) + if(locked) + to_chat(user, "The anchored bolts on this paystand are currently locked!") + return + . = ..() \ No newline at end of file