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

for the translation - it wasnt that difficult xD i have just add his line via mix in my translation of stonehearth en.json ^^

but what i dont understand that is the error - when the lines are completly the same why i get this error even with vanilla? or was ometing changed on v 763?

They are in Plant Lore - you can buy any seeds from the Herbalist merchant. But Plant Lore uses Pawel API now so this is not a problem anymore.

For me it is easier because: I don’t need to keep tracking where I should use stonehearth:... and where mod_name:... and I can put both new texts and overrides of vanilla ones in one file. But I understand the difficulty and I’ll change that in next backward-incompatible releases of my mods (at least for Finetems one is coming out as soon as I find a way to allow choosing model variants when placing an object so all shuttered windows are one entity with variants instead of a crowded mess).

I guess Wiese didn’t mention it yet because my mods are not that popular (as of now about 25 downloads each). I don’t have enough time to make screenshots so I don’t get much attention, I prefer testing my mods properly instead (and yet most mods are still quite buggy…).

Thanks, fixed. Fortunately the file is not functional, it just serves as a component template.

I tested it, two tags make Hearthlings think they ate both vegetable and fruit. And there still are other fruits (berries) and vegetables (carrots etc.), so this would not break the recipes, just move prickly pears and watermelons to a different ingredient category. Leaving a category empty would be dangerous but it’s not a case here.

1 Like

ok i give up ^^ fresh install no mods only api and plant_lore and i still get this issue … with v763

If you’re using the latest versions of the API and Plant Lore then I have no clue what is going on, as you see the error log refers files my code doesn’t touch. I’ve already checked the code and everything is fine.

1 Like

hmmm perhaps @max99x can help with this?

here is the freshest logfile - expect from the many finding issues - there is only this issue with the luafile

stonehearth.log (36.0 KB)

freshinstall (no settings change) with only the normal ingamemods and api + plant_lore installed

1 Like

The error is in pawel_renewable_resource_node_component.lua, line 216, which is certainly part of this mod. Whether it’s a bug in the mod itself or an interaction with another mod (the log references other mods) I cannot tell.

2 Likes

thx for your help ^^ so im not the only one who doesnt understand it xD

1 Like

I wanted to do some stuff the devs usually do by extending engine functionality but then margin removal and autoharvest component started throwing strange error logs at mod users…

The only possible way to index nil in line 216 when player_id is valid is to remove Town class which is a part of town service. Calling stonehearth.town:get_town(player_id) would point to a nilvalue then. So it is either a problem with service initialisation, player_id input or trace class which if I remember correctly sits in radiant.smod.

Does anyone else have that problem? My last recommendations would be to add Stonehearth to your antivirus whitelist and run Stonehearth as admin.

2 Likes

ok tested - antivirus firewall and admin - same issue … like i know there is one german player without this issue - he was the one who recommend your mod that i should test and translate it ^^

1 Like

When exactly do you get the error? Every time you start the game? In such case enable only debugtools and pawel_API and try generating a new world. If the issue persists I think I won’t be able to fix it as it quite frankly doesn’t make sense (at least the error log doesn’t when compared to the code).

This may also suggest a completely different problem: there actually is some kind of an error, but it leaves incorrect log entry or for some reason an error log entry is created while there is no error (a false positive).

1 Like

with every testrun i have always started a complete new game - set an plant to be autoharvest my hearthling runs to it and harvest it - after sometime the error occurs just in the moment when the plant is renew/refreshed. so it aboard the autoharvest command i can deactivate and manual reactivate the command and the error shows again after the next respawn. -

jfi the hearthlings dont autoharvest the plant after the error ^^

1 Like

I found a potentially dangerous shortcut in the code responsible for request harvest part you described and it can be tested easily if it causes the error. The workaround is adding a simple if statement and changing the source of player_id data to the autoharvest component (now it simply grabs it from an entity - what if an entity has no player_id?).

Try placing a plant via Item Stamper and see if the error occurs for it. If it fixes the problem then the reason is not line 216 but 182.

1 Like

ANNNNDDD THE WINNER IS THE ITEMSTAMPER :smiley:
with this it works - no error and my hearthlings do the autoharvest - tested with all vanilla plants

edit: also now tested wit new plants from brewery and settlementdecor - works fine with the stamper

1 Like

OK, fixed, Pawel API alpha 1.0a should have the bug removed. Download link in the first post.

2 Likes

Testrun completed - works fine now :smiley: THX^^ Now i will start with the translation of plant lore and finetems ^^

1 Like

So I’m a total idiot when it comes to any kind of coding - I’m having issues with Plant Lore - I can’t make an Herbalist as it requires a plant specimen but I can’t pick anything without the Herbalist - I’ve tried actually picking up the plants & having them in inventory but that doesn’t work either - how do I fix this? I read the “unpack the mod” part but how am I to do that to figure out what I need to change?

1 Like

Thanks for the report, I spotted a complex .json problem between Plant Lore and the API while investigating it. Both mods will get an update when I fix all the issues around it as this bug is quite critical (forces you to purchase Herbalist talisman).

1 Like

Ladies and gentlemen, the margin removal bug seems to be gone!

What caused the error was the fact I was mixing into mixin files from stonehearth.smod (door ghost mixins have all margins except the top set to 1). Overriding the files instead of mixing into them works and doesn’t cause the error. At least for me, so I uploaded new version of the API for testing. The lesson is: never mixinto a mixin file.

@Alostlawgrad, @Golden and @Wiese2007: does this version of pawel_API.smod (51.8 KB) fix the bug for you (make sure you have Finetems 1.4 or disable Finetems completely because older versions attempt to remove margins themselves instead of relying on the API)?

Please respond after testing.

1 Like

So I finally found a way to fix the margin removal bug. It’s more of a workaround than a fix, but it works flawlessly. Overriding a mixin doesn’t work the way I expected and I couldn’t rely on it so the fix is applied to each door_ghost.json separately and Finetems doors use alternate mixins added to the API. I had to update Finetems and Plant Lore because of the changes so don’t redownload my mods if you don’t want to break saved games.

Also, good news for translators: all my mods now have separate en.json and only en_correction.json is mixed in if I need to change vanilla texts.

Results of my investigation are: objects which are not items (have root, ghost and iconic entity forms) cannot be used in recipes with material tags. The only resource which is obtained from plants, doesn’t require the Herbalist and has only one item form is plant fiber so I created an appropriate resource constant and altered the recipes. Fix is applied to Plant Lore alpha 1.1b.

Good news is this should bring the small sub-release shenanigans to the end as all major bugs in the API, Finetems and Plant Lore seem to be fixed for now.