Does anyone know how to solve this? There was also a recent forum post about a similar topic but the posted solution was not actually a solution.
Code: Select all
function move(x,y)
local surface = game.get_surface("nauvis")
local character = game.get_player(1).character
local position = {x = x, y = y}
local collision_mask = {
"player-layer",
"train-layer",
"consider-tile-transitions",
"water-tile",
"object-layer"
}
--
t = character.bounding_box
--probable reason for pathing over water is collision masks.
--follow this link for collision masks https://wiki.factorio.com/Types/CollisionMask
pos = character.position
--local bbox ={{pos.x - 0.5, pos.y - 0.5},{pos.x + 0.5, pos.y + 0.5}}
--local bbox2 = {{-0.1,-0.1},{0.1,0.1}}
surface.request_path{
bounding_box = t,
collision_mask = collision_mask,
start = character.position,
goal = position,
force = "player",
path_resolution_modifier = 0
}
end