From b40f27be0274b641c2cddd4c75a6f86f73ea4941 Mon Sep 17 00:00:00 2001 From: Rick Date: Sun, 1 Sep 2024 12:47:48 +0100 Subject: [PATCH] freeroam: fix freezetime flickering #529 (#530) * fix freezetime flickering #529 remove redundant timer and its 3 variables * remove redundant toggle code --- [gameplay]/freeroam/fr_client.lua | 24 +----------------------- 1 file changed, 1 insertion(+), 23 deletions(-) diff --git a/[gameplay]/freeroam/fr_client.lua b/[gameplay]/freeroam/fr_client.lua index 7661a93f4..9cda2b8db 100644 --- a/[gameplay]/freeroam/fr_client.lua +++ b/[gameplay]/freeroam/fr_client.lua @@ -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 @@ -1853,7 +1848,6 @@ function applyTime() local hours, minutes = getControlNumbers(wndTime, { 'hours', 'minutes' }) setTime(hours, minutes) closeWindow(wndTime) - freezeTimeHour, freezeTimeMinute = hours, minutes end wndTime = { @@ -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 @@ -1940,7 +1919,6 @@ function applyWeather(leaf) end setWeather(leaf.id) closeWindow(wndWeather) - freezeTimeWeather = leaf.id end wndWeather = {