Page 1 of 1
[0.15.6] player.can_reach_entity(entity_ghos) returning true
Posted: Wed May 03, 2017 3:12 pm
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
Re: [0.15.6] player.can_reach_entity() returning true
Posted: Wed May 03, 2017 3:14 pm
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.
Re: [0.15.6] player.can_reach_entity(entity_ghos) returning true
Posted: Wed May 03, 2017 5:49 pm
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.
Re: [0.15.6] player.can_reach_entity(entity_ghos) returning true
Posted: Thu May 04, 2017 12:52 am
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.