Page 1 of 1

[Resolved] MOD Error

Posted: Thu Jul 13, 2017 9:19 pm
by TheSAguy
Hi,

I have a user report a bug using my Bio Industries mod.
The error does not happen on a new game, but on his save.

I'm using the standard library and it's happens on the Event Handler.

This is not something I know how to fix and was hoping someone could please take a look at it and find a fix.
I've attached the save, you can or sinc the Mods or download them from Dropbox here.

Once you load the save, plant a seedling and give it a minute or two to grow into a tree.
Here is the error

Re: MOD Error

Posted: Thu Jul 13, 2017 10:32 pm
by Nexela
luatile error when tile is invalid

You are doing something to tiles and not checking that it is valid first. somewhere around control_tree.lua line 87

Re: MOD Error

Posted: Thu Jul 13, 2017 10:43 pm
by keyboardhack
This is very wierd. It seems like the game is returning an invalid tile but that shouldn't be possible.

Code: Select all

	surface.get_tile(pos.x, pos.y).name -- this line throws an error because the tile isn't valid
Maybe i am wrong but it seems like a game error.

Re: MOD Error

Posted: Thu Jul 13, 2017 10:51 pm
by Nexela
keyboardhack wrote:This is very wierd. It seems like the game is returning an invalid tile but that shouldn't be possible.

Code: Select all

	surface.get_tile(pos.x, pos.y).name -- this line throws an error because the tile isn't valid
Maybe i am wrong but it seems like a game error.
Is the tile it wants in an unexplored chunk?

Re: MOD Error

Posted: Thu Jul 13, 2017 10:59 pm
by keyboardhack
Nexela wrote:
keyboardhack wrote:This is very wierd. It seems like the game is returning an invalid tile but that shouldn't be possible.

Code: Select all

	surface.get_tile(pos.x, pos.y).name -- this line throws an error because the tile isn't valid
Maybe i am wrong but it seems like a game error.
Is the tile it wants in an unexplored chunk?
It's not. The position "pos" is (-2754.5, 4361.5) which is explored as the player is standing right next to the position.

Re: MOD Error

Posted: Thu Jul 13, 2017 11:13 pm
by Nexela
Can you or TheSAguy post the factorio log?

Re: MOD Error

Posted: Thu Jul 13, 2017 11:20 pm
by keyboardhack
Made it throw an error and this is the log.
Log

Re: MOD Error

Posted: Thu Jul 13, 2017 11:31 pm
by Rseding91
Your mod uses "game.surfaces[1]" which is almost always wrong. The player is on surface 4 in this case and the map has 47 different surfaces.

You need to get the surface off the tree you're growing to get the correct tile and surface to grow the new one on.

You should virtually never need to use game.surfaces/game.forces unless you want to iterate over them and do something on each. You always use the surface/force off something in an event.

Re: MOD Error

Posted: Fri Jul 14, 2017 4:23 am
by TheSAguy
Thanks Rseding and everyone else for looking into this, I really appreciate the community help!
I think I've got it fixed now :)