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

**URL:** <https://discourse.stonehearth.net/t/pawels-mod-corner-autoharvest-biome-crops-lostems-others/26504>\
**Category:** Current Mods\
**Created:** [November 2, 2016, 6:33pm UTC](https://discourse.stonehearth.net/t/pawels-mod-corner-autoharvest-biome-crops-lostems-others/26504 "2016-11-02T18:33:49Z")\
**Posts on this page:** 20\
**Page:** 3

<div class="post-metadata">

**Author:** ![Revenge](https://sea2.discourse-cdn.com/flex022/user_avatar/discourse.stonehearth.net/revenge/32/40088_2.png) [@Revenge](https://discourse.stonehearth.net/u/Revenge)\
**Post date:** [September 26, 2017, 4:33am UTC](https://discourse.stonehearth.net/t/pawels-mod-corner-autoharvest-biome-crops-lostems-others/26504/46 "2017-09-26T04:33:01Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![TheRedBaron91](https://sea2.discourse-cdn.com/flex022/user_avatar/discourse.stonehearth.net/theredbaron91/32/68363_2.png) [@TheRedBaron91](https://discourse.stonehearth.net/u/TheRedBaron91)\
**Post date:** [October 1, 2017, 9:04pm UTC](https://discourse.stonehearth.net/t/pawels-mod-corner-autoharvest-biome-crops-lostems-others/26504/47 "2017-10-01T21:04:48Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![Pawel\_Malecki](https://sea2.discourse-cdn.com/flex022/user_avatar/discourse.stonehearth.net/pawel_malecki/32/52928_2.png) [@Pawel\_Malecki](https://discourse.stonehearth.net/u/Pawel_Malecki)\
**Post date:** [October 1, 2017, 9:09pm UTC](https://discourse.stonehearth.net/t/pawels-mod-corner-autoharvest-biome-crops-lostems-others/26504/48 "2017-10-01T21:09:18Z")

</div>

Wooden doorways are added by [[MOD] [18-21] Stonehearth Doorways 2.0](https://discourse.stonehearth.net/t/mod-18-21-stonehearth-doorways-2-0/18788) 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.

---

<div class="post-metadata">

**Author:** ![TheRedBaron91](https://sea2.discourse-cdn.com/flex022/user_avatar/discourse.stonehearth.net/theredbaron91/32/68363_2.png) [@TheRedBaron91](https://discourse.stonehearth.net/u/TheRedBaron91)\
**Post date:** [October 1, 2017, 10:31pm UTC](https://discourse.stonehearth.net/t/pawels-mod-corner-autoharvest-biome-crops-lostems-others/26504/49 "2017-10-01T22:31:08Z")

</div>

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?

> [@Mod Help - Coding Muskets](https://discourse.stonehearth.net/t/mod-help-coding-muskets/32182):
>
> Me and my friend have been making good headway in creating a mod to add muskets, but we’ve hit a brick wall straight-on. So far we’ve got our models and a rough idea on how we’re going to go about it. So far our idea, which due to pure inexperience I have yet to know how to test, is based on a lightly modified bow/arrow code (more damage, new models, faster projectile, etc) however we’re completely lost when it comes to making said code work as a mod. Any and all advice/help is appreciated. On …

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

---

<div class="post-metadata">

**Author:** ![SamoRDSA](https://avatars.discourse-cdn.com/v4/letter/s/74df32/32.png) [@SamoRDSA](https://discourse.stonehearth.net/u/SamoRDSA)\
**Post date:** [October 1, 2017, 11:41pm UTC](https://discourse.stonehearth.net/t/pawels-mod-corner-autoharvest-biome-crops-lostems-others/26504/50 "2017-10-01T23:41:54Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![TheRedBaron91](https://sea2.discourse-cdn.com/flex022/user_avatar/discourse.stonehearth.net/theredbaron91/32/68363_2.png) [@TheRedBaron91](https://discourse.stonehearth.net/u/TheRedBaron91)\
**Post date:** [October 2, 2017, 4:09am UTC](https://discourse.stonehearth.net/t/pawels-mod-corner-autoharvest-biome-crops-lostems-others/26504/51 "2017-10-02T04:09:42Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Pawel\_Malecki](https://sea2.discourse-cdn.com/flex022/user_avatar/discourse.stonehearth.net/pawel_malecki/32/52928_2.png) [@Pawel\_Malecki](https://discourse.stonehearth.net/u/Pawel_Malecki)\
**Post date:** [October 2, 2017, 9:51am UTC](https://discourse.stonehearth.net/t/pawels-mod-corner-autoharvest-biome-crops-lostems-others/26504/52 "2017-10-02T09:51:30Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![Pawel\_Malecki](https://sea2.discourse-cdn.com/flex022/user_avatar/discourse.stonehearth.net/pawel_malecki/32/52928_2.png) [@Pawel\_Malecki](https://discourse.stonehearth.net/u/Pawel_Malecki)\
**Post date:** [October 5, 2017, 9:21pm UTC](https://discourse.stonehearth.net/t/pawels-mod-corner-autoharvest-biome-crops-lostems-others/26504/53 "2017-10-05T21:21:31Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![TheRedBaron91](https://sea2.discourse-cdn.com/flex022/user_avatar/discourse.stonehearth.net/theredbaron91/32/68363_2.png) [@TheRedBaron91](https://discourse.stonehearth.net/u/TheRedBaron91)\
**Post date:** [October 6, 2017, 12:23am UTC](https://discourse.stonehearth.net/t/pawels-mod-corner-autoharvest-biome-crops-lostems-others/26504/54 "2017-10-06T00:23:52Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![Pawel\_Malecki](https://sea2.discourse-cdn.com/flex022/user_avatar/discourse.stonehearth.net/pawel_malecki/32/52928_2.png) [@Pawel\_Malecki](https://discourse.stonehearth.net/u/Pawel_Malecki)\
**Post date:** [October 6, 2017, 12:53pm UTC](https://discourse.stonehearth.net/t/pawels-mod-corner-autoharvest-biome-crops-lostems-others/26504/55 "2017-10-06T12:53:13Z")

</div>

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](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

 ![20171006163247_1](https://us1.discourse-cdn.com/flex022/uploads/stonehearth/original/3X/b/6/b6bfa882f9c91101fb13aa0047a5b426f829c071.jpg)

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

---

<div class="post-metadata">

**Author:** ![Fornjotr](https://sea2.discourse-cdn.com/flex022/user_avatar/discourse.stonehearth.net/fornjotr/32/54961_2.png) [@Fornjotr](https://discourse.stonehearth.net/u/Fornjotr)\
**Post date:** [October 6, 2017, 4:21pm UTC](https://discourse.stonehearth.net/t/pawels-mod-corner-autoharvest-biome-crops-lostems-others/26504/56 "2017-10-06T16:21:55Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Pawel\_Malecki](https://sea2.discourse-cdn.com/flex022/user_avatar/discourse.stonehearth.net/pawel_malecki/32/52928_2.png) [@Pawel\_Malecki](https://discourse.stonehearth.net/u/Pawel_Malecki)\
**Post date:** [October 6, 2017, 8:24pm UTC](https://discourse.stonehearth.net/t/pawels-mod-corner-autoharvest-biome-crops-lostems-others/26504/57 "2017-10-06T20:24:19Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![stonemonkey](https://sea2.discourse-cdn.com/flex022/user_avatar/discourse.stonehearth.net/stonemonkey/32/56475_2.png) [@stonemonkey](https://discourse.stonehearth.net/u/stonemonkey)\
**Post date:** [October 6, 2017, 8:59pm UTC](https://discourse.stonehearth.net/t/pawels-mod-corner-autoharvest-biome-crops-lostems-others/26504/58 "2017-10-06T20:59:03Z")

</div>

Very nice! I love the roof!

---

<div class="post-metadata">

**Author:** ![Pawel\_Malecki](https://sea2.discourse-cdn.com/flex022/user_avatar/discourse.stonehearth.net/pawel_malecki/32/52928_2.png) [@Pawel\_Malecki](https://discourse.stonehearth.net/u/Pawel_Malecki)\
**Post date:** [October 6, 2017, 9:39pm UTC](https://discourse.stonehearth.net/t/pawels-mod-corner-autoharvest-biome-crops-lostems-others/26504/59 "2017-10-06T21:39:42Z")

</div>

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…

```auto

   -- 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.

---

<div class="post-metadata">

**Author:** ![Wiese2007](https://sea2.discourse-cdn.com/flex022/user_avatar/discourse.stonehearth.net/wiese2007/32/15946_2.png) [@Wiese2007](https://discourse.stonehearth.net/u/Wiese2007)\
**Post date:** [October 8, 2017, 7:58am UTC](https://discourse.stonehearth.net/t/pawels-mod-corner-autoharvest-biome-crops-lostems-others/26504/60 "2017-10-08T07:58:20Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Pawel\_Malecki](https://sea2.discourse-cdn.com/flex022/user_avatar/discourse.stonehearth.net/pawel_malecki/32/52928_2.png) [@Pawel\_Malecki](https://discourse.stonehearth.net/u/Pawel_Malecki)\
**Post date:** [October 8, 2017, 8:02am UTC](https://discourse.stonehearth.net/t/pawels-mod-corner-autoharvest-biome-crops-lostems-others/26504/61 "2017-10-08T08:02:31Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![Wiese2007](https://sea2.discourse-cdn.com/flex022/user_avatar/discourse.stonehearth.net/wiese2007/32/15946_2.png) [@Wiese2007](https://discourse.stonehearth.net/u/Wiese2007)\
**Post date:** [October 8, 2017, 8:43am UTC](https://discourse.stonehearth.net/t/pawels-mod-corner-autoharvest-biome-crops-lostems-others/26504/62 "2017-10-08T08:43:02Z")

</div>

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

soo @BrunoSupremo this could be something for your biomes 😉 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 ☹ looks like something was changed within the renew order

---

<div class="post-metadata">

**Author:** ![Pawel\_Malecki](https://sea2.discourse-cdn.com/flex022/user_avatar/discourse.stonehearth.net/pawel_malecki/32/52928_2.png) [@Pawel\_Malecki](https://discourse.stonehearth.net/u/Pawel_Malecki)\
**Post date:** [October 8, 2017, 11:38am UTC](https://discourse.stonehearth.net/t/pawels-mod-corner-autoharvest-biome-crops-lostems-others/26504/63 "2017-10-08T11:38:48Z")

</div>

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()`:

```auto
   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.

---

<div class="post-metadata">

**Author:** ![Wiese2007](https://sea2.discourse-cdn.com/flex022/user_avatar/discourse.stonehearth.net/wiese2007/32/15946_2.png) [@Wiese2007](https://discourse.stonehearth.net/u/Wiese2007)\
**Post date:** [October 8, 2017, 12:04pm UTC](https://discourse.stonehearth.net/t/pawels-mod-corner-autoharvest-biome-crops-lostems-others/26504/64 "2017-10-08T12:04:07Z")

</div>

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](https://us1.discourse-cdn.com/flex022/uploads/stonehearth/original/3X/b/e/bea18095e6c71b3cff260abc3f87e0eab44fa743.JPG)

 ![test2](https://us1.discourse-cdn.com/flex022/uploads/stonehearth/original/3X/0/f/0ff863ff1f15eafe1fb43067c90a4a1098035671.JPG)

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)

---

<div class="post-metadata">

**Author:** ![BrunoSupremo](https://sea2.discourse-cdn.com/flex022/user_avatar/discourse.stonehearth.net/brunosupremo/32/54819_2.png) [@BrunoSupremo](https://discourse.stonehearth.net/u/BrunoSupremo)\
**Post date:** [October 8, 2017, 4:08pm UTC](https://discourse.stonehearth.net/t/pawels-mod-corner-autoharvest-biome-crops-lostems-others/26504/65 "2017-10-08T16:08:13Z")

</div>

> [@Wiese2007](#):
>
> soo @BrunoSupremo this could be something for your biomes 😉 like archipelago etc xD

I had this for a couple updates already 😉

> [@Pawel\_Malecki](#):
>
> causes issues if we plant a palm tree in a different biome and I’m surprised Bruno didn’t find the bug

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

> [@Wiese2007](#):
>
> ok after cheching archipelago - it looks like he works with session.player\_id

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.

[Previous page](https://discourse.stonehearth.net/t/pawels-mod-corner-autoharvest-biome-crops-lostems-others/26504.md?page=2)

[Next page](https://discourse.stonehearth.net/t/pawels-mod-corner-autoharvest-biome-crops-lostems-others/26504.md?page=4)
