[Resolved] MOD Error

Place to get help with not working mods / modding interface.
Post Reply
TheSAguy
Smart Inserter
Smart Inserter
Posts: 1449
Joined: Mon Jan 13, 2014 6:17 pm
Contact:

[Resolved] MOD Error

Post 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
Attachments
Event_Error.zip
Save
(22.97 MiB) Downloaded 70 times
Last edited by TheSAguy on Fri Jul 14, 2017 4:23 am, edited 1 time in total.

Nexela
Smart Inserter
Smart Inserter
Posts: 1828
Joined: Wed May 25, 2016 11:09 am
Contact:

Re: MOD Error

Post 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

keyboardhack
Filter Inserter
Filter Inserter
Posts: 478
Joined: Sat Aug 23, 2014 11:43 pm
Contact:

Re: MOD Error

Post 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.
Waste of bytes : P

Nexela
Smart Inserter
Smart Inserter
Posts: 1828
Joined: Wed May 25, 2016 11:09 am
Contact:

Re: MOD Error

Post 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?

keyboardhack
Filter Inserter
Filter Inserter
Posts: 478
Joined: Sat Aug 23, 2014 11:43 pm
Contact:

Re: MOD Error

Post 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.
Waste of bytes : P

Nexela
Smart Inserter
Smart Inserter
Posts: 1828
Joined: Wed May 25, 2016 11:09 am
Contact:

Re: MOD Error

Post by Nexela »

Can you or TheSAguy post the factorio log?

keyboardhack
Filter Inserter
Filter Inserter
Posts: 478
Joined: Sat Aug 23, 2014 11:43 pm
Contact:

Re: MOD Error

Post by keyboardhack »

Made it throw an error and this is the log.
Log
Waste of bytes : P

Rseding91
Factorio Staff
Factorio Staff
Posts: 13246
Joined: Wed Jun 11, 2014 5:23 am
Contact:

Re: MOD Error

Post 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.
If you want to get ahold of me I'm almost always on Discord.

TheSAguy
Smart Inserter
Smart Inserter
Posts: 1449
Joined: Mon Jan 13, 2014 6:17 pm
Contact:

Re: MOD Error

Post 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 :)

Post Reply

Return to “Modding help”