Finding out on what surface god controller "is"

Place to get help with not working mods / modding interface.
orzelek
Smart Inserter
Smart Inserter
Posts: 3928
Joined: Fri Apr 03, 2015 10:20 am
Contact:

Finding out on what surface god controller "is"

Post by orzelek »

I have a bit of a problem in RSO currently. When handling resources I need to get surface specific information to check resources when player is created.
It causes a problem in sandbox mode - since player is a god controller it has no character attached. And I don't see any other way to get access to surface that player is on from LuaPlayer object.

Is it possible to figure out on which surface god controller is?
User avatar
darkfrei
Smart Inserter
Smart Inserter
Posts: 2905
Joined: Thu Nov 20, 2014 11:11 pm
Contact:

Re: Finding out on what surface god controller "is"

Post by darkfrei »

I can't test it right now, but it must be just:

Code: Select all

game.print(game.players[player_index].surface.name)
User avatar
Klonan
Factorio Staff
Factorio Staff
Posts: 5412
Joined: Sun Jan 11, 2015 2:09 pm
Contact:

Re: Finding out on what surface god controller "is"

Post by Klonan »

orzelek wrote: Tue May 07, 2019 11:14 pm Is it possible to figure out on which surface god controller is?
darkfrei wrote: Wed May 08, 2019 7:11 am I can't test it right now, but it must be just:

Code: Select all

game.print(game.players[player_index].surface.name)
This is right, just game.players[k].surface
orzelek
Smart Inserter
Smart Inserter
Posts: 3928
Joined: Fri Apr 03, 2015 10:20 am
Contact:

Re: Finding out on what surface god controller "is"

Post by orzelek »

darkfrei wrote: Wed May 08, 2019 7:11 am I can't test it right now, but it must be just:

Code: Select all

game.print(game.players[player_index].surface.name)
Hmm it is indeed. After reading the docs again in the morning.. it's slightly hidden in the derived from LuaControl section in LuaPlayer docs.
Post Reply

Return to “Modding help”