@@ -104,6 +104,7 @@ void CLuaWorldDefs::LoadFunctions()
104104 {" removeWorldModel" , RemoveWorldBuilding},
105105 {" restoreAllWorldModels" , RestoreWorldBuildings},
106106 {" restoreWorldModel" , RestoreWorldBuilding},
107+ {" setTimeFrozen" , ArgumentParser<SetTimeFrozen>},
107108
108109 // World create funcs
109110 {" createSWATRope" , CreateSWATRope},
@@ -126,13 +127,15 @@ void CLuaWorldDefs::LoadFunctions()
126127 {" resetMoonSize" , ResetMoonSize},
127128 {" resetBlurLevel" , ResetBlurLevel},
128129 {" resetWorldProperty" , ArgumentParserWarn<false , ResetWorldProperty>},
130+ {" resetTimeFrozen" , ArgumentParser<ResetTimeFrozen>},
129131
130132 // World check funcs
131133 {" areTrafficLightsLocked" , AreTrafficLightsLocked},
132134 {" isPedTargetingMarkerEnabled" , IsPedTargetingMarkerEnabled},
133135 {" isLineOfSightClear" , IsLineOfSightClear},
134136 {" isWorldSpecialPropertyEnabled" , ArgumentParserWarn<false , IsWorldSpecialPropertyEnabled>},
135- {" isGarageOpen" , IsGarageOpen}};
137+ {" isGarageOpen" , IsGarageOpen},
138+ {" isTimeFrozen" , ArgumentParser<IsTimeFrozen>}};
136139
137140 // Add functions
138141 for (const auto & [name, func] : functions)
@@ -2129,33 +2132,14 @@ std::variant<bool, float, CLuaMultiReturn<float, float, float>> CLuaWorldDefs::G
21292132 return g_pGame->GetWeather ()->GetSandstorm ();
21302133 case eWorldProperty::WEATHER_RAINBOW:
21312134 return g_pGame->GetWeather ()->GetRainbow ();
2132- case eWorldProperty::TIME_CYCLE:
2133- return g_pGame->GetClock ()->GetTimerCycleEnabled ();
21342135 }
21352136 return false ;
21362137}
21372138
2138- bool CLuaWorldDefs::SetWorldProperty (eWorldProperty property, std::variant< bool , float > argVariant , std::optional<float > arg2, std::optional<float > arg3)
2139+ bool CLuaWorldDefs::SetWorldProperty (eWorldProperty property, float arg1 , std::optional<float > arg2, std::optional<float > arg3)
21392140{
2140- float arg1;
2141- bool argBool;
2142-
2143- if (std::holds_alternative<float >(argVariant))
2144- {
2145- arg1 = std::get<float >(argVariant);
2146- }
2147- else if (std::holds_alternative<bool >(argVariant))
2148- {
2149- argBool = std::get<bool >(argVariant);
2150- }
2151- else
2152- {
2153- return false ; // in case the type is invalid
2154- }
2155-
21562141 if (arg2.has_value () && arg3.has_value ())
21572142 {
2158-
21592143 switch (property)
21602144 {
21612145 case eWorldProperty::AMBIENT_COLOR:
@@ -2203,8 +2187,6 @@ bool CLuaWorldDefs::SetWorldProperty(eWorldProperty property, std::variant<bool,
22032187 return g_pGame->GetWeather ()->SetSandstorm (arg1);
22042188 case eWorldProperty::WEATHER_RAINBOW:
22052189 return g_pGame->GetWeather ()->SetRainbow (arg1);
2206- case eWorldProperty::TIME_CYCLE:
2207- return g_pGame->GetClock ()->SetTimerCycle (argBool);
22082190 }
22092191 return false ;
22102192}
@@ -2253,8 +2235,21 @@ bool CLuaWorldDefs::ResetWorldProperty(eWorldProperty property)
22532235 return g_pGame->GetWeather ()->ResetSandstorm ();
22542236 case eWorldProperty::WEATHER_RAINBOW:
22552237 return g_pGame->GetWeather ()->ResetRainbow ();
2256- case eWorldProperty::TIME_CYCLE:
2257- return g_pGame->GetClock ()->ResetTimerCycle ();
22582238 }
22592239 return false ;
22602240}
2241+
2242+ bool CLuaWorldDefs::SetTimeFrozen (bool value) noexcept
2243+ {
2244+ return g_pGame->GetClock ()->SetTimerCycle (value);
2245+ }
2246+
2247+ bool CLuaWorldDefs::IsTimeFrozen () noexcept
2248+ {
2249+ return g_pGame->GetClock ()->GetTimerCycleEnabled ();
2250+ }
2251+
2252+ bool CLuaWorldDefs::ResetTimeFrozen () noexcept
2253+ {
2254+ return g_pGame->GetClock ()->ResetTimerCycle ();
2255+ }
0 commit comments