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

Appliance update. Extend crafting_pseudo_item. JSONize freezers and fridges. Update Freezers/Fridges to use iexamine::transform #2172

Merged
merged 28 commits into from
Nov 27, 2022

Conversation

KheirFerrum
Copy link
Collaborator

@KheirFerrum KheirFerrum commented Nov 7, 2022

Summary

SUMMARY: Infrastructure "Appliance update. Extend crafting_pseudo_item. JSONize freezers and fridges. Update Freezers/Fridges to use iexamine::transform"

Purpose of change

FOODCO kitchen buddy cannot be installed as furniture; grid welder and soldering iron are separate due to function limitations; there's no damn full size freezer or refrigerated tanks for the grid.

Describe the solution

To make all of these a reality.

  • Allow crafting_pseudo_item to be either an array or an object. Update all the relevant code including ACT_REPAIR group, reload_furniture, use_furn_fake_item, form_from_map and all the other fun functions...
  • JSONize fridges and freezers by having the function check the furniture for FRIDGE/FREEZER flag, changing temperature appropriately.
  • Copy and edit a lot of JSON.
  • Update iexamine::transform so that you can choose to either pick up items or transform furniture, preventing automatic transformation of furniture if you happen to be using examine instead of get.
  • Update fridges/freezers to use iexamine::transform and deprecate toggle refrigerator/freezer construction group.

Work still to be done

  • Add full size freezers, flavoured as industrial freezers for restaurants and shopping centres, and add them to appropriate places.
  • Glass fridges and freezers work and can be taken down to move to another location, added them to locations as appropriate.
  • Add glass fridge and freezer recipes.
  • Add refrigerated tanks. Bunch of issues that should be fixed in a separate PR before this is a good idea. See Additional Content for more info.

Describe alternatives you've considered

  • Make new freezers and have the cpp continue to check for furniture id.
    Discarded, it's easier for me to make it a flag and makes it easier to add more furniture of the same type.
  • Extend the sub field instead so a single item can substitute for many items.
    Potentially disastrous, hacky as fuck, discarded.

Testing

  • Spawn 3 cooked fish and store in fridge, mini-freezer and on the floor, wait about 1 day and check relative rot progression of each.
  • Check that FOODCO kitchen buddy can be used via grid from crafting menu and that charges are consumed appropriately.
  • Check that welder and soldering iron once placed together can be used appropriately and consume appropriate charges.
  • Check that freezers can be constructed, deconstructed, crafted, taken apart and toggled without turning into fridges.

Additional context

While working on this I considered removing the USES_GRID_POWER flag from being needed, having it implicit for any battery powered appliance wired into the grid. It was suggested by @Coolthulhu that this might lead to unintended behaviour in the future, so for now that idea is tabled.

Fridge tanks as an appliance were not added for a few reasons.

  • Fridge tanks and tanks in general don't tell you how long it will take until the drink inside spoils. Ideally I'd want the examine action to pull up the item info panel on the left like when viewing your inventory but I do not understand how to do this.
  • Worst rot is applied to everything in the tank, so you have to empty it before you can add stuff to it if you want the stuff to last a proper length of time. Since each tank is 60L... that's not a workable solution.
  • Anytime the fridge tank changes from one version to another it dumps the liquids inside it to another tile, this is really bad since the fluid then becomes dirty and can no longer be used or picked up.

Updates all relevant functions that depend on it.

Adds FOODCO kitchen buddy to construction list.

Gives vehicle welding rig construction a soldering iron to go with the welder.
@KheirFerrum KheirFerrum marked this pull request as draft November 7, 2022 07:36
@github-actions github-actions bot added JSON related to game datas in JSON format. src changes related to source code. labels Nov 7, 2022
@github-actions github-actions bot added the mods PR changes related to mods. label Nov 7, 2022
@github-actions github-actions bot removed the mods PR changes related to mods. label Nov 7, 2022
The future shall belong to the cockroaches.
I think this is what Clang wants from me?
Add documentation for flags and expansion of crafting_pseudo_items.
@KheirFerrum KheirFerrum marked this pull request as ready for review November 11, 2022 06:13
@chaosvolt
Copy link
Member

Side notes:

  1. If Grid constructions now use workshop category #2155 is merged, the norm for grid constructions will be to use the WORKSHOP category instead of being split between the FURN and OTHER categories.
  2. We have support for transforming furniture (Adds new examine actions: notify and transform. #716), why is that not being used here? Having to toggle them via construction seems a touch hacky.

@KheirFerrum
Copy link
Collaborator Author

KheirFerrum commented Nov 14, 2022

Side notes:

  1. If Grid constructions now use workshop category #2155 is merged, the norm for grid constructions will be to use the WORKSHOP category instead of being split between the FURN and OTHER categories.
  2. We have support for transforming furniture (Adds new examine actions: notify and transform. #716), why is that not being used here? Having to toggle them via construction seems a touch hacky.
  1. When it's merged ping me on the Discord and I'll hop to it.
  2. I didn't think of it cause the fridges have been using that method all this time. it would certainly make my life a lot easier to convert them. See below.

Edit:
Lamps are also not in furniture-appliance.json but for whatever reason in furniture-zztesting.json and a duplicate, non-transforming lamp is defined in furniture-decorative.json. Some cleanup is probably in order.

Edit2:
I realized the main issue now. Food is contained inside the fridge and freezer, most players are conditioned to (e)xamine to pick things up. So they will inadvertently turn it off unless there's a prompt, and prompts can get very annoying.

Updated iexamine transform to use similar structure as iexamine fireplace.
@KheirFerrum KheirFerrum changed the title Appliance update: Extend crafting_pseudo_item. JSONize freezers and fridges. Appliance update. Extend crafting_pseudo_item. JSONize freezers and fridges. Update Freezers/Fridges to use `iexamine::transform Nov 14, 2022
@KheirFerrum KheirFerrum changed the title Appliance update. Extend crafting_pseudo_item. JSONize freezers and fridges. Update Freezers/Fridges to use `iexamine::transform Appliance update. Extend crafting_pseudo_item. JSONize freezers and fridges. Update Freezers/Fridges to use iexamine::transform Nov 14, 2022
@Coolthulhu Coolthulhu self-assigned this Nov 15, 2022
With a JSON example in the welding rig
There's no reason to initialise an entirely new variable.
Vehicle parts have a separate enabled variable to decide if it's on or not, we don't have that for furniture, so FRIDGE and FREEZER flags can only be put on the active versions of said furniture.
Abstract furniture description updated to reflect abstract status.
@Coolthulhu Coolthulhu merged commit 66a2164 into cataclysmbnteam:upload Nov 27, 2022
@Coolthulhu
Copy link
Member

Had to test freezers specifically. Looks like they do preserve things 100%, as expected.

Didn't think about balance at the time. But it certainly could use rebalancing: freezer is just the tiniest bit more expensive than fridge, but vastly more useful. Should be at least 3x as expensive.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
JSON related to game datas in JSON format. src changes related to source code.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants