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

Add ability to debug-spawn all requirements for a craft #60417

Conversation

ZeroInternalReflection
Copy link
Contributor

@ZeroInternalReflection ZeroInternalReflection commented Aug 24, 2022

Summary

None

Purpose of change

Spawning items to test crafting/vehicles/basecamps/construction is annoying and time-consuming.
Fixes #60094

Describe the solution

  1. Add a debug mutation (currently "Hammerspace Light") that enables a debug action in the crafting menu
  2. Upon using the debug action, have an opportunity to enter a random seed for the items (For instance, if you encountered a combination that didn't work and you need to retest, it's a lot easier to note that number than to recreate every item by hand)
  3. For each quality requirement, tool, and component of the selected recipe, generate a list of possible options and randomly select one (this currently ignores your current crafting inventory)
  4. Attempt to create 'real', spawnable items first. If no items are available, pseudo items (such as vehicle parts/appliances) are created, with a warning to the user
  5. Spawn the items and note what was spawned in the log. If no spawnable item meets the requirement, note that too.

Now, when you need to test crafting a complicated recipe, you can do it all at once:

Hammerspace_light--Nodachi.mp4

You can also spawn the tools and materials you need for construction:

Hammerspace_light--Construction--Fill_shallow_pit.mp4

You can spawn what you need to test basecamp upgrades (note: you do need to be standing in a basecamp storage zone)

Hammerspace_light--Basecamp--Upgrades.mp4

If you want to test basecamp crafting by batch crafting 150 pointy sticks, you can:

Hammerspace_light--Basecamp--BatchCrafting.mp4

If you want to test a vehicle, but don't have all of the parts handy, you can spawn everything you need to install a part:

Hammerspace_light--Vehicle--Part_installation.mp4

Or to repair a part:

Hammerspace_light--Vehicle--Part_repair.mp4

Ongoing tasks (in-progress update 2024-02-12):

  • Expand this option to:
  • Crafting menu
  • Construction menu
  • Basecamp menu (upgrades)
  • Basecamp menu (crafting)
  • Vehicle part repair
  • Vehicle part installation
  • Streamline/optimize the item spawning process, particularly:
  • Liquids/gases that do not have a default container
  • Providing charges/ammunition for tools
  • Spawning appliances/furniture where required
  • Intelligently spawning appliances/furniture
  • Checking for qualities (currently the only way I've found that works is to create every possible item and check if it has the quality. This is... not ideal) Quality cache appears to be working
  • Handling of lifting vs. strength requirements in vehicle crafting
  • Spawning very large items (e.g. spawning 350 soil to fill a pit currently fails silently)
  • Ensure all items defined in the json that are pseudo items are actually flagged as pseudo items (many are not, and thus you did not get a warning when you spawned a basecamp forge)
  • Tweak chip-frying recipes so I don't need a special case to prevent this (which should absolutely be craftable, but isn't):
    Screenshot from 2022-08-21 18-53-46
  • Improving test performance (testing all 9000+ recipes once each takes about 60 seconds)
  • Split any json item/recipe changes into new PRs
  • Unit testing construction spawning
  • Unit testing vehicle part install spawning
  • Unit testing vehicle part repair spawning

Describe alternatives you've considered

  1. Whether "Hammerspace light" is merged into/replaces Hammerspace, I leave to others
  2. Having the option to specify the random seed was key to my debugging of this feature, so I'm strongly in favour of leaving that in
  3. It might be worthwhile to have pseudo item spawning as an option (i.e. prevent spawning pseudo items in certain circumstances), but I'm not sure of the best way to fit that into the UI
  4. It might be worthwhile for "Hammerspace light" to also provide a significant boost to crafting speed to check the actual crafting process
  5. Currently, it tries to spawn exactly what is required for the recipe. So if you need 1 water, it will spawn a half-full bottle of water. This isn't necessarily ideal (particularly for liquids without a default container. It spawns a 200L drum for 1 permanent ink)
  6. Currently, it ignores your crafting inventory. I think that for testing purposes, this makes sense, since if you want to test something that didn't work, you don't want it to not spawn an item just because you have one of the components in your inventory

Testing

  • Added a test that checks whether it produces usable results for every recipe that the user can learn
  • This test takes about 90 seconds on my machine, so some optimizing/flagging as [slow] would probably be worthwhile
  • Manually tested batch production, though potentially an automated test could be added to test batch capabilities

Additional context

Strictly speaking, I don't think this falls under the "Feature" changelog entry, so "None" it is.

@github-actions github-actions bot added [C++] Changes (can be) made in C++. Previously named `Code` [JSON] Changes (can be) made in JSON Code: Tests Measurement, self-control, statistics, balancing. Info / User Interface Game - player communication, menus, etc. json-styled JSON lint passed, label assigned by github actions labels Aug 24, 2022
@github-actions
Copy link
Contributor

Spell checker encountered unrecognized words in the in-game text added in this pull request. See below for details.

Click to expand
  • Use hammerspace

This alert is automatically generated. You can simply disregard if this is inaccurate, or (optionally) you can also add the new words to tools/spell_checker/dictionary.txt so they will not trigger an alert next time.

@github-actions github-actions bot added astyled astyled PR, label is assigned by github actions BasicBuildPassed This PR builds correctly, label assigned by github actions labels Aug 24, 2022
@anothersimulacrum
Copy link
Member

anothersimulacrum commented Aug 27, 2022

Strictly speaking, I don't think this falls under the "Feature" changelog entry, so "None" it is.

It's a feature, just a debug one, so it wouldn't be going in the changelog anyways. None is very appropriate.

@github-actions github-actions bot added <Bugfix> This is a fix for a bug (or closes open issue) and removed BasicBuildPassed This PR builds correctly, label assigned by github actions labels Sep 3, 2022
@github-actions github-actions bot added Missions Quests and missions BasicBuildPassed This PR builds correctly, label assigned by github actions labels Sep 9, 2022
@github-actions github-actions bot added Vehicles Vehicles, parts, mechanics & interactions Items: Food / Vitamins Comestibles and drinks Crafting / Construction / Recipes Includes: Uncrafting / Disassembling Mutations / Traits / Professions/ Hobbies Mutations / Traits / Professions/ Hobbies Fields / Furniture / Terrain / Traps Objects that are part of the map or its features. Player Faction Base / Camp All about the player faction base/camp/site Appliance/Power Grid Anything to do with appliances and power grid and removed BasicBuildPassed This PR builds correctly, label assigned by github actions labels Feb 13, 2024
@Night-Pryanik
Copy link
Contributor

Closing as stale. If you wish to continue working on this, ping me to reopen.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Appliance/Power Grid Anything to do with appliances and power grid astyled astyled PR, label is assigned by github actions <Bugfix> This is a fix for a bug (or closes open issue) [C++] Changes (can be) made in C++. Previously named `Code` Code: Tests Measurement, self-control, statistics, balancing. Crafting / Construction / Recipes Includes: Uncrafting / Disassembling Fields / Furniture / Terrain / Traps Objects that are part of the map or its features. Info / User Interface Game - player communication, menus, etc. Items: Food / Vitamins Comestibles and drinks [JSON] Changes (can be) made in JSON json-styled JSON lint passed, label assigned by github actions Missions Quests and missions Mutations / Traits / Professions/ Hobbies Mutations / Traits / Professions/ Hobbies Player Faction Base / Camp All about the player faction base/camp/site Vehicles Vehicles, parts, mechanics & interactions
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Debug tool: spawn requirements and craft
3 participants