GE Lua Documentation

Press F to search!

pauseSmooth

Definition


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

local function pauseSmooth(paused, rateLimit, startAccel, stopAccel, playPauseSound)
  if playPauseSound == nil then playPauseSound = true end
  extensions.hook("simTimePauseCalled", paused)
  if core_replay.state.state == "playback" then
    core_replay.pause(paused)
  else
    if paused == getPause() and not pauseTransition then return end
    mrateLimit, mstartAccel, mstopAccel = rateLimit, startAccel, stopAccel
    updateDispatch = updateFct

    if paused then
      if not pauseTransition then
        initialTimeScale = M.simulationSpeed -- backup the original physics scale
      end
      M.simulationSpeed = 0
      if playPauseSound then
        Engine.Audio.playOnce('AudioGui', 'event:>UI>Main>Pause')
      end
    else
      M.simulationSpeed = initialTimeScale
      if getPause() then
        simulationSpeed_smooth:set(0)
        be:setEnabled(true)
        physicsStateChanged(true)
      end
    end
    pauseTransition = true
  end
end

Callers

@/lua/ge/extensions/freeroam/crashCamMode.lua
    if wasCrashCamActive then
      simTimeAuthority.pauseSmooth(false)
      if previousSimSpeed and simTimeAuthority.get() ~= previousSimSpeed then
  ui_visibility.set(false)
  simTimeAuthority.pauseSmooth(true, nil, nil, nil, false)
  startPathTimer = startPathTimer or 0
  initData.finishedPath = function()
    simTimeAuthority.pauseSmooth(false)
    toggleActionCam(false)