Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions Client/mods/deathmatch/logic/lua/CLuaFunctionDefs.World.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1416,14 +1416,17 @@ int CLuaFunctionDefs::GetRainLevel ( lua_State* luaVM )
int CLuaFunctionDefs::SetRainLevel ( lua_State* luaVM )
{
// bool setRainLevel ( float amount )
float fAmount;
float fRainLevel;

CScriptArgReader argStream ( luaVM );
argStream.ReadNumber ( fAmount );
argStream.ReadNumber ( fRainLevel );

if ( !argStream.HasErrors () )
{
g_pGame->GetWeather ()->SetAmountOfRain ( fAmount );
// Clamp amount of rain to avoid game freezing/crash
fRainLevel = Clamp( 0.0f, fRainLevel, 10.0f );

g_pGame->GetWeather ()->SetAmountOfRain ( fRainLevel );

lua_pushboolean ( luaVM, true );
return 1;
Expand Down
3 changes: 3 additions & 0 deletions Server/mods/deathmatch/logic/luadefs/CLuaWorldDefs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -849,6 +849,9 @@ int CLuaWorldDefs::setRainLevel ( lua_State* luaVM )

if ( !argStream.HasErrors ( ) )
{
// Clamp amount of rain to avoid game freezing/crash
fRainLevel = Clamp( 0.0f, fRainLevel, 10.0f );

if ( CStaticFunctionDefinitions::SetRainLevel ( fRainLevel ) )
{
lua_pushboolean ( luaVM, true );
Expand Down