Skip to content
This repository was archived by the owner on May 22, 2025. It is now read-only.

Commit 5cdd029

Browse files
Added drink capacity element to UI
1 parent 83e69f8 commit 5cdd029

File tree

2 files changed

+37
-4
lines changed

2 files changed

+37
-4
lines changed

code/modules/food_and_drinks/kitchen_machinery/food_cart_TGUI.dm

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
//Max amount of items that can be in the cart's contents list
1010
var/contents_capacity = 80
1111
//How many drinking glasses the cart has
12-
var/glass_quantity = 0
12+
var/glass_quantity = 10
1313
//Max amount of drink glasses the cart can have
1414
var/glass_capacity = 30
1515
//Max amount of reagents that can be in cart's mixer
@@ -90,6 +90,9 @@
9090
data["storage_capacity"] = contents_capacity
9191
data["glass_quantity"] = glass_quantity
9292
data["glass_capacity"] = glass_capacity
93+
//Add the total_volumne of both cart and mixer storage for quantity
94+
data["drink_quantity"] = mixer.reagents.total_volume + reagents.total_volume
95+
data["drink_capacity"] = reagent_capacity
9396

9497
//Send stored information to UI
9598
return data

tgui/packages/tgui/interfaces/FoodCart.tsx

Lines changed: 33 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,8 @@ type StorageStats = {
4444
storage_capacity: number;
4545
glass_quantity: number;
4646
glass_capacity: number;
47+
drink_quantity: number;
48+
drink_capacity: number;
4749
}
4850

4951
export const FoodCart = (props, context) => {
@@ -216,6 +218,13 @@ const DrinkTab = (props, context) => {
216218
<GlassRow />
217219
</Section>
218220
</Stack.Item>
221+
<Stack.Item>
222+
<Section
223+
title="Drink Capacity"
224+
textAlign="center">
225+
<DrinkCapacityRow />
226+
</Section>
227+
</Stack.Item>
219228
<Stack.Item>
220229
<Section
221230
title="Cart Drink Storage"
@@ -248,17 +257,37 @@ const GlassRow = (props, context) => {
248257
fontSize="14px"
249258
textAlign="center"
250259
bold>
251-
{/* Show the vat's current contents and its max contents */}
252260
{glass_quantity}/{glass_capacity}
253261
</Table.Cell>
254262
</Table.Row>
255263
</Table>
256264
);
257265
};
258266

267+
const DrinkCapacityRow = (props, context) => {
268+
// Get data from ui_data in backend code
269+
const { data } = useBackend<StorageStats>(context);
270+
// Get needed variables from StorageStats
271+
const { drink_quantity } = data;
272+
const { drink_capacity } = data;
273+
274+
return (
275+
<Table>
276+
<Table.Row>
277+
<Table.Cell
278+
fontSize="14px"
279+
textAlign="center"
280+
bold>
281+
{drink_quantity}/{drink_capacity}
282+
</Table.Cell>
283+
</Table.Row>
284+
</Table>
285+
);
286+
}
287+
259288
const MainDrinkRow = (props, context) => {
260289
// Get data from ui_data in backend code
261-
const { act, data } = useBackend<Tab>(context);
290+
const { act, data } = useBackend<Tab>(context);
262291
// Get drink information for cart's container from data
263292
const { mainDrinks = [] } = data;
264293

@@ -287,6 +316,7 @@ const MainDrinkRow = (props, context) => {
287316
{/* Remove from cart storage */}
288317
<Button
289318
fluid
319+
color="red"
290320
content="Purge"
291321
textAlign="center"
292322
fontSize="16px"
@@ -338,7 +368,7 @@ const MainDrinkRow = (props, context) => {
338368

339369
const MixerDrinkRow = (props, context) => {
340370
// Get data from ui_data in backend code
341-
const { act, data } = useBackend<Tab>(context);
371+
const { act, data } = useBackend<Tab>(context);
342372
// Get drink information for cart's container from data
343373
const { mixerDrinks = [] } = data;
344374

0 commit comments

Comments
 (0)