Page 1 of 1

Finding out on what surface god controller "is"

Posted: Tue May 07, 2019 11:14 pm
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?

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

Posted: Wed May 08, 2019 7:11 am
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)

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

Posted: Wed May 08, 2019 7:48 am
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

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

Posted: Wed May 08, 2019 7:49 am
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.