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

An idea, what about workers can harvest herbs, yet their is a chance of destroying them if done wrong. Just an idea,
-Revenge

1 Like

I would like to report, that the wooden doorways dont work properly with the Finetems mod, they dont have the margin removed from them, funnily enough, the stone doorways do have their margin removed, and work just fine.

1 Like

Wooden doorways are added by [MOD] [18-21] Stonehearth Doorways 2.0 and I think I’ve already added support for them, but I’ll double check that before the next release (coming soon as the first version of the API is almost ready and most data is already migrated).

I have to admit Finetems is a bit on hold right now and possibly until A23 because the devs keep writing about some crafting system overhaul and Finetems, like the name suggests, depends heavily on fine item mechanics, so I’ll wait to see what happens with them in the future. Plant Lore will get some more attention (I have few more decorations planned) and Archmod is pretty much stopped because I want to add new features instead of just new entities first. I have quite a few ideas waiting and even got names for them:

  • Land Grab: territory can be marked as owned by the player, all objects not in the player’s territory are slowly abandoned and lose player_id in the end, while objects with no player_id which end up in the player’s territory get player_id after some time. Maximal territory is limited by town tier and certain actions can be performed only on objects in the player’s territory. Also adds Patriot (feels better in the player’s territory) and Traveller (feels better outside the player’s territory) traits.
  • Clillmate: adds climates (seasons, varying day length and sun position), new physical needs (warmth, thirst, hunger divided into nutritional categories) and medical condition bar. Hearthlings may become ill if they are cold, dehydrated or have unbalanced diet and it is the Herbalist’s job to take care of them in such case. Adds traits for temperature preference and need-related thoughts.
  • YetAnotherCookingMod: some foods require maturation, e.g. the cook has to pour milk into a curding tub and curd can be harvested after some time. Adds some more elaborate food chains so it is not just a raw food > cooking ingredient > food system.

The main reason for updates slowing down recently is whenever I add a new saved variable to any component backward save game compatibility is broken, so I want to add a bunch of these in a single release.

I like the cooking mod Idea, I just think there needs to be an “auto harvest” feature for berry bushes, berry pie/cake made from berries from bushes is ANNOYING to make, since I have to harvest them every.single.time.

The land grab idea seems nice, one thing that needs to be added is some sort of defense along the road, have points along whatever road in your terriroty and have a “patrol” set there, like a footman, or a little tower with an archer.

Have you looked into the Muskets mod some guys here wanted to make?

I dont know how to mod, but you seem to know what you are doing. Could you maybe lend them a hand? I would LOVE to see muskets

smod file has a string of numbers in front may you please re upload or provide different link

the wooden doorways do not have the margins removed, and those recipes are not in the mod compatibility folder

It has nothing to do with the recipes, manifest.json should list the entity alias or .json path in “mixintos” table with margin_removal.json file path after a colon. I made sure it is done properly in the next release.

For all those experiencing bugs related to margin removal: I won’t even attempt to fix these until A23 because I’m not able to reproduce the bugs and building editor will get an overhaul in A23+ anyway so it would be more probable that I break something for A23+ than I fix it for A22.5.

Migration to API is done and as saved variables actually cannot be added via monkeypatching a component all new stuff requires its own components so I don’t have to accumulate updates that much anymore. As I wrote earlier: today’s updates of Finetems and Plant Lore break backward compatibility with older saves. In return you get major bugfixes for Plant Lore and autoharvest for renewable resource nodes. Due to the way I had to implement it loading times may theoretically increase so please report if they get much longer.

Remember to rename downloaded .smod files because Discoruse bug changes filenames.

On the finetems mod, in the compatibility settings:

There is a problem with the compatibility for the doorways mod, on the other mod there are 2 types of “wooden doorway”

The reinforced small wooden doorway is the only one that has the margins removed with your mod.

Thanks for all your help!

looking forward to seeing your new API at work. What kind of bugs does it fix?

So I think I finally found a way to reproduce margin removal bug and I’ll sit down to it tomorrow. Because today I learnt how to rotate model parts via static animations and no Blender is in fact involved (Rayya bless the author of this tool: http://quaternions.online).

So first Archmod feature I’ll show you are roof tiles.
Pros: side of the roof looks awesome
Cons: front of the roof looks ugly, many meshes to render

The problem is I have no idea what do do with roof edges.

5 Likes

This is so awesome Pawel Malecki! I look forward to see the final solution and put it to use :slight_smile:

It would already be solved if I knew how to bind a hotkey to a custom action and how exactly is placing an object from inventory different from moving it in Lua terms (both seem to use different functions because one cannot place an object from inventory on top of another object while it is possible while moving an object). I’d add a new component to Pawel API which allows toggling model variant during object placement. This would in fact help in my mods a lot as I could merge all shuttered windows into a single one and add end and crossing pieces to fences without creating new objects for each segment.

Very nice! I love the roof!

So for the margin removal problem: as I get the error but everything works as intended I’ll leave it as it is until A23, because, fixture_fabricator_component.lua is, um…


   -- what the heck is going on here?  basically other parts of the system want to
   -- maintain the invariant that square region's maintain their same position in
   -- the world when rotated, even if the origin is not exactly at the center of
   -- the region.  this is accomplished by the axis alignment flags on the mob
   -- component.
   --
   -- this means that when an entity is rotated beyond 180 degress, the origin
   -- flips to the other side of the region (e.g. -1, 0 -> 0, 1).  to account
   -- for this, move the fixture along the wall by an opposite amount.
   --
   -- yes, this is very "voodoo magic".  i apologize and loathe myself for writing
   -- it. - tony

In other words: for now all kinds of bugs related to fixtures are expected.

heyho little question can you add to your api the plants of the brewery and settlementdecor mod?

It’s done the other way round, you have to add "show_autoharvest_ui": true to renewable resource node component of these plants. Without API it will have no effect so you don’t have to create separate version of the plants for API and without API. You can do that via a mixin but it complicates the matter if you’re adding new plants instead of enabling the feature on existing ones.

1 Like

so tested - no issues with new plants ^^ also when i remove the mod - so brewerymod is uptodate now :wink: works also perfect with my appletrees :smiley: its gives now apple and wood (like always wanted xD)

soo @BrunoSupremo this could be something for your biomes :wink: like archipelago etc xD

edit:

ok now i get an error -.-

release-763 (x64)[M]
…rce_node/pawel_renewable_resource_node_component.lua:216: attempt to index a nil value
stack traceback:
radiant/modules/common.lua:245: in function 'report_traceback’
radiant/modules/common.lua:256: in function <radiant/modules/common.lua:250>
…rce_node/pawel_renewable_resource_node_component.lua:216: in function ‘request_harvest’
…rce_node/pawel_renewable_resource_node_component.lua:182: in function ‘renew’
…_resource_node/renewable_resource_node_component.lua:255: in function '_fn’
radiant/controllers/timer_controller.lua:95: in function 'fire’
radiant/controllers/time_tracker_controller.lua:86: in function <radiant/controllers/time_tracker_controller.lua:86>
[C]: in function 'xpcall’
radiant/modules/common.lua:265: in function 'xpcall’
radiant/controllers/time_tracker_controller.lua:86: in function ‘set_now’
…hearth/services/server/calendar/calendar_service.lua:421: in function ‘_on_event_loop’
…hearth/services/server/calendar/calendar_service.lua:46: 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>

ok after some test - this is also this also appears with vanilla :frowning: looks like something was changed within the renew order

1 Like

If you have the Archipelago Biome it may casue issues as it modifies the same class: ResourceCallHandler. The thing is while we apply identical changes (we both want to check for harvestable renewable resource node prior to resource node on harvest) Bruno applies it only if we’re in the Archipelago Biome (what causes issues if we plant a palm tree in a different biome and I’m surprised Bruno didn’t find the bug) and Pawel API applies it everywhere (that’s why the apple tree finally works - vanilla code prioritises resource node so chopping an apple tree would always have priority over harvesting apples). Pawel API loads after Archipelago so it should work properly.

Line 216 is copied from ResourceNodeComponent:request_harvest():

   stonehearth.town:get_town(player_id):remove_previous_task_on_item(self._entity)

and the only way to index a nil value is to run it without player_id. Honestly I don’t see a way for it to happen as the same is done within ResourceNodeComponent:request_harvest() and causes no issues.

i have suspect that a mod cause this so i have removed all mods and start a new game - and this error also occur with only pawel_api and plant_lore - as you can see i have also removed rayyas for the test xD

test

edit: now tested without debugtools - same issue … at the moment the plant renew it brings this error

ok after cheching archipelago - it looks like he works with session.player_id (but i dont know - im very bad at scripting xD)

I had this for a couple updates already :wink:

Nah, don’t worry, palm trees are not available outside the archipelago biome anyway.

Yes, there is a session.player_id, and so there is in this mod too. If you look at both files, mine and his, you will see it is the exactly the same, not a single line was changed. He even commented on his code mentioning it. So, not a problem at all.

Checking your mod, I see that you changed the tags of two items from vegetable to fruit. This can break recipes that were dependent on those tags. Although I agree on the fruit tag, I recommend just adding it instead of replacing the old one.

You overcomplicated your locales and made it hard for translators (surprised Wiese didn’t mentioned this yet). You made one en.json, and added it to the stonehearth through mixins. Just having the locales folder is enough for it to be readable by the game, and then you change your strings from i18n(stonehearth:… to i18n(pawel_API:…

And on your spawn_on_kill.json you are missing a comma, this will make the second line not readable.

2 Likes