aboutsummaryrefslogtreecommitdiff
path: root/advtrains/helpers.lua
diff options
context:
space:
mode:
authororwell96 <orwell@bleipb.de>2018-05-29 12:27:02 +0200
committerorwell96 <orwell@bleipb.de>2018-06-14 17:39:42 +0200
commit2a76d4a960aa29621dc8020f84eee241b41e10c0 (patch)
treea832307a81752012ed19f946281c64fc7e72e2ed /advtrains/helpers.lua
parent254c32e304a4f279bf99e460727daf1b78050c47 (diff)
downloadadvtrains-2a76d4a960aa29621dc8020f84eee241b41e10c0.tar.gz
advtrains-2a76d4a960aa29621dc8020f84eee241b41e10c0.tar.bz2
advtrains-2a76d4a960aa29621dc8020f84eee241b41e10c0.zip
Fix final bugs and to-do's (u.a.save/load system)
Diffstat (limited to 'advtrains/helpers.lua')
-rw-r--r--advtrains/helpers.lua4
1 files changed, 2 insertions, 2 deletions
diff --git a/advtrains/helpers.lua b/advtrains/helpers.lua
index e060920..ce059de 100644
--- a/advtrains/helpers.lua
+++ b/advtrains/helpers.lua
@@ -37,7 +37,7 @@ advtrains.pos_add_dir = advtrains.dirCoordSet
function advtrains.pos_add_angle(pos, ang)
-- 0 is +Z -> meaning of sin/cos swapped
- return vector.add(pos, {x = -math.cos(ang), y = 0, z = math.sin(ang)})
+ return vector.add(pos, {x = -math.sin(ang), y = 0, z = math.cos(ang)})
end
function advtrains.dirToCoord(dir)
@@ -103,7 +103,7 @@ function advtrains.yawToClosestConn(yaw, conns)
local min_connid, min_diff=1, 10
for connid, conn in ipairs(conns) do
local yaw1 = advtrains.dir_to_angle(conn.c)
- local diff = advtrains.minAngleDiffRad(yaw, yaw1)
+ local diff = math.abs(advtrains.minAngleDiffRad(yaw, yaw1))
if diff < min_diff then
min_connid = connid
min_diff = diff