diff --git a/code/game/machinery/customat.dm b/code/game/machinery/customat.dm index b2066bace30..c891dda196e 100644 --- a/code/game/machinery/customat.dm +++ b/code/game/machinery/customat.dm @@ -471,18 +471,6 @@ /obj/machinery/customat/ui_static_data(mob/user) var/list/data = list() - data["products"] = list() - var/i = 1 - for (var/datum/data/customat_product/product in products) - var/list/data_pr = list( - key = product.key, - name = product.name, - amount = product.amount, - is_hidden = FALSE, - inum = i - ) - data["products"] += list(data_pr) - i++ return data /obj/machinery/customat/ui_act(action, params) @@ -504,12 +492,8 @@ if(panel_open) to_chat(usr, span_warning("The vending machine cannot dispense products while its service panel is open!")) return - var/key = text2num(params["inum"]) - var/list/display_records = products - if(key < 1 || key > length(display_records)) - to_chat(usr, span_warning("ERROR: invalid inum passed to vendor. Report this bug.")) - return - var/datum/data/customat_product/product = display_records[key] + var/key = text2num(params["key"]) + var/datum/data/customat_product/product = products[key] if(!istype(product)) to_chat(usr, span_warning("ERROR: unknown vending_product record. Report this bug.")) return diff --git a/tgui/packages/tgui/interfaces/Customat.js b/tgui/packages/tgui/interfaces/Customat.js index 1096bc0f7ee..e45392a9606 100644 --- a/tgui/packages/tgui/interfaces/Customat.js +++ b/tgui/packages/tgui/interfaces/Customat.js @@ -3,17 +3,15 @@ import { useBackend } from '../backend'; import { Box, Button, Section, Stack, Table } from '../components'; import { Window } from '../layouts'; -const VendingRow = (props, context) => { +const CustomatRow = (props, context) => { const { act, data } = useBackend(context); const { product, productStock, productImage } = props; const { - chargesMoney, user, userMoney, vend_ready, - inserted_item_name, } = data; - const free = !chargesMoney || product.price === 0; + const free = product.price === 0; let buttonText = 'ERROR!'; let rowIcon = ''; if (free) { @@ -60,7 +58,7 @@ const VendingRow = (props, context) => { textAlign="left" onClick={() => act('vend', { - 'inum': product.inum, + 'key': product.key, }) } /> @@ -69,18 +67,17 @@ const VendingRow = (props, context) => { ); }; + export const Customat = (props, context) => { const { act, data } = useBackend(context); const { - user, guestNotice, userMoney, - chargesMoney, products = [], + user, stock, icons, vend_ready, - inserted_item_name, panel_open, speaker, } = data; @@ -98,34 +95,6 @@ export const Customat = (props, context) => { - {!!chargesMoney && ( -
- {(user && ( - - Welcome, {user.name},{' '} - {user.job || 'Unemployed'} - ! -
- Your balance is {userMoney} credits. -
- )) || {guestNotice}} -
- )} - {!!inserted_item_name && ( -
act('eject_item', {})} - /> - } - > - {inserted_item_name} -
- )} {!!panel_open && (