Added support for recipes with the same item in core and injectors - #2
Added support for recipes with the same item in core and injectors#2mateuszdevs wants to merge 7 commits into
Conversation
Fixed crafting for recipes with the same core and injector item
Changed recipe structure to work with new crafting code
Added Chaotic core recipe
fixed example recipe format
remove comma
|
Thank you for your contribution, I like it very much 😄 I just found a little error, but that should be quickly resolved. I'll merge your pull request as soon as it's fixed. 👍 |
|
Also I like the checkboxes in the README, great addition 😉 |
Co-authored-by: Michael Sedlak <[email protected]>
no worries 😄
Yeah just realised that, i noticed when i was testing in my world and updated the script on there, but forgot to put that up, my bad 😅 |
|
Sorry to intrude on the PR, but I have just last night made an almost identical change with one major difference. This change here takes the core item out of the input list, meaning that if you put everything but the core item into the input chest, the program will attempt to craft the recipe, but never be able to... probably a mute point, but as I also have a fix for the item metadata to enable the Reactor Stabilizer crafting and similar, I would like to know how you would prefer I submit the changes...
|
You have a good point there, this needs to be fixed. Adding an additional check to the
Wow that's great! 👍 |
|
My solution to the Same items in core and injectors is to, like KasKatto, add the quantity into the core bit of the recipe entry in config, for example Then in craft, transfer the core item over first, and the rest later This snippet also includes my changes to display a friendly name instead of the fully qualified name |
|
Yeah it's pretty similar to KasKatto's solution, but if in the config there were two or more items in the core then there's a possibility for the program to crash, because it tries to transfer the items twice. You could add a check in the beginning to ensure there is always only one item in the core, but I think we just keep KasKatto's solution and add a check to the local function canCraft(recipe)
-- Check for injector items
for id, neededAmount in pairs(recipe.input) do
local availableAmount = getItemAmount(id, input)
if availableAmount < neededAmount then
return false
end
end
-- Check for core items (new)
for id, neededAmount in pairs(recipe.core) do
local availableAmount = getItemAmount(id, input)
if availableAmount < neededAmount then
return false
end
end
return true
endAnd the rest (friendly names, metadata fix) we just make a new PR and merge these changes from there. |
Added support for recipes that have the same item in core and injectors
Added the chaotic core recipe as well in new format, however not sure if the recipe is correct since i dont play atm3 - assumed to be standard DE hardmode recipe