Starting position

Place to get help with not working mods / modding interface.
vtx
Fast Inserter
Fast Inserter
Posts: 150
Joined: Tue Jun 28, 2016 9:48 am
Contact:

Starting position

Post 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?
Nexela
Smart Inserter
Smart Inserter
Posts: 1828
Joined: Wed May 25, 2016 11:09 am
Contact:

Re: Starting position

Post 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)
vtx
Fast Inserter
Fast Inserter
Posts: 150
Joined: Tue Jun 28, 2016 9:48 am
Contact:

Re: Starting position

Post by vtx »

Thanks.
Post Reply

Return to “Modding help”