diff options
author | orwell96 <orwell@bleipb.de> | 2017-10-11 12:32:23 +0200 |
---|---|---|
committer | orwell96 <orwell@bleipb.de> | 2017-10-11 12:32:23 +0200 |
commit | 6ade65b6d6814526d6c99c2123b2ccd702bb703b (patch) | |
tree | a2a0bc6125f054a672dd40f0c720ff2eb7e225b5 | |
parent | 0dfb0fce22147f67d17d599fa143ac5ce131db4f (diff) | |
parent | c184c00f269a612a20a1f167148969fa2c8bcf81 (diff) | |
download | advtrains-6ade65b6d6814526d6c99c2123b2ccd702bb703b.tar.gz advtrains-6ade65b6d6814526d6c99c2123b2ccd702bb703b.tar.bz2 advtrains-6ade65b6d6814526d6c99c2123b2ccd702bb703b.zip |
Merge remote-tracking branch 'lemon-melon-repo/master'
-rw-r--r-- | advtrains/helpers.lua | 8 | ||||
-rw-r--r-- | advtrains/trainhud.lua | 6 |
2 files changed, 10 insertions, 4 deletions
diff --git a/advtrains/helpers.lua b/advtrains/helpers.lua index df2d9a8..91c0c1c 100644 --- a/advtrains/helpers.lua +++ b/advtrains/helpers.lua @@ -81,7 +81,7 @@ function advtrains.conway(midreal, prev, drives_on)--in order prev,mid,return --dir2???
local cor2=advtrains.dirCoordSet(mid, middir1)--<<<<
if math.floor(cor2.x+0.5)==math.floor(prev.x+0.5) and math.floor(cor2.z+0.5)==math.floor(prev.z+0.5) then
- next=advtrains.dirCoordSet(mid, middir2)--dir2 wird überprüft, alles gut.
+ next=advtrains.dirCoordSet(mid, middir2)--dir2 wird überprüft, alles gut.
if midrely2>=1 then
next.y=next.y+1
--atprint("found midrely2 to be >=1: next is now "..(next and minetest.pos_to_string(next) or "nil"))
@@ -170,7 +170,7 @@ function advtrains.minAngleDiffRad(r1, r2) return try3
end
end
- +
function advtrains.dumppath(path)
atlog("Dumping a path:")
if not path then atlog("dumppath: no path(nil)") return end
@@ -260,3 +260,7 @@ function advtrains.is_protected(pos, name) end
return minetest.is_protected(pos, name)
end
+
+function advtrains.ms_to_kmh(speed)
+ return speed * 3.6
+end
diff --git a/advtrains/trainhud.lua b/advtrains/trainhud.lua index 591881a..78c7624 100644 --- a/advtrains/trainhud.lua +++ b/advtrains/trainhud.lua @@ -116,11 +116,13 @@ function advtrains.hud_train_format(train, flip) local max=train.max_speed or 10 local vel=advtrains.abs_ceil(train.velocity) local tvel=advtrains.abs_ceil(train.tarvelocity) + local vel_kmh=advtrains.abs_ceil(advtrains.ms_to_kmh(train.velocity)) + local tvel_kmh=advtrains.abs_ceil(advtrains.ms_to_kmh(train.tarvelocity)) local topLine, firstLine, secondLine topLine=" ["..mletter[fct*train.movedir].."] "..doorstr[(train.door_open or 0) * train.movedir].." "..(train.brake and "="..( train.brake_hold_state==2 and "^" or "" ).."B=" or "") - firstLine=attrans("Speed:").." |"..string.rep("+", vel)..string.rep("_", max-vel)..">" - secondLine=attrans("Target:").." |"..string.rep("+", tvel)..string.rep("_", max-tvel)..">" + firstLine=attrans("Speed:").." |"..string.rep("+", vel)..string.rep("_", max-vel).."> "..vel_kmh.." km/h" + secondLine=attrans("Target:").." |"..string.rep("+", tvel)..string.rep("_", max-tvel).."> "..tvel_kmh.." km/h" return topLine.."\n"..firstLine.."\n"..secondLine end |