Page 1 of 1

Help finding/changing player reach setting

Posted: Sat Jan 25, 2014 2:10 am
by Celsus_Trueword
Hello to all. I am looking for a way to extend the player's reach a bit. I'd like to make a control.lua that accomplishes this, but I can't find the proper commands to achieve it. I went to the wiki and searched for reach, and found under Lua/Player:
canreachentity
Parameter: Lua/Entity Returns true if the player can reach it (open/access it)
...which tells me there is a value being checked for. If I understand correctly, I just need to find where and how that value is established to be able to enter it into a control.lua of my own, creating an 'extended reach mod'. I can't find a relevant discussion via forum search. Can anyone offer some advice, or point me in the right direction?

EDIT: To be as clear as possible, I'm looking for something like: game.player.reach "10" (haha) so I can change the 10 to 20 or so.

Re: Help finding/changing player reach setting

Posted: Sat Jan 25, 2014 2:26 am
by FreeER
From what I can see in the code, the player's reach is based upon the player's collision box, so increasing the collision box should increase the player's reach...of course this would probably prevent the player from 'sliding' inbetween tight spots like inserters.

perhaps this should be changed to it's own parameter? I could imagine a few equipment items that could change this (robot arms anyone?) but you might not want to increase the collision boxes as well.

edit: took another look in the code and I see some hard coded (C++) values for build distance, item drop distance, reach distance, and resource reach distance (first three are 6, resource is 2.7)

Re: Help finding/changing player reach setting

Posted: Sat Jan 25, 2014 3:04 am
by Celsus_Trueword
Thanks for such a detailed response! I was afraid that reach was hard-coded. Changing the collision box sounds a bit too drastic to me. I'll just play with the reach as it is.