Hi,
So I'm working on updating a mod created by someone else (Diesel Locomotive) where the mod checks for the existence of pumps adjacent to the locomotive by using the find_entities_filtered method. The problem I'm finding with this is that the locomotive can sit "off grid", and with the pumps collision box not encompassing the entire tile it sits on, it's possible for this method to check a point on the tile that is outside of the pump's collision box and thus misses seeing it.
My question is, is there another method of detecting entities that would be better/can check the entire tile of a given position?
EDIT: Ok, as I'm digging more into this, it seems like there are several different ways that it can do searches. This is the current variation of it that's being used in this mod:
Code: Select all
local found_pumps = loco.surface.find_entities_filtered{
name = "pump",
position = moveposition(
loco.position,
ori_to_dir(loco.orientation),
{x = connection_array[j][1], y = connection_array[j][2]}
)
}