[MOD] Smart Crafter


#166

bug with MBS Training (steam mod)
with the three objects made by the herbalist when using the maintain function.

bug report ingame (try maintain craft “berry juice” item)

release-899 (x64)[M]
smart_crafter/lib/util.lua:5: stack overflow
stack traceback:
	[C]: in function 'type'
	smart_crafter/lib/util.lua:5: in function 'deep_compare'
	...rafter/services/server/crafter_info/material_map.lua:56: in function 'contains'
	...rafter/services/server/crafter_info/material_map.lua:42: in function <...rafter/services/server/crafter_info/material_map.lua:33>
	(tail call): ?
	smart_crafter/smart_craft_order_list.lua:208: in function '_sc_get_recipe_cost'
	smart_crafter/smart_craft_order_list.lua:186: in function '_sc_get_recipe_info_from_ingredient'
	smart_crafter/smart_craft_order_list.lua:67: in function 'add_order'
	smart_crafter/smart_craft_order_list.lua:84: in function 'add_order'
	smart_crafter/smart_craft_order_list.lua:84: in function 'add_order'
	smart_crafter/smart_craft_order_list.lua:84: in function 'add_order'
	...
	smart_crafter/smart_craft_order_list.lua:84: in function 'add_order'
	smart_crafter/smart_craft_order_list.lua:84: in function 'add_order'
	smart_crafter/smart_craft_order_list.lua:84: in function 'add_order'
	smart_crafter/smart_craft_order_list.lua:84: in function 'add_order'
	smart_crafter/smart_craft_order_list.lua:84: in function 'add_order'
	smart_crafter/smart_craft_order_list.lua:84: in function 'add_order'
	smart_crafter/smart_craft_order_list.lua:84: in function 'add_order'
	smart_crafter/smart_craft_order_list.lua:84: in function 'add_order'
	smart_crafter/smart_craft_order_list.lua:84: in function 'add_order'
	stonehearth/components/workshop/craft_order_list.lua:108: in function <stonehearth/components/workshop/craft_order_list.lua:102>

bug report ingame (try maintain craft “candle Holder” or “Ink phial” item)

release-899 (x64)[M]
...nehearth/services/server/catalog/catalog_service.lua:71: stack overflow
stack traceback:
	[C]: in function 'rawget'
	...nehearth/services/server/catalog/catalog_service.lua:71: in function 'get_catalog_data'
	smart_crafter/smart_craft_order_list.lua:225: in function '_sc_get_least_valued_entity'
	smart_crafter/smart_craft_order_list.lua:211: in function '_sc_get_recipe_cost'
	smart_crafter/smart_craft_order_list.lua:186: in function '_sc_get_recipe_info_from_ingredient'
	smart_crafter/smart_craft_order_list.lua:67: in function 'add_order'
	smart_crafter/smart_craft_order_list.lua:84: in function 'add_order'
	smart_crafter/smart_craft_order_list.lua:84: in function 'add_order'
	smart_crafter/smart_craft_order_list.lua:84: in function 'add_order'
	smart_crafter/smart_craft_order_list.lua:84: in function 'add_order'
	smart_crafter/smart_craft_order_list.lua:84: in function 'add_order'
	...
	smart_crafter/smart_craft_order_list.lua:84: in function 'add_order'
	smart_crafter/smart_craft_order_list.lua:84: in function 'add_order'
	smart_crafter/smart_craft_order_list.lua:84: in function 'add_order'
	smart_crafter/smart_craft_order_list.lua:84: in function 'add_order'
	smart_crafter/smart_craft_order_list.lua:84: in function 'add_order'
	smart_crafter/smart_craft_order_list.lua:84: in function 'add_order'
	smart_crafter/smart_craft_order_list.lua:84: in function 'add_order'
	smart_crafter/smart_craft_order_list.lua:84: in function 'add_order'
	smart_crafter/smart_craft_order_list.lua:84: in function 'add_order'
	stonehearth/components/workshop/craft_order_list.lua:108: in function <stonehearth/components/workshop/craft_order_list.lua:102>

if someone can solve this problem by explaining what and how modified (or link a dirty patch :wink: ) I’m a taker by waiting for a possible official update of this great mod.

Thanks in advance.


#167

This happened to us at ACE when we ported Smart Crafter over, and it turned out to be @Wouter_Sikkema’s recipe (I believe) that was improperly configured. Basically, the resulting product of a recipe that would take in a generic resource was also considered that same generic resource.

So generally speaking, I think this would be an issue with the other mods’ recipes/items, but maybe that modder can justify it and then we’ll at least look into addressing it in ACE.


#168

the mechanic of MBS Training mod
add 3 new class, each class can by crafting a specific item for up one specific attribute (one by class).
ex :
smith workbench-> iron bar = empty ink phial
herbalist workbench-> empty ink phial + coal = Ink phial
scholar (new class) workbench -> Ink phial = empty ink phial (+ xp for lvl up the class and gain 1 pts in mind)


#169

Ahh, so there is a cycle in there. So what do you think the proper behavior should be for when it tries to queue up prerequisites?


#170

I’m not sure I understand your question, my English is very bad and I’m not a modder (unfortunately if not I have a nice mod idea that I’d be happy to do;) )

so as a user I would like to have no errors and that the object ( in maintain mode because the direct craft works even if it does not add the required items on the other workbench) and that it adds the object in the craft queue in maintain mode even if it does not add the required items on the other workbench).

(I hope that’s the answer to your question ^^)


#171

So if it detects that there is a cycle, it should only queue up the original requested item, not anything else it might encounter before it reaches the cycled item again? In your example, this would mean that queuing up the Ink Phial would only queue that up and would not also queue up the Empty Ink Phial. An alternative would be that it would keep adding required items until it hit the point of the cycle, which ironically is simpler because it only requires a single pass (though actually we could switch to tail recursion… hmm, that would probably work better).

I’ll work on it for ACE’s version when I get a chance, but I can’t help you with the Smart Crafter mod itself.


#172

bad for me but if it can make “ACE” move forward and make it better it’s always that :wink:

thx for little explain on the loop trouble (craft a -> b -> a ) with smart craft i appreciate (even if I don’t understand everything ^^ , but at least I have a little idea why )


#173

I can explain to you the problem simpler by the fuck up I did earlier what erazil talked about.

In my nordlingmod you can make leather strips out of leather.
1 leather > 3 strips
Now there are two ways to ask for ingredients. One via uri (think of this as an Internet hyperlink that says “I want that one!”)
Or via resource (anything with the right keyword is OK)
What I had accidentally done was say: anything with keyword leather kan be turned into leather strips!
… And I was a dumbass and gave the strips that keyword aswell.
So leather bolt>3strips
But also 1 leather strip>3 leath strips

Was an easy enough fix to say “only leather bolt can be turned into strips”
But this is probably going on in that mod somewhere


#174

Alright, I’ve been looking at this for a bit now and I can’t get the berry juice bug to show up (could be a result from a third mod?), though I do get a different and interesting result, but I’m not gonna go into that here.

But I do get the same bugs from the candle holder and the ink phial as you do. And it’s for the same reasons as you and @paulthegreat discussed with the cycles. I’ve got a different idea on how to handle it though, but I’m gonna discuss this with paul and see what we can do about it in ACE and then I can incorporate it into smart crafter. :slight_smile:


#175

i don’t know if that can help you but i share my stonehearth.log with the berry juice bug

if i can make another things for find where the bug come from, tell me :slight_smile:


#176

Mod update!

I’ve fixed a small issue regarding material tags for items in that they can now be represented as arrays instead, so this mod now accommodates that.

The links in the OP have been updated as well as in Steam workshop.


On another node, @Erazil, I’ve not forgotten about the loop dependency bug, and I have worked on it a little bit but need more time on it. Apologies for it taking such a long time.