LogisticCell function "is_in_construction_range" not working
Posted: Mon Feb 27, 2017 10:32 pm
Using the test code below, I'm trying to detect whether a specific entity is in construction range of a given cell. (entity_position is a local variable defined prior to the code fragment below)
It seems to be working correctly and printing the message if the entity is in LOGISTICS range (the orange zone), but not in CONSTRUCTION range (green zone). Am missing something, or is http://lua-api.factorio.com/latest/LuaL ... tion_range not working correctly?
Code: Select all
if player.surface.find_logistic_network_by_position(entity_position, force) then -- is this entity in a logistic network?
local nearest_cell = player.surface.find_logistic_network_by_position(entity_position, force).find_cell_closest_to(entity_position)
if nearest_cell.is_in_construction_range(entity_position) then
game.players[1].print (roster_entry.entity.name .. "found in range of a construction network. Time to rebuild.....")
end
end