[0.15.6] player.can_reach_entity(entity_ghos) returning true

Bugs that are actually features.
User avatar
Mylon
Filter Inserter
Filter Inserter
Posts: 525
Joined: Sun Oct 23, 2016 11:42 pm
Contact:

[0.15.6] player.can_reach_entity(entity_ghos) returning true

Post by Mylon »

In this screenshot, I placed a ghost far away and ran a console command to check. The expected behavior (for something over 10 tiles away) is to return false. I also tested character.can_reach_entity().

http://imgur.com/a/wWmQx
Last edited by Mylon on Wed May 03, 2017 3:15 pm, edited 1 time in total.
Rseding91
Factorio Staff
Factorio Staff
Posts: 15966
Joined: Wed Jun 11, 2014 5:23 am
Contact:

Re: [0.15.6] player.can_reach_entity() returning true

Post by Rseding91 »

The character can reach ghosts at any distance - that's why you can place/mine them at any distance.

That's by design.
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: [0.15.6] player.can_reach_entity(entity_ghos) returning true

Post by Nexela »

Rseding has added in a way for us to get the players total reach distance (prototype + modifier(s)) using this we can do a simple distance check on ghosts to see if they are reachable.
luaControl.reach_distance

build_distance :: uint [Read-only]

The build distance of this character or max uint when not a character or player connected to a character.
User avatar
Mylon
Filter Inserter
Filter Inserter
Posts: 525
Joined: Sun Oct 23, 2016 11:42 pm
Contact:

Re: [0.15.6] player.can_reach_entity(entity_ghos) returning true

Post by Mylon »

I found that! build_distance is definitely new and I already wrote the latest version of Bluebuild to use it. However I'm stuck trying to figure out how to implement the builds per second as a setting.

Edit: This is what I'm using:

Code: Select all

-- Need a fudge factor since my distance formula seems off.  Game likely measures from nearest colliding point?
if distance(builder, ghost) < builder.build_distance + 1 then
Not sure why I need to do (a^2 + b^2)^0.5 - 1 to match the in-game build distance, but there it is.
Post Reply

Return to “Not a bug”