Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Food Cart UI rework #22866

Open
wants to merge 39 commits into
base: master
Choose a base branch
from

Conversation

Scrambledeggs00
Copy link
Contributor

@Scrambledeggs00 Scrambledeggs00 commented Dec 20, 2024

Document the changes in your pull request

I've changed the food cart's UI from byond HTML into TGUI as it looks nicer. The new UI is broken up into two parts: food and drinks.

Food Tab

  • Food Capacity section shows the current amount of food and the total capacity of the cart, which is 80 food items.
  • Food Selection section shows the cart's food, with each food item showing an image, its name, quantity within the cart's storage, and a button for dispensing one.
  • Similar to the ice cream vat, the cart will dispense the last item of the dispensed type put into it.

Drink Tab

  • Glass Storage section shows the current amount of drinking glasses in storage, with carts starting with 10, and the total capacity, which is 30.
  • Drink Capacity section shows the current units of reagents stored in the cart along with the total reagent capacity of the cart, which is 200.
  • Transfer Amount section has a list of buttons that determines how many units are shifted between the different storages and how much are purged.
  • Cart Drink Storage is the main reagent storage. As previously stated, it has a max volume of 200u. Reagents within it can either be purged from the cart or transferred to the mixer based on the transfer amount selected.
  • Cart Mixer Storage is the storage used to dispense drinking glasses. It has a max volume of 50u, enough to fully fill a drinking glass. Reagents within can either be transferred back to the cart's main storage based on the transfer amount selected or all be poured into a drinking glass and dispensed to the user.
  • Both storages have the NO_REACT flag, meaning you cannot make mixed drinks within the cart. I did this so that drinks would mix upon being dispensed, which is pretty cool :]
  • I do not know how to prevent reagent containers from transferring, so the cart can actually hold 250u, 200u in main, and 50u in mixer.

The UI also has info tooltips to explain certain UI elements. Simply hover your mouse over the blue circles with a white i to see the tooltip.

Also, when destroyed, food carts will now spill their reagents. A chat warning will also be sent if either the main or mixer storages have reagents, alerting you of the spill.

Fixes #9310
Fixes #19427
Fixes #19482

P.S.
With the replacement of find_amount with datums, food items like parmesan which add and remove things from contents themselves do not work well with keeping count for UI items. Because of this, stuff like unmatured parmesan cheese will show however much you put into it even when some have matured and will only remove itself from the UI when no unmatured cheese is in the contents. For matured, it will only count the first one added and any you add with attackby, items created within the contents are not counted because I do not know how to do that without essentially just bringing back find_amount which would make the switch pointless.

Why is this good for the game?

Old UI looked bad, reagent part of carts haven't worked in awhile, and spills are funny :]

Testing

Video of cart UI:
https://www.youtube.com/watch?v=FjUYch4DA8A
Also: I changed the spill message to specify that reagents are spilling out after this video.

Wiki Documentation

Food capacity: 80
Glass capacity: 30
Drink capacity

  • Main: 200u
  • Mixer: 50u
  • Total: 250u

Reagents will spill if cart is destroyed.

Changelog

🆑
rscadd: Food carts now spill their reagents upon destruction
bugfix: Food carts can now handle reagents again
tweak: Reworked food cart's UI
/:cl:

@Yogbot-13 Yogbot-13 added Feature This adds new content to the game Fix This fixes an issue. Please link issues in fix PRs Tweak This PR contains changes to the game. labels Dec 20, 2024
@github-actions github-actions bot added the tgui This PR affects TGUI label Dec 20, 2024
Co-authored-by: Henry <omgredstone@gmail.com>
@Oblisk234
Copy link
Member

Does this fix #19482 at all?

@Scrambledeggs00
Copy link
Contributor Author

Does this fix #19482 at all?

I haven't tested it yet, though i would assume that it doesn't. I'll try to test it today.

@Scrambledeggs00
Copy link
Contributor Author

Does this fix #19482 at all?

I tested it and made the necessary changes to fix the bug. The fix should also work for any other food item that works similarly.

Copy link
Contributor

@ToasterBiome ToasterBiome left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

preliminary review

switch(action)
//Dispense food item
if("dispense")
var/itemPath = text2path(params["itemPath"])
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You need to verify that this input is correct, like that it is available in the cart and there's enough. You can pass arbitrary data to tgui and summon literally anything in the game since it's not verified.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the dispense_item proc that this calls DOES do verification (it checks that the item is in the contents - see the find_amount proc) as I did notice this on my pass. textrefs might be a better option as it'd avoid the whole "creating an item just to check if it exists" dance

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm guessing this is resolved then?

//Get content and capacity data
var/list/storageDetails = list()
//Have to subtract contents.len by 1 due to reagents container being in contents
storageDetails["contents_length"] = contents.len - 1
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is not the length of the contents 🤔

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How would I get it? Am I using the wrong proc?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Feature This adds new content to the game Fix This fixes an issue. Please link issues in fix PRs tgui This PR affects TGUI Tweak This PR contains changes to the game.
Projects
None yet
5 participants