Skip to content

Commit

Permalink
Make Vendors Show Returns as Free (#373)
Browse files Browse the repository at this point in the history
  • Loading branch information
RimiNosha authored Nov 19, 2023
1 parent 138f46d commit 4188c09
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
1 change: 1 addition & 0 deletions code/modules/vending/_vending.dm
Original file line number Diff line number Diff line change
Expand Up @@ -951,6 +951,7 @@ GLOBAL_LIST_EMPTY(vending_products)
name = product_record.name,
amount = product_record.amount,
colorable = product_record.colorable,
free = !!product_record.returned_products,
)

.["stock"][product_record.name] = product_data
Expand Down
5 changes: 3 additions & 2 deletions tgui/packages/tgui/interfaces/Vending.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { classes } from 'common/react';
import { BooleanLike, classes } from 'common/react';
import { capitalizeAll } from 'common/string';
import { useBackend, useLocalState } from 'tgui/backend';
import { Box, Button, Icon, LabeledList, NoticeBox, Section, Stack, Table } from 'tgui/components';
Expand Down Expand Up @@ -51,6 +51,7 @@ type StockItem = {
name: string;
amount: number;
colorable: boolean;
free: BooleanLike;
};

type CustomInput = {
Expand Down Expand Up @@ -222,7 +223,7 @@ const VendingRow = (props, context) => {
const { data } = useBackend<VendingData>(context);
const { custom, product, productStock } = props;
const { access, department, jobDiscount, onstation, user } = data;
const free = !onstation || product.price === 0;
const free = !onstation || product.price === 0 || productStock.free;
const discount = !product.premium && department === user?.department;
const remaining = custom ? product.amount : productStock.amount;
const redPrice = Math.round(product.price * jobDiscount);
Expand Down

0 comments on commit 4188c09

Please sign in to comment.