Open hanakocz opened 4 years ago
Thanks! I reproduced the error and it seems to have fixed it on 1.8.139 commit.
Thanks! I have few more crashes from other stuff, will post them as separate issues.
Just a thought...You are checking if fruitSeedling is not null, and then directly are checking if fruitSeedling.seedling.valid. From my experience with lua, sometimes can happen that fruitSeedling.seedling is null, thus then .valid can't be checked and things do crash(can't check if null is valid). I guess this can be skipped as you do it if you are 100% sure that seedling is never null, but on the other hand, you are working there with global table, that can be in theory altered by scripts outside of your mod workspace.
I have personally only scripting experience so don't know if this is really like that in mods, it is just what my immediate feeling was after the crash happened and I checked the code. Feel free to ignore my question :)
Oh, and one more note. We actually managed to pinpoint what exactly caused the removal of the seedlings that made this crash. It was https://mods.factorio.com/mod/Mining_Drones mod, our solution was to remove all recipes from food industry so players couldn't make drones to harvest your things (wood harvesting goes after your trees in this case). Don't know if it needs some special treatment more than the crash fix, but just wanted to let you know.
Just a thought...
I check record from global.foodi.fruitSeedlings table {entity, grow_time}, {entity, grow_time}... then, check is valid a entity from record of table, if it is not there, then delete the tree entry.
It was https://mods.factorio.com/mod/Mining_Drones mod
Before that, tree removal was checked only if the player did it. Now it doesn’t matter how the tree disappeared, if it is not there (check if entity is valid), then it is deleted from the mod table.
But in general I want to redo trees/plants control. In a first approximation, it looks like this
But it's still a dream :)
while running quite small modpack. It is possible that the seedlings get destroyed by environment.