Skip to content

Commit 25df8ec

Browse files
committed
Defs
1 parent 695d28b commit 25df8ec

File tree

2 files changed

+18
-5
lines changed

2 files changed

+18
-5
lines changed

Client/mods/deathmatch/logic/luadefs/CLuaWorldDefs.cpp

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1266,14 +1266,27 @@ int CLuaWorldDefs::SetOcclusionsEnabled(lua_State* luaVM)
12661266
return 1;
12671267
}
12681268

1269-
bool CLuaWorldDefs::IsWorldSpecialPropertyEnabled(WorldSpecialProperty property)
1269+
bool CLuaWorldDefs::IsWorldSpecialPropertyEnabled(const WorldSpecialProperty property) noexcept
12701270
{
12711271
return m_pClientGame->IsWorldSpecialProperty(property);
12721272
}
12731273

1274-
bool CLuaWorldDefs::SetWorldSpecialPropertyEnabled(WorldSpecialProperty property, bool isEnabled)
1274+
bool CLuaWorldDefs::SetWorldSpecialPropertyEnabled(const WorldSpecialProperty property, const bool enabled) noexcept
12751275
{
1276-
return m_pClientGame->SetWorldSpecialProperty(property, isEnabled);
1276+
if (!m_pClientGame->SetWorldSpecialProperty(property, enabled))
1277+
return false;
1278+
1279+
if (!g_pNet->CanServerBitStream(eBitStreamVersion::WorldSpecialPropertyEvent))
1280+
return true;
1281+
1282+
if (auto stream = g_pNet->AllocateNetBitStream())
1283+
{
1284+
stream->WriteString(EnumToString(property));
1285+
stream->WriteBit(enabled);
1286+
g_pNet->SendPacket(PACKET_ID_PLAYER_WORLD_SPECIAL_PROPERTY, stream, PACKET_PRIORITY_HIGH, PACKET_RELIABILITY_RELIABLE_ORDERED);
1287+
}
1288+
1289+
return true;
12771290
}
12781291

12791292
int CLuaWorldDefs::SetCloudsEnabled(lua_State* luaVM)

Client/mods/deathmatch/logic/luadefs/CLuaWorldDefs.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ class CLuaWorldDefs : public CLuaDefs
3434
LUA_DECLARE(GetGaragePosition);
3535
LUA_DECLARE(GetGarageSize);
3636
LUA_DECLARE(GetGarageBoundingBox);
37-
static bool IsWorldSpecialPropertyEnabled(WorldSpecialProperty property);
37+
static bool IsWorldSpecialPropertyEnabled(const WorldSpecialProperty property) noexcept;
3838
LUA_DECLARE(GetBlurLevel);
3939
LUA_DECLARE(GetTrafficLightState);
4040
LUA_DECLARE(AreTrafficLightsLocked);
@@ -57,7 +57,7 @@ class CLuaWorldDefs : public CLuaDefs
5757
LUA_DECLARE(SetMinuteDuration);
5858
LUA_DECLARE(SetWaveHeight);
5959
LUA_DECLARE(SetGarageOpen);
60-
static bool SetWorldSpecialPropertyEnabled(WorldSpecialProperty property, bool isEnabled);
60+
static bool SetWorldSpecialPropertyEnabled(const WorldSpecialProperty property, const bool enabled) noexcept;
6161
LUA_DECLARE(SetBlurLevel);
6262
LUA_DECLARE(ResetBlurLevel);
6363
LUA_DECLARE(SetJetpackMaxHeight);

0 commit comments

Comments
 (0)