Question regarding LuaSurface::request_path
Posted: Fri Dec 01, 2023 11:03 am
Suppose I request a path using
Let's assume that I get a valid path when defines.events.on_script_path_request_finished is raised. I now know that 'vehicle' can get from vehicle.position to path_args.goal even if there are walled-in areas with gates. However, vehicle is not allowed to open gates and I want to check whether it could still get to that destination. So I request another path:
If there are any gates that must be passed to reach path_args.goal, this request will fail and I'll get no path. But now suppose there are no walls and gates between vehicle.position and path_args.goal. I'd expect that this request would also return a valid.
Question: Given that no parameters except for path_args.goal have changed, is there a guarantee that both path requests return the same path iff there are no gates between vehicle.position and path_args.goal?
Code: Select all
local path_request
local path_args = {
bounding_box = bounding_box,
collision_mask = vehicle.prototype.collision_mask or {},
start = vehicle.position,
goal = goal,
force = vehicle.force,
radius = radius,
entity_to_ignore = vehicle,
can_open_gates = true,
pathfind_flags = {
allow_destroy_friendly_entities = false,
cache = false,
prefer_straight_paths = true,
low_priority = false,
},
}
path_request = vehicle.surface.request_path(path_args)
Code: Select all
path_args.can_open_gates = false
path_request = vehicle.surface.request_path(path_args)
Question: Given that no parameters except for path_args.goal have changed, is there a guarantee that both path requests return the same path iff there are no gates between vehicle.position and path_args.goal?