From 139a26fccce1e622d58f1673284e2addfb0d1ed2 Mon Sep 17 00:00:00 2001 From: orwell96 Date: Wed, 25 Apr 2018 16:38:12 +0200 Subject: Bugfixes part 1 There's something wrong with the new paths, next time build a path validity checker to trace the issue --- advtrains/helpers.lua | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'advtrains/helpers.lua') diff --git a/advtrains/helpers.lua b/advtrains/helpers.lua index 70afadd..9ad5a8e 100644 --- a/advtrains/helpers.lua +++ b/advtrains/helpers.lua @@ -103,8 +103,8 @@ function advtrains.yawToClosestConn(yaw, conns) end function advtrains.dir_to_angle(dir) - local uvec = vector.normalize(advtrains.dirToCoord()) - local yaw1 = math.atan2(uvec.z, -uvec.x) + local uvec = vector.normalize(advtrains.dirToCoord(dir)) + return math.atan2(uvec.z, -uvec.x) end @@ -304,8 +304,8 @@ function advtrains.get_adjacent_rail(this_posnr, this_conns_p, conn_idx, drives_ end if not conn_idx then for coni, _ in ipairs(this_conns) do - local adj_pos, adj_conn_idx, _, nry = advtrains.get_adjacent_rail(this_pos, this_conns, coni) - if adj_pos then return adj_pos,adj_conn_idx,coni,nry end + local adj_pos, adj_conn_idx, _, nry, nco = advtrains.get_adjacent_rail(this_pos, this_conns, coni) + if adj_pos then return adj_pos,adj_conn_idx,coni,nry, nco end end return nil end @@ -330,7 +330,7 @@ function advtrains.get_adjacent_rail(this_posnr, this_conns_p, conn_idx, drives_ end local adj_connid = advtrains.conn_matches_to({c=conn.c, y=conn_y}, nextconns) if adj_connid then - return adj_pos, adj_connid, conn_idx, nextrail_y + return adj_pos, adj_connid, conn_idx, nextrail_y, nextconns end return nil end -- cgit v1.2.3