GE Lua Documentation

Press F to search!

reportSpeed

Definition


-- @/lua/ge/simTimeAuthority.lua:64

local function reportSpeed(speed, simplified)
  if speed > 1.001 then
    ui_message({txt="vehicle.bullettime.changeFast", context={speed=speed}}, 5, "bullettime")
  elseif speed > 0.999 then
    if not simplified then
      ui_message("vehicle.bullettime.realtime", 5, "bullettime")
    end
  else
    if simplified then
      ui_message("vehicle.bullettime.slowmotion", 5, "bullettime")
    else
      local times = 1/speed
      local rounded = math.floor(times+0.5)
      if times < 2 and times ~= rounded then
        times = string.format("%.2f", 1/speed)
      else
        times = rounded
      end
      ui_message({txt="vehicle.bullettime.changeSlow", context={slowmoTimes=times}}, 5, "bullettime")
    end
  end
end

Callers

@/lua/ge/simTimeAuthority.lua
    setTargetSpeed(bulletTimeSlots[M.selectionSlot])
    reportSpeed(M.simulationSpeed, false)
  end
  setTargetSpeed(val)
  reportSpeed(M.simulationSpeed, true)
end
@/lua/ge/extensions/core/replay.lua
  setSpeed(newSpeed)
  simTimeAuthority.reportSpeed(newSpeed)
end