Skip to content

Commit

Permalink
вывыывы
Browse files Browse the repository at this point in the history
  • Loading branch information
Anorak2024 committed Sep 1, 2024
1 parent 9f382a2 commit 9acf0d0
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 11 deletions.
8 changes: 8 additions & 0 deletions code/game/machinery/customat.dm
Original file line number Diff line number Diff line change
Expand Up @@ -461,6 +461,14 @@
for (var/key in products)
var/datum/data/customat_product/product = products[key]
data["icons"][product.key] = product.icon
data["prices"] = list()
for (var/key in products)
var/datum/data/customat_product/product = products[key]
data["prices"][product.key] = product.price
data["names"] = list()
for (var/key in products)
var/datum/data/customat_product/product = products[key]
data["names"][product.key] = product.name
data["vend_ready"] = vend_ready
data["panel_open"] = panel_open ? TRUE : FALSE
data["speaker"] = shut_up ? FALSE : TRUE
Expand Down
23 changes: 13 additions & 10 deletions tgui/packages/tgui/interfaces/Customat.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,26 +5,26 @@ import { Window } from '../layouts';

const CustomatRow = (props, context) => {
const { act, data } = useBackend(context);
const { product, productStock, productImage } = props;
const { key, productStock, productImage, productPrice, productName } = props;
const {
user,
userMoney,
vend_ready,
} = data;
const free = product.price === 0;
const free = productPrice === 0;
let buttonText = 'ERROR!';
let rowIcon = '';
if (free) {
buttonText = 'FREE';
rowIcon = 'arrow-circle-down';
} else {
buttonText = product.price;
buttonText = productPrice;
rowIcon = 'shopping-cart';
}
let buttonDisabled =
!vend_ready ||
productStock === 0 ||
(!free && product.price > userMoney);
(!free && productPrice > userMoney);
return (
<Table.Row>
<Table.Cell collapsing>
Expand All @@ -38,7 +38,7 @@ const CustomatRow = (props, context) => {
}}
/>
</Table.Cell>
<Table.Cell bold>{product.name}</Table.Cell>
<Table.Cell bold>{productName}</Table.Cell>
<Table.Cell collapsing textAlign="center">
<Box
color={
Expand All @@ -58,7 +58,7 @@ const CustomatRow = (props, context) => {
textAlign="left"
onClick={() =>
act('vend', {
'key': product.key,
'key': key,
})
}
/>
Expand All @@ -77,6 +77,8 @@ export const Customat = (props, context) => {
user,
stock,
icons,
prices,
names,
vend_ready,
panel_open,
speaker,
Expand Down Expand Up @@ -112,10 +114,11 @@ export const Customat = (props, context) => {
<Table>
{inventory.map((product) => (
<CustomatRow
key={product.key}
product={product}
productStock={stock[product.key]}
productImage={icons[product.key]}
key={product}
productStock={stock[product]}
productImage={icons[product]}
productPrice={prices[product]}
productName={names[product]}
/>
))}
</Table>
Expand Down
2 changes: 1 addition & 1 deletion tgui/public/tgui.bundle.js

Large diffs are not rendered by default.

0 comments on commit 9acf0d0

Please sign in to comment.