-
Notifications
You must be signed in to change notification settings - Fork 77
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
Rewrite recipe chain calculator #530
base: master
Are you sure you want to change the base?
Conversation
bdf0c69
to
0146a73
Compare
Here you have crafting chain mode disabled. Did it use to do that on shift+ctrl+scroll?
It uses whatever recipe it encounters first. I should probably make it more consistent, because currently to the user it feels random because of hashmap. And maybe color conflicting recipe in gray or something. But functionally, I don't see a way to support multiple recipes that give the same output. If there is a recipe that you need pinned, but that you don't wanna use for some item, you can unpin output from that recipe.
If you unpin an ingredient from the recipe, then graph traversal won't continue, even if that recipe is pinned. For example, iron is not pinned in hopper recipe, so iron is not calculated.
Oops, forgot to filter by group id.
Cause currently it adds/removes 64 or whatever multiple you have set. But now that I think about it, forcing it to be a multiple would be nicer. Noted.
You mean it should treat cells as raw fluids? Makes sense, noted.
That is by design. It is a catalyst that is unused, but it is required for the craft. They were cancelling each other in first implementation, but after some playtesting I found out that it was not very helpful. In general, this tries to mimic the way AE2 autocrafting works. And that's how it would see it.
That's actually Lightly Steam-Cracked fuel in the remainders. Ethylene requires 19000L and cracking recipe will produce 19200. That is a problem I had with the tooltip, because you often can't tell what ingredient/results/remainders are shown, because a lot of them look very similar
You mean showing outputs+remainders as a stack size for outputs? Okay, previously I couldn't exactly figure out what that was.
Do you know where that is calculated? There is no reason it shouldn't work, other than explicitly checking for stack size to be greater than 0. |
Previously, the algorithm worked the same whether the chain was enabled or not
Here it would be correct to change the quantity on the recipe you are on.
How to reset group state? Why do you need a negative value in the final recipe?
yes, it will work fine before
This will mislead the player into crafting a catalyst in quantities he doesn't need. they are no different from a circuit in situations like this. The only thing you can do is to output it as an ingredient in the amount of one item. Otherwise the player will again have to filter out unnecessary things in tooltips/highlights
correctly: Ethylene requires 18800L and cracking recipe will produce 19000.
|
Notes to self, to not forget anything
|
4580ac0
to
ab18c57
Compare
This should be ready, but I haven't playtested much. For this reason, I'm gonna keep it in draft state for a bit. There is one known old bug, which is unrelated to the changes. You can't pin duping recipes (Null catalyst for example). But I would rather fix it in a new PR. |
is this the same bug causing issues with like for example multiple recipes using the same item? like tin & copper dust both using 3 xp buckets and therefore overwrite each other in bookmarks |
Which recipe is this exactly? There was a bug that caused multiple stacks of same item in output to override each other when pinning recipe instead of adding up like inputs (ctrl+shift+A on plus sign). That one is fixed. The one that prevents you from properly pinning a recipe that has same items in inputs and outputs is not fixed. PS. Regarding this PR in general. My attempt to remove common items from inputs and outputs (not remainders, those are fine) caused another bug, that prevents you from requesting i.e. 64 MV circuits and 64 HV circuits in one chain (64 MV circuits you requested will be consumed by 32 HV circuits). I could remove common items as a postprocessing step, but I would rather not. This would mean that whatever you requested will be shown in outputs exactly. This means that outputs and remainders will show how many items you will have in your inventory at the end, not how many you will gain. |
for example tin and copper dust both require 3 xp buckets in a crafting table, but if you try to bookmark both they'll overwrite each other. |
Ah, recipes override each other, not items, I see. Currently recipe is identified by its inputs (shapeless) and crafting handler. That is not getting changed here. |
Added items from this gui (it added like pseudo recipe)Highlight broken when chain on
And it sometimes crashes when i hover to result with shift:crash (reload don't help fix bug): https://mclo.gs/vQpnZBV
It is also inconvenient that the count is reset when the chain is turned onIt is also inconvenient that all chain react to shift regardless of the cursor positionIncorrect show chain remainders
If i added another recipe to chain, it incorrect calculate fluid. it use ingredient as result
Feedback from other user
ctrl+shift+a should be added only result under mouse, not all results. for all results exists
|
All of those were caused by the bug I described above in #530 (comment). Those should be fixed, but now outputs can never be used as ingredients, and fixing that is not worth it in my opinion, especially for something that is this minor and arguably is not even a bug.
Fixed
Couldn't reproduce adding the recipe, but I think it crashed because it couldn't find
I don't really understand this issue. It used to highlight the entire chain before this? The only difference is that now you don't need to hover over item, you can hover next to the group. And I don't see that as an issue.
Reasoning on how to do itNow, this is not trivial. Converting from crafting mode to regular mode is easy, but going backwards would require calculating however many items you need to request to best match counts of regular mode. And whatever I do, conversion from regular mode to crafting mode can't be lossless. I could request only roots of the chain, but that might be inconsistent if you change intermediaries (i.e. if you request both HV and EV circuits in one chain). That could be solved by topologically sorting the nodes, but......recursuive recipes. Topological sort does not work if graph has cycles, and a lot of recipes are recursive. If I were to just recalculate root recipes, that will also break for crystal chip recipe. There is actually no way to tell if you want chip parts or full chips. There is another way. I could keep conversion from crafting mode to regular mode, but completely abandon the reverse conversion, and instead modify requested items amount in normal mode too. As for adding new recipes to the group, my suggestion is to request Made an attempt at this. Here is how it works.
PS. I haven't had much free time for several weeks, so this is not playtested. PS2. Requesting cells from fluid canner recipes causes weird behavior, because that recipe is self-recursive. But that seems like a completely pointless action, so I don't think fixing it is worth it. |
6d29dae
to
eda5735
Compare
eda5735
to
97defd7
Compare
Rewrote recipe chain calculator. The main difference is that it now uses graph traversal to calculate things. Fixes GTNewHorizons/GT-New-Horizons-Modpack#17148
Notable features:
There are some differences in how it looks and feels. Here are new behaviors.
Modifying item counts
StackInfo::getFluidCellSize
), but could not find a better approach.Visual
+123
/-123
. This is not required to be a multiple of whatever the recipe output is. Previously it would just change number of items individually. This is also shown asX*64 + Y
on the tooltipx123
. Bottom right numbers show chain inputs and chain remainders/outputs. Background highlights behave the same way.Behavioral and implementation details.
BookmarkRecipeId
. I extract actual recipes at runtime.Some screenshots (some are not from GTNH, so textures might be different):
Old screenshots