Skip to content

Commit

Permalink
freeroam: fix freezetime flickering multitheftauto#529 (multitheftaut…
Browse files Browse the repository at this point in the history
…o#530)

* fix freezetime flickering multitheftauto#529

remove redundant timer and its 3 variables

* remove redundant toggle code
  • Loading branch information
ricksterhd123 authored Sep 1, 2024
1 parent 80d98fd commit b40f27b
Showing 1 changed file with 1 addition and 23 deletions.
24 changes: 1 addition & 23 deletions [gameplay]/freeroam/fr_client.lua
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,6 @@ if not (g_PlayerData) then
g_PlayerData = {}
end

-- Variables for time freeze
local freezeTimeHour = false
local freezeTimeMinute = false
local freezeTimeWeather = false

-- Settings are stored in meta.xml
function freeroamSettings(settings)
if settings then
Expand Down Expand Up @@ -1853,7 +1848,6 @@ function applyTime()
local hours, minutes = getControlNumbers(wndTime, { 'hours', 'minutes' })
setTime(hours, minutes)
closeWindow(wndTime)
freezeTimeHour, freezeTimeMinute = hours, minutes
end

wndTime = {
Expand Down Expand Up @@ -1905,25 +1899,10 @@ addCommandHandler('st', setTimeCommand)

function toggleFreezeTime()
local state = guiCheckBoxGetSelected(getControl(wndMain, 'freezetime'))
guiCheckBoxSetSelected(getControl(wndMain, 'freezetime'), not state)
freezeTimeHour, freezeTimeMinute = getTime()
freezeTimeWeather = getWeather()
setTimeFrozen(state)
end

function setTimeFrozen(state)
guiCheckBoxSetSelected(getControl(wndMain, 'freezetime'), state)

if state then
if not g_TimeFreezeTimer then
g_TimeFreezeTimer = setTimer(function() setTime(freezeTimeHour, freezeTimeMinute) setWeather(freezeTimeWeather) end, 5000, 0)
setMinuteDuration(9001)
end
setMinuteDuration(2147483647)
else
if g_TimeFreezeTimer then
killTimer(g_TimeFreezeTimer)
g_TimeFreezeTimer = nil
end
setMinuteDuration(1000)
end
end
Expand All @@ -1940,7 +1919,6 @@ function applyWeather(leaf)
end
setWeather(leaf.id)
closeWindow(wndWeather)
freezeTimeWeather = leaf.id
end

wndWeather = {
Expand Down

0 comments on commit b40f27b

Please sign in to comment.