Page 1 of 1

[Solved] How to fix attempt to index field 'player' (a nil value)?

Posted: Sun Jun 09, 2019 5:47 pm
by Sander_Bouwhuis
I had some simple mods that worked in v0.16.

All of them now fail with this error message : attempt to index field 'player' (a nil value)

This is where it fails in one of the mods in data.lua:

Code: Select all

data.raw.player.player.running_speed
Another of the mods fails here in data.lua:

Code: Select all

data.raw["player"]["player"].reach_distance = 10000
Yet another mod has this in data.lua:

Code: Select all

local mplayer = util.table.deepcopy(data.raw["player"]["player"])
mplayer.collision_box = {{0,0},{0,0}}
data:extend{mplayer}
And finally, another has this in data-final-fixes.luq:

Code: Select all

data.raw["player"]["player"].inventory_size = my_inventory_size

Everywhere 'player' is used it now fails. How can I change them to get them working again?

Thanks in advance for the help!

Re: How to fix attempt to index field 'player' (a nil value)?

Posted: Sun Jun 09, 2019 6:56 pm
by eradicator
The base "avatar" entity and it's prototype class were renamed.
Before:

Code: Select all

{
 type = 'player',
 name = 'player'
}

After:

Code: Select all

{
 type = 'character',
 name = 'character',
}

Re: How to fix attempt to index field 'player' (a nil value)?

Posted: Sun Jun 09, 2019 7:11 pm
by disentius
See this: 70313

Re: How to fix attempt to index field 'player' (a nil value)?

Posted: Sun Jun 09, 2019 7:48 pm
by Sander_Bouwhuis
Oooooooooh, Disentius + Eradicator. I love you guys!
Thanks for the help!!! I managed to fix 5 mods.

What an annoying mod breaking change :evil: