Make the commissary register able to be filled out with paper forms (#21905)

The commissary register can now be filled out by unlocking it and using
a filled out piece of paper on it. This adds the listed items to the
things listed in it, making it quick to set up for operations crew
instead of manually typing it in every round.

---------

Signed-off-by: Casper3667 <8396443+Casper3667@users.noreply.github.com>
Co-authored-by: Cody Brittain <1779662+Generalcamo@users.noreply.github.com>
This commit is contained in:
Casper3667
2026-03-01 06:46:28 +00:00
committed by GitHub
co-authored by Cody Brittain
parent 0a28af6235
commit 3c63532ada
6 changed files with 143 additions and 22 deletions
+32 -9
View File
@@ -157,6 +157,7 @@
. += "Alt click with credits in hand, to deposit them."
. += "Alt click while having operations access, to withdraw credits from it."
. += "Items can be paid for with id cards, charge cards or physical credits, and a receipt will be printed."
. += "The register can print a paper which can be used to quickly fill it out in the future by using it on the register."
/obj/structure/cash_register/commissary/Initialize()
. = ..()
@@ -207,6 +208,9 @@
R.ripped = TRUE
/obj/structure/cash_register/commissary/attackby(obj/item/attacking_item, mob/user)
if(istype(attacking_item, /obj/item/paper))
read_paper_list(attacking_item, user)
return
if(sum == 0)
return
if (istype(attacking_item, /obj/item/spacecash/ewallet))
@@ -258,9 +262,9 @@
if(transaction)
to_chat(user, SPAN_NOTICE("[icon2html(src, user)]<span class='warning'>[transaction].</span>"))
else
playsound(src, 'sound/machines/chime.ogg', 50, 1)
visible_message(SPAN_NOTICE("[icon2html(src, viewers(get_turf(src)))] \The [src] chimes."))
visible_message("\The [user] swipes a card on \the [src]." )
audible_message(SPAN_NOTICE("[icon2html(src, viewers(get_turf(src)))] \The [src] chimes."))
playsound(src, 'sound/machines/chime.ogg', 50, 1)
print_receipt()
sum = 0
receipt = ""
@@ -278,8 +282,8 @@
E.worth -= transaction_amount
visible_message("\The [user] swipes a card on \the [src]." )
audible_message(SPAN_NOTICE("[icon2html(src, viewers(get_turf(src)))] \The [src] chimes."))
playsound(src, 'sound/machines/chime.ogg', 50, 1)
src.audible_message(SPAN_NOTICE("[icon2html(src, viewers(get_turf(src)))] \The [src] chimes."))
print_receipt()
sum = 0
receipt = ""
@@ -289,6 +293,18 @@
to_chat(user, SPAN_WARNING("[icon2html(src, user)]\The [E] doesn't have that much money!"))
return
/obj/structure/cash_register/commissary/proc/read_paper_list(obj/item/paper/R, mob/user)
if(!editmode)
balloon_alert(user, "device locked!")
return FALSE
var/result = read_paper_price_list(R)
for(var/item in result)
items += list(list("name" = item["name"], "price" = item["price"]))
items_to_price[item["name"]] += item["price"]
/obj/structure/cash_register/commissary/proc/print_price(mob/user)
return print_price_to_paper(shop_name, items, loc, user)
/obj/structure/cash_register/commissary/attack_hand(mob/living/user)
. = ..()
ui_interact(user)
@@ -319,7 +335,7 @@
switch(action)
if("add")
if(!editmode)
to_chat(usr, SPAN_WARNING("Device locked."))
balloon_alert(usr, "device locked!")
return FALSE
items += list(list("name" = new_item, "price" = new_price))
@@ -328,7 +344,7 @@
if("remove")
if(!editmode)
to_chat(usr, SPAN_NOTICE("Device locked."))
balloon_alert(usr, "device locked!")
return FALSE
var/index = 0
for(var/list/L in items)
@@ -390,7 +406,7 @@
if("locking")
if(editmode)
editmode = FALSE
to_chat(usr, SPAN_NOTICE("Device locked."))
balloon_alert(usr, "device locked!")
else
if(!editmode)
var/obj/item/card/id/I = usr.GetIdCard()
@@ -398,19 +414,26 @@
return
if(check_access(I))
editmode = !editmode
to_chat(usr, SPAN_NOTICE("Device [editmode ? "un" : ""]locked."))
balloon_alert(usr, "device [editmode ? "un" : ""]locked")
. = TRUE
if("accountselect")
if(!editmode)
to_chat(usr, SPAN_WARNING("Device locked."))
balloon_alert(usr, "device locked!")
return FALSE
var/dest = tgui_input_list(usr, "What account would you like to select?", "Destination Account", assoc_to_keys(SSeconomy.department_accounts))
if(!dest)
return FALSE
destinationact = dest
return TRUE
. = TRUE
if("print_dsv")
if(!editmode)
balloon_alert(usr, "device locked!")
return FALSE
print_price(usr)
. = TRUE
/obj/structure/cash_register/commissary/proc/clear_order()
buying.Cut()
+29 -7
View File
@@ -74,6 +74,9 @@
usr.put_in_any_hand_if_possible(R)
/obj/item/quikpay/attackby(obj/item/attacking_item, mob/user)
if(istype(attacking_item, /obj/item/paper))
read_paper_list(attacking_item, user)
return
if (istype(attacking_item, /obj/item/spacecash/ewallet))
var/obj/item/spacecash/ewallet/E = attacking_item
var/transaction_amount = sum
@@ -81,8 +84,8 @@
var/transaction_terminal = machine_id
if(transaction_amount <= E.worth)
audible_message(SPAN_NOTICE("[icon2html(src, viewers(get_turf(src)))] \The [src] chimes."))
playsound(src, 'sound/machines/chime.ogg', 50, 1)
src.visible_message(SPAN_NOTICE("[icon2html(src, viewers(get_turf(src)))] \The [src] chimes."))
SSeconomy.charge_to_account(SSeconomy.get_department_account(destinationact)?.account_number, E.owner_name, transaction_purpose, transaction_terminal, transaction_amount)
E.worth -= transaction_amount
@@ -107,13 +110,25 @@
if(transaction)
to_chat(user, SPAN_NOTICE("[icon2html(src, user)]<span class='warning'>[transaction].</span>"))
else
audible_message(SPAN_NOTICE("[icon2html(src, viewers(get_turf(src)))] \The [src] chimes."))
playsound(src, 'sound/machines/chime.ogg', 50, 1)
visible_message(SPAN_NOTICE("[icon2html(src, viewers(get_turf(src)))] \The [src] chimes."))
print_receipt()
sum = 0
receipt = ""
to_chat(user, SPAN_NOTICE("Transaction completed, please return to the home screen."))
/obj/item/quikpay/proc/read_paper_list(obj/item/paper/R, mob/user)
if(!editmode)
balloon_alert(user, "device locked!")
return FALSE
var/result = read_paper_price_list(R)
for(var/item in result)
items += list(list("name" = item["name"], "price" = item["price"]))
items_to_price[item["name"]] += item["price"]
/obj/item/quikpay/proc/print_price(mob/user)
return print_price_to_paper(shop_name, items, loc, user)
/obj/item/quikpay/attack_self(var/mob/user)
ui_interact(user)
@@ -144,7 +159,7 @@
switch(action)
if("add")
if(!editmode)
to_chat(usr, SPAN_WARNING("Device locked."))
balloon_alert(usr, "device locked!")
return FALSE
items += list(list("name" = new_item, "price" = new_price))
@@ -153,7 +168,7 @@
if("remove")
if(!editmode)
to_chat(usr, SPAN_NOTICE("Device locked."))
balloon_alert(usr, "device locked!")
return FALSE
var/index = 0
for(var/list/L in items)
@@ -215,7 +230,7 @@
if("locking")
if(editmode)
editmode = FALSE
to_chat(usr, SPAN_NOTICE("Device locked."))
balloon_alert(usr, "device locked!")
else
if(!editmode)
var/obj/item/card/id/I = usr.GetIdCard()
@@ -228,14 +243,21 @@
if("accountselect")
if(!editmode)
to_chat(usr, SPAN_WARNING("Device locked."))
balloon_alert(usr, "device locked!")
return FALSE
var/dest = tgui_input_list(usr, "What account would you like to select?", "Destination Account", assoc_to_keys(SSeconomy.department_accounts))
if(!dest)
return FALSE
destinationact = dest
return TRUE
. = TRUE
if("print_dsv")
if(!editmode)
balloon_alert(usr, "device locked!")
return FALSE
print_price(usr)
. = TRUE
/obj/item/quikpay/proc/clear_order()
buying.Cut()