From 82c877a0678512459b2a6c1452663b1286241013 Mon Sep 17 00:00:00 2001 From: xThrasherrr Date: Fri, 27 Sep 2024 21:44:40 -0600 Subject: [PATCH] feat(weather): add state for individual player weather - Adds `playerWeather` state to the player to utilize when `syncWeather` is disabled on a player. Allowing modification of the weather to override to, falling back to `EXTRASUNNY` if the state doesn't exist --- client/weather.lua | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/client/weather.lua b/client/weather.lua index 54a2866..5db11b1 100644 --- a/client/weather.lua +++ b/client/weather.lua @@ -95,6 +95,7 @@ CreateThread(function () setWeather(true) playerState.syncWeather = true + playerState.playerWeather = 'EXTRASUNNY' end) AddStateBagChangeHandler('syncWeather', ('player:%s'):format(cache.serverId), function(_, _, value) @@ -102,10 +103,11 @@ AddStateBagChangeHandler('syncWeather', ('player:%s'):format(cache.serverId), fu SetTimeout(0, function() resetWeatherParticles() while not playerState.syncWeather do + local setWeather = playerState.playerWeather or 'EXTRASUNNY' SetRainLevel(0.0) - SetWeatherTypePersist('EXTRASUNNY') - SetWeatherTypeNow('EXTRASUNNY') - SetWeatherTypeNowPersist('EXTRASUNNY') + SetWeatherTypePersist(setWeather) + SetWeatherTypeNow(setWeather) + SetWeatherTypeNowPersist(setWeather) Wait(2500) end end)