Page 1 of 1

Starting position

Posted: Sun Feb 26, 2017 3:39 am
by vtx
At the start of the game the position of player is allways 0,0 on the map or is there some case it's different ?

Also performant wise question :

Did it require the same time to access player.position.x than set it as variable at start of the function x = player.position.x when I need to check multiple time that value inside my function?

Re: Starting position

Posted: Sun Feb 26, 2017 5:00 am
by Nexela
vtx wrote:At the start of the game the position of player is allways 0,0 on the map or is there some case it's different ?
Unless a mod/scenario script changes it starting is always 0,0 But why take chances, there is an api for that
http://lua-api.factorio.com/latest/LuaF ... n_position
Also performant wise question :

Did it require the same time to access player.position.x than set it as variable at start of the function x = player.position.x when I need to check multiple time that value inside my function?
It would be quicker to set x as a local variable inside your function. (local x = player.position.x)

Re: Starting position

Posted: Sun Feb 26, 2017 7:37 am
by vtx
Thanks.