Help finding/changing player reach setting

Place to get help with not working mods / modding interface.
Post Reply
Celsus_Trueword
Burner Inserter
Burner Inserter
Posts: 16
Joined: Tue Jan 21, 2014 9:37 pm
Contact:

Help finding/changing player reach setting

Post 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.

User avatar
FreeER
Smart Inserter
Smart Inserter
Posts: 1266
Joined: Mon Feb 18, 2013 4:26 am
Contact:

Re: Help finding/changing player reach setting

Post 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)
<I'm really not active any more so these may not be up to date>
~FreeER=Factorio Modding
- Factorio Wiki
- My Factorio Modding Guide
- Wiki Modding Guide
Feel free to pm me :)
Or drop into #factorio on irc.esper.net

Celsus_Trueword
Burner Inserter
Burner Inserter
Posts: 16
Joined: Tue Jan 21, 2014 9:37 pm
Contact:

Re: Help finding/changing player reach setting

Post 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.

Post Reply

Return to “Modding help”