Pawel's Mod Corner: Autoharvest, Biome Crops, LostEms & others

Oh yeah sorry I was just using the potter as an example to talk about the stone stuff. That’s cool about the stone items, lots of options and I still appreciate the extra items regardless. I’ll definitely keep an eye on this thread for Archmod and Plant Lore. Thanks for all the work you’re doing!!! :jubilant:

Ugh, two major ideas of Plant Lore have just failed. I think I need help.

As I reported here: [A22] Plants don’t respond to undeploy UI. Even adding undeploy command as an entity component doesn’t work. This pretty much kills the idea of reproducing plants as they cannot be moved to inventory so they cannot be used in recipes.

Another issue is the farming service loading before deferred load manifests, so it doesn’t respond to biome-specific manifest changes. This means biome-dependent crops are impossible unitl the farming service loads after deferred load manifests. I’d be glad if someone helped me with that as I am not much into Stonehearth Lua base code. For now all the temperate crops are available to the Ascendancy and desert crops go to the Rayya’s Children.

well that sad to hear, but hopefully with the community you might be able to work through it or change it in a way that it works out

Finetems alpha 1.3 released with fixes related to allow_vertical_adjacent and transparent water. Plant Lore mod support files are included what means the release is getting closer.

Sadly I wasn’t able to get undeploy ui working for preplaced plants what kinda ruins the whole idea. For now I decided to add a Tier 2 trader who sells plant specimen as well as randomly chosen seeds (getting seeds is no longer done the quest way, money and some luck are needed instead), potions and healing items.

2 Likes

I also created some planters in my mod. If you need some help maybe i can look at your code.

The first time i was trying to implement this elements i had a lot of Bugs to fix :smiley:

Planters are not a problem, I’ve already coded a date palm to test the renewable resource node component.

The problem is I cannot find which part of the code makes it impossible to undeploy objects which have no player_id component and whether it has to be player_1 or just exist in order to work (in which case I’d use a dummy gaia player just like it’s done in Age of Empires series). There’s even a strange lease component using player_id and if it allowed to mark something as temporarily belonging to a player but not counting towards the net worth I’d prefer to use it. There are several ways of approaching the problem: I can modify the undeploy command not to require player_id, I can force it to add player_id when the command is invoked, I can force world generator to add player_id to plants (too invasive for my taste) but I think the most elegant way would be to add the lease component when the command is invoked and make it required in order to undeploy an object.

EDIT: I finally found it in inventory.lua. It is clear that player_id has to be player_1 in order for it to work. As it seems to be a more general issue I’ll continue discussing it here: Undeplyoing items without player ID

EDIT2: I got it working properly without modifying the code too much. This means the release just got way closer, in fact injecting one line into PlaceItemCallHandler does the trick.

Love the Fineitems however it seems that some stone windows are crafted by the Carpenter?

Shutters for both stone and wooden window frames are added by the Carpenter. If you look at the recipe you’ll see it requires stone window frame as an ingredient. Same goes for stone-wooden doors: they require stone doorways.

1 Like

As I added a new task group specific for the Herbalist to handle the plant beds I can limit harvesting herbs and/or fiber as well. I think undeploying plants can be limited to the Herbalist too. So here go the polls.

  • Herbs should be harvested by the Herbalist only.
  • Herbs should be harvested by any class.

0 voters

  • Plant fiber should be harvested by the Herbalist only.
  • Plant fiber should be harvested by any class.

0 voters

  • Plants should be undeployed by the Herbalist only.
  • Plants should be undeployed by any class.

0 voters

I think you locked yourself there.
You need an herbalist to get herbs. To craft the herbalist talisman you need herbs.

5 Likes

Good point, I’d have to alter the herbalist talisman recipe. Still way better than current Herbalist’s uselessness. Let’s be honest: getting that one herb for the talisman isn’t a challenge anyway.

EDIT: if the plants were undeployed by any class then a sprout could be used instead of a herb. I thought it would be easy to make undeploying available only to the Herbalist but then a bunch of secondary issues like gaining XP and resource node component limitations appeared.

Hmmmm

Herbs != Flowers ??

That is the question,
are flowers herbs or should flowers count as herbs or as both.

How about:
the herbalist staff needs flowers and wood.
the basic herbalist recips need only flowers (and or wood / stone / clay).
the advanced herbalist recipes need herbs and maybe additional stuff.

Would this be better, worse, good, bad???

As this was confusing even to me I changed resource constant and stockpile filter names in locale/en.json. Harvested flowers are called Herbal Material and undeployed whole plants are called Plant Specimens (and use sprout material tag to keep it consistent with Better Stockpiles mod so if a mod supports BS the plant will be tagged correctly in Plant Lore as well - this is super important in terms of the new Herbalist trader code).

Herbalist Staff recipe now requires Plant Specimen instead of Herbal Material so the Herbalist can be the only class capable of harvesting herbs (and only herbs for now as I had to disable harvesting non-herb stuff because of the XP code issues).

As I won’t have much time to work on SH mods for a week from tomorrow I’ll do my best to release the first alpha today.

2 Likes

Plant Lore alpha 1.0 released, but with very little testing done. Bugs are expected, please report them here so I can fix them when I’m back. Especially the new Tier 2 Herbalist trader should be considered unstable as I tested it only once. I’ll be grateful if you upload screenshots of his shop (or an error log preventing it from appearing) so I can see if the randomisation works the way I intended.

I’m sorry, @Pawel_Malecki, but I received 2 errors when I played with your Finetem mod.

release-763 (x64)[M]
std::logic_error: 'Calling iterator method on non-iteratable: find’
stack traceback:
[C]: ?
[C]: in function 'load’
stonehearth/components/fixture/fixture_component.lua:10: in function <stonehearth/components/fixture/fixture_component.lua:6>
[C]: in function 'resume’
stonehearth/services/server/threads/thread.lua:469: in function '_do_resume’
stonehearth/services/server/threads/thread.lua:74: in function 'resume_thread’
stonehearth/services/server/threads/thread.lua:26: in function ‘loop’
…nehearth/services/server/threads/threads_service.lua:11: in function 'instance’
radiant/modules/events.lua:291: in function <radiant/modules/events.lua:285>
[C]: in function 'xpcall’
radiant/modules/common.lua:265: in function 'xpcall’
radiant/modules/events.lua:285: in function 'trigger’
radiant/modules/events.lua:398: in function '_trigger_gameloop’
radiant/modules/events.lua:446: in function '_update’
radiant/server.lua:61: in function <radiant/server.lua:58>

release-763 (x64)[M]
c++ exception: lua runtime error
stack traceback:
[C]: in function 'create_entity’
radiant/modules/entities.lua:24: in function 'create_entity’
stonehearth/ai/actions/produce_crafted_items.lua:134: in function '_add_outputs_to_bench’
stonehearth/ai/actions/produce_crafted_items.lua:27: in function <stonehearth/ai/actions/produce_crafted_items.lua:21>
[C]: ?
[C]: ?
[C]: ?
[C]: ?
[C]: in function ‘run’
…tonehearth/services/server/tasks/run_task_action.lua:143: in function <…tonehearth/services/server/tasks/run_task_action.lua:141>
[C]: ?

[C]: in function 'run’
stonehearth/components/ai/ai_component.lua:607: in function <stonehearth/components/ai/ai_component.lua:591>
[C]: in function 'xpcall’
radiant/modules/common.lua:265: in function 'xpcall’
stonehearth/components/ai/ai_component.lua:591: in function '_thread_main’
stonehearth/services/server/threads/thread.lua:273: in function <stonehearth/services/server/threads/thread.lua:270>
[C]: in function 'xpcall’
radiant/modules/common.lua:265: in function 'xpcall’
stonehearth/services/server/threads/thread.lua:270: in function 'f’
radiant/lib/env.lua:15: in function <radiant/lib/env.lua:14>


I had gotten those same two errors when I first started with the swamp biome and then again in another game in the normal forest biome. I started a new game with your Finetem mod disabled and didn’t get the error that time.

1 Like

I’ll have a look at the fixture component Lua tomorrow in the evening.

As I’m adding more and more Lua features used by more than one of my mods I think I’ll wrap them up in an API mod required by other mods so other modders can use the code without my mods if they wish.

hey so i’m having an issue with plant Lore, so the harvesting herbs bit works, but it says i can flat out undeploy plants, and when i undeploy nothing happens. Is this a known issue still? or is this just a ME thing right now?

I monkeypatched PlaceItemCallHandler.undeploy_item function so it should work properly, at least for me it does. Have you tried undeploying anything else than a plant? It could be that for some reason the whole undeploy command is bugged.

EDIT: I found the typo, I was missing one end in plant_lore_server.lua, hotfix uploaded.

EDIT2: Something strange happened as none of my server.lua files seem to work now, despite me not changing a single character in the files. I have to investigate further.

EDIT3: So it seems there’s a new annoyance in modding: .lua files don’t work if the mod isn’t packed into .smod file. For fast testing I kept the mods unpacked and zipped them only for releases, now I’ll have to zip before every test. Not nice.

It seems the bug was caused because bounds table was missing somehow, it is not even related to the margin table in the code. I find it strange. "mixintypes": "remove" has specific table set as a target and should not even attempt to touch the bounds table, so I’ll use it instead.

After checking the fixture component: it assigns 0 if margin is nil, there’s even a comment so I guess it was addressed in A22.5 after bug report. This means the old method should be safe now and, given how unexpected the mixin results can be, even more reliable. I’ll revert to it in the next small update of Finetems, which will fix the problem of windows being passable when placed next to each other.

1 Like

Just a quick but very important note: because of the Pawel API mod coming soon next releases of both Finetems and Plant Lore will be completely backward incompatible with savegames based on earlier mod versions. Some elements will be fused, renamed, moved to the API or even completely removed so the game won’t be able to load them.

2 Likes