Request Player.can_reach_for_build

Nexela
Smart Inserter
Smart Inserter
Posts: 1828
Joined: Wed May 25, 2016 11:09 am
Contact:

Request Player.can_reach_for_build

Post by Nexela »

LuaPlayer::can_reach_for_build(position) -- Returns true if the player can reach this position for building as if the player tried to build it from cursor.

Currently there is no reliable way to get the build distance and Player.can_reach_entity returns true on ghosts no matter what the build distance is.
Rseding91
Factorio Staff
Factorio Staff
Posts: 14913
Joined: Wed Jun 11, 2014 5:23 am
Contact:

Re: Request Player.can_reach_for_build

Post by Rseding91 »

The player can always build ghosts at any distance... and can always reach ghosts at any distance to deconstruct them.
If you want to get ahold of me I'm almost always on Discord.
Nexela
Smart Inserter
Smart Inserter
Posts: 1828
Joined: Wed May 25, 2016 11:09 am
Contact:

Re: Request Player.can_reach_for_build

Post by Nexela »

Rseding91 wrote:The player can always build ghosts at any distance... and can always reach ghosts at any distance to deconstruct them.
Correct. Which is why I would like a way to find the build_distance for reviving ghosts via script as long as they are inside the players build range.
User avatar
Klonan
Factorio Staff
Factorio Staff
Posts: 5341
Joined: Sun Jan 11, 2015 2:09 pm
Contact:

Re: Request Player.can_reach_for_build

Post by Klonan »

Nexela wrote:
Rseding91 wrote:The player can always build ghosts at any distance... and can always reach ghosts at any distance to deconstruct them.
Correct. Which is why I would like a way to find the build_distance for reviving ghosts via script as long as they are inside the players build range.
So maybe access to these player prototype values would solve this:

Code: Select all

    build_distance = 6,
    drop_item_distance = 6,
    reach_distance = 6,
    item_pickup_distance = 1,
    loot_pickup_distance = 2,
    reach_resource_distance = 2.7,
Then you can just calculate the players reach distance and see if the distance to the position is less than this distance
Nexela
Smart Inserter
Smart Inserter
Posts: 1828
Joined: Wed May 25, 2016 11:09 am
Contact:

Re: Request Player.can_reach_for_build

Post by Nexela »

That would work also and allow for even more flexibility.
Rseding91
Factorio Staff
Factorio Staff
Posts: 14913
Joined: Wed Jun 11, 2014 5:23 am
Contact:

Re: Request Player.can_reach_for_build

Post by Rseding91 »

I added the ability to read the different reach distances off the character runtime. Reading it off the character includes the force based bonus as well as the character based bonus.
If you want to get ahold of me I'm almost always on Discord.
Post Reply

Return to “Implemented mod requests”