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?
Finding out on what surface god controller "is"
Re: Finding out on what surface god controller "is"
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"
orzelek wrote: Tue May 07, 2019 11:14 pm Is it possible to figure out on which surface god controller is?
This is right, just game.players[k].surfacedarkfrei 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)
Re: Finding out on what surface god controller "is"
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.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)