[MOD] Smart Crafter

Hey @Panpiper, and welcome to the Discourse!

I don’t see this error myself, but it could be because it’s not compatible with another mod. What other mods were you using?

I currently have Ballista, Better Stockpiles, Patrol Mod and Wizards running. If I add smart crafter to that, everything bugs out. I had a few others running when I first encountered the bug. (Newbie, added several mods all at once when I discovered I could.) I started disabling them one by one and seeing if the bug persisted. When I got to and disabled Smart Crafting, that’s when the bug vanished. I did not re-add and of the few I removed, deciding I could live without them.

Hi @Panpiper, I just enabled those mods and start a new game, and found no problem in crafting carpenter’s workbenches.

That is very strange. I too had created new games to test. I have no idea why it would work for you and not for me.

What about if you disable every mod except for smart crafter, does the bug still persist? If not, try to enable a mod at a time afterwards until the error pops up again.

Uploading a copy of your stonehearth.log file could help as well, it’s found where you have Stonehearth installed.

Ok, first I re-enabled Smart Crafter with the mods I was running, so I could record the crash data. Then I unloaded all mods, and activated only Smart Crafter. The game ran normally without issue, I was able to craft a carpenter’s workbench. Clearly it is then a mod conflict. Odd that I would get it and not you. Maybe a different version of a mod?

The crash report data I logged first is:

release-737 (x64)[M]
@stonehearth/services/server/job/job_info_controller.lua:260: Crafter job stonehearth:jobs:potter has a recipe named "utility:patrol_point" that produces an item not in the manifest patrol_mod:furniture:patrol_stele
stack traceback:
	radiant/modules/common.lua:245: in function 'report_traceback'
	radiant/modules/common.lua:492: in function 'verify'
	...nehearth/services/server/job/job_info_controller.lua:260: in function '_initialize_recipe_data'
	...nehearth/services/server/job/job_info_controller.lua:243: in function '_build_craftable_recipe_list'
	...nehearth/services/server/job/job_info_controller.lua:107: in function 'activate'
	radiant/modules/common.lua:539: in function 'create_controller'
	...earth/services/server/job/player_jobs_controller.lua:48: in function '_ensure_job_id'
	...earth/services/server/job/player_jobs_controller.lua:77: in function 'get_job'
	stonehearth/services/server/job/job_service.lua:65: in function 'get_job_info'
	...ices/server/crafter_info/crafter_info_controller.lua:24: in function 'post_activate'
	radiant/modules/common.lua:542: in function 'create_controller'
	...ervices/server/crafter_info/crafter_info_service.lua:26: in function 'add_crafter_info'
	...ervices/server/crafter_info/crafter_info_service.lua:35: in function 'get_crafter_info'
	smart_crafter/smart_craft_order_list.lua:20: in function 'add_order'
	stonehearth/components/workshop/craft_order_list.lua:73: in function <stonehearth/components/workshop/craft_order_list.lua:67>
release-737 (x64)[M]
c++ exception: 'patrol_mod' has no alias named 'furniture:patrol_stele' in the manifest.
stack traceback:
	[C]: in function 'load_json'
	radiant/modules/resources.lua:33: in function 'load_json'
	...ices/server/crafter_info/crafter_info_controller.lua:41: in function 'post_activate'
	radiant/modules/common.lua:542: in function 'create_controller'
	...ervices/server/crafter_info/crafter_info_service.lua:26: in function 'add_crafter_info'
	...ervices/server/crafter_info/crafter_info_service.lua:35: in function 'get_crafter_info'
	smart_crafter/smart_craft_order_list.lua:20: in function 'add_order'
	stonehearth/components/workshop/craft_order_list.lua:73: in function <stonehearth/components/workshop/craft_order_list.lua:67>
release-737 (x64)[M]
...ices/server/crafter_info/crafter_info_controller.lua:42: attempt to index field 'product_info' (a nil value)
stack traceback:
	[C]: ?
	...ices/server/crafter_info/crafter_info_controller.lua:42: in function 'post_activate'
	radiant/modules/common.lua:542: in function 'create_controller'
	...ervices/server/crafter_info/crafter_info_service.lua:26: in function 'add_crafter_info'
	...ervices/server/crafter_info/crafter_info_service.lua:35: in function 'get_crafter_info'
	smart_crafter/smart_craft_order_list.lua:20: in function 'add_order'
	stonehearth/components/workshop/craft_order_list.lua:73: in function <stonehearth/components/workshop/craft_order_list.lua:67>
release-737 (x64)[M]
c++ exception: lua runtime error
stack traceback:

The log file is at: stonehearth

1 Like

Man, why does every forum have to do everything differently? You have to relearn how to do stuff every time you go somewhere new. Sorry, grouchy today it seems.

From the log it looks like the patrol mod has a lot of errors, try disabling it.

It’s as BrunoSupremo says, it’s because of the patrol mod. It’s because of a recipe in that mod for something that doesn’t yet exist, and smart crafter breaks down because of it. I’ve let Wiese know of what’s going on in his mod at least (if he didn’t already know), but I’m gonna do something myself to make sure that smart crafter won’t break when this happens again.

Stay tuned for an update!

Thank you. I tried disabling Patrol Mod earlier, but that rather seriously breaks my existing save game if I do so (which I am quite invested in at the moment). Patrol Mod removes whatever it is from ordinary things that create patrol zones and replaces them with it’s own patrol markers. If you disable Patrol Mod in an existing game, nothing gets patrolled anymore. (Not good when your village gets attacked and most of your troops are off at your mine picking up rocks.) I suppose I could destroy and rebuild all my farms, but I am using those farms.

I’ll wait on updates and a future new game I guess.

SORRY! i have forget to upload the fixed version … that was an experimental build xD it should work now xD

4 Likes

Update!

A new version of the mod is available, look for the updated download links in the OP.

Patch notes:

  • Fixed so that the mod doesn’t break if a recipe is invalid.
  • Now, if a crafter has to craft missing ingredients, they will choose the cheapest ingredient to craft. Before they chose the first best recipe, but that resulted in the crafter making more expensive items than what was needed.

Enjoy!

5 Likes

Oo, nice changes.

is it possible to check if you already have the required materials to build? by stopping a build and removing it then building it again, you end up putting a ton of things in the queue to be built, when you may already have the materials from the first time you tried to build it.

after doing this about 5 times and then checking my inventory I realized I have wasted so much wood and herbs

1 Like

Hi, @genboom. I haven’t touched that part where the buildings add materials for the crafters to make should those be missing. And, whilst this mod does check if there are materials available so they won’t have to make more, it only applies to subsequent crafting materials/ingredients, not for those that are directly added at first.

The game itself does already check if you have those materials, but only if they’re already made. If the material’s in a crafter’s queue list, then it won’t be checked (from what I can gather, at least), which can result in something that you just experienced when you start a build, cancelled it, started it again, and so on, resulting in the crafters having to make the same things that they “think” they need for a building.

Again, I haven’t touched this part so this mod won’t help you with that. So you yourself have to be a bit more careful in the future. :slight_smile:

2 Likes

huh I wasn’t sure it was working or not but I think you are right and I should try to remember to clear the last orders added to the queue.

as a simpler alternative would it instead be possible to color code different order groups and display like the last number it was before it updated? so that way I can sort of guess which order goes to what thing I needed it for. just trying to think of something to make it more friendly for those that are a bit more uh absent minded while playing and those that queue up way too many things at the same time. i happen to be both at times :content:

after thinking about it this may be something to do as a separate mod altogether.

I made a mock up if anyone is interested
image
the idea is as you left click on each item, it will display the group the order is comprised of and the amount per the color group, if you then right click one of these, the main order is reduced by that number. what would make this really awesome is that for any single build it will have a unique color code so everything put in the queue can be traced back to that build.
this may be beyond modding ability

This is definitely moddable, though you’d have to work with both Lua (to change how crafting orders are added to the queue) and JavaScript/HTML (to visualize the order as shown in your mock) for this to work.

As for the idea itself, just a couple things that come to mind:

  1. Buildings always choose to craft the items, not to maintain them (your mock shows the items as being maintained, which is why I brought up this point). Which also brings me to my second point:

  2. When adding new items to be crafted (whether it’s done by the player or when starting a build), the item to be crafted is always added to the bottom of the crafting order queue. Meaning that, if a crafter should craft 3 of item A and 10 of item B (in that order), and then, when starting a build, it is required that the crafter will craft 10 more of item A, these will be crafted after 10 items of B has been made.
    If you want to have something similar to your mock, then you either have to change the order in which the items will be crafted (so that the crafter will make all items of A before continuing with B, as it will be shown on the order queue), or make it more clear to the player that item A will have 3 crafted now, and then 10 more after all B’s have been crafted.

This is not saying that you shouldn’t take this further, just that it might be tricky to get it working just right. But if you do want to continue with this, I’d like to suggest that you start a new thread and see where it goes. :slightly_smiling_face:

good point.

right. the idea is to further merge items so that the list is not so long for those single craft items. the maintain item should definitely remain separate.

as far as crafting order goes, yeah I can see it being a problem when you craft 3 of an item while there are 5 more of that item requested in another build, but those first 3 were taken and installed into the wrong building so the order for that building would be pointless if you went from one set of building orders to another, rather than just ordering the items like vanilla does 1 item type at a time in the queue list. in other words, the order that the single item type is crafted in is not important. what is important is tracking if the building has need of that item in the queue anymore or not and updating it accordingly to ensure that the color group for each build is active in the queue while it is still requesting the item. now to do that means the items that have just been crafted need to be assigned to a build immediately. if there is an item available in storage then the crafter would need to subtract the number of unassigned items in storage and wait to see if they will be used or not, and if the number of items in storage is lower than the required number, then it will craft what is needed to fill the build order. assigning items that have just been crafted to a build makes sense for items that are not maintained, but causes problems for items you are building just for trade.

it may be simpler to introduce a new ui element that is specifically for choosing what you intend to do with the item you are crafting so that the path for the items is much more linear. this way you can choose whether the item will be used in a build, be maintained, go to storage, or be used in trade.

I actually did make a suggestion thread, I’m going to add this to it actually. if you want to join me over there that’d be swell. I’ve not done any modding to SH but I like thinking of ideas like this

How do i install this mod and put it inside the game (first time downloading this kind of mod)