translateVelocity
Definition
-- @/lua/ge/ge_utils.lua:1467
-- returns translated value, unit, system, big
function translateVelocity(value, big)
local value, unit, system = translateDistance(value, big)
if system == 'metric' then
if big then
return value*3600, "km/h", system, big
else
return value, "m/s", system, big
end
else
if big then
return value*3600, "mph", system, big
else
return value, "ft/s", system, big
end
end
end
Callers
@/lua/ge/extensions/editor/util/editorElementHelper.lua
im.BeginDisabled()
im.Text(string.format("%0.2f m/s = %0.2f %s",e.ptr[0],translateVelocity(e.ptr[0], true)))
im.EndDisabled()
@/lua/ge/extensions/gameplay/crashTest/scenarioManager.lua
local vel = veh:getVelocity():length()
local vel, unit = translateVelocity(vel, true)
textToDraw = math.ceil(vel) .. " " .. unit
@/lua/ge/extensions/gameplay/drift/scoreboard.lua
order = 2,
value = string.format("%i %s", translateVelocity(rawPerformanceStats.driftSpeeds.total / rawPerformanceStats.driftSpeeds.count / 3.6, true))
}
@/lua/ge/extensions/gameplay/missions/missionTypes/editorHelper.lua
im.BeginDisabled()
im.Text(string.format("%0.2f m/s = %0.2f %s",e.ptr[0],translateVelocity(e.ptr[0], true)))
im.EndDisabled()
@/lua/ge/extensions/gameplay/crashTest/crashTestScoring.lua
local function calculateSpeedScore(speedGoal, speed)
local trSpeed = translateVelocity(speed / 3.6, true)
local trSpeedGoal = translateVelocity(speedGoal / 3.6, true)
local trSpeed = translateVelocity(speed / 3.6, true)
local trSpeedGoal = translateVelocity(speedGoal / 3.6, true)
local trSpeedOffset, unit = translateVelocity(scoreParameters.maxSpeedOffset / 3.6, true)
local trSpeedGoal = translateVelocity(speedGoal / 3.6, true)
local trSpeedOffset, unit = translateVelocity(scoreParameters.maxSpeedOffset / 3.6, true)
@/lua/ge/extensions/gameplay/crashTest/crashTestTaskList.lua
if stepData.objective == "Simple crash" then
local vel, unit = translateVelocity(stepData.impactSpeed/3.6, true)
string = string .. "At " .. vel .. " " .. unit