Skip to content

Commit 48c0ecc

Browse files
committed
Requested changes
1 parent 9541040 commit 48c0ecc

File tree

4 files changed

+11
-25
lines changed

4 files changed

+11
-25
lines changed

Client/mods/deathmatch/logic/rpc/CVehicleRPCs.cpp

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -701,9 +701,5 @@ void CVehicleRPCs::SetVehicleSmokeTrailEnabled(CClientEntity* pSourceEntity, Net
701701
if (!vehicle)
702702
return;
703703

704-
std::uint16_t model = vehicle->GetModel();
705-
if (model != 512 && model != 513)
706-
return;
707-
708704
vehicle->SetSmokeTrailEnabled(state);
709705
}

Server/mods/deathmatch/logic/CStaticFunctionDefinitions.cpp

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12668,8 +12668,3 @@ bool CStaticFunctionDefinitions::SpawnVehicleFlyingComponent(CVehicle* const veh
1266812668

1266912669
return true;
1267012670
}
12671-
12672-
bool CStaticFunctionDefinitions::IsVehicleSmokeTrailEnabled(CVehicle* const vehicle)
12673-
{
12674-
return vehicle->IsSmokeTrailEnabled();
12675-
}

Server/mods/deathmatch/logic/luadefs/CLuaVehicleDefs.cpp

Lines changed: 9 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ void CLuaVehicleDefs::LoadFunctions()
6969
{"isVehicleBlown", ArgumentParserWarn<false, IsVehicleBlown>},
7070
{"getVehicleHeadLightColor", GetVehicleHeadLightColor},
7171
{"getVehicleDoorOpenRatio", GetVehicleDoorOpenRatio},
72-
{"isVehicleSmokeTrailEnabled", IsVehicleSmokeTrailEnabled},
72+
{"isVehicleSmokeTrailEnabled", ArgumentParser<IsVehicleSmokeTrailEnabled>},
7373

7474
// Vehicle set funcs
7575
{"fixVehicle", FixVehicle},
@@ -3067,25 +3067,20 @@ bool CLuaVehicleDefs::SetVehicleNitroActivated(CVehicle* vehicle, bool state) no
30673067

30683068
bool CLuaVehicleDefs::SetVehicleSmokeTrailEnabled(CVehicle* vehicle, bool state)
30693069
{
3070+
std::uint16_t model = vehicle->GetModel();
3071+
if (model != 512 && model != 513)
3072+
return false;
3073+
3074+
vehicle->SetSmokeTrailEnabled(state);
3075+
30703076
CBitStream BitStream;
30713077
BitStream.pBitStream->WriteBit(state);
30723078

30733079
m_pPlayerManager->BroadcastOnlyJoined(CElementRPCPacket(vehicle, SET_VEHICLE_SMOKE_TRAIL_ENABLED, *BitStream.pBitStream));
30743080
return true;
30753081
}
30763082

3077-
int CLuaVehicleDefs::IsVehicleSmokeTrailEnabled(lua_State* luaVM)
3083+
bool CLuaVehicleDefs::IsVehicleSmokeTrailEnabled(CVehicle* vehicle)
30783084
{
3079-
CVehicle* pVehicle;
3080-
CScriptArgReader argStream(luaVM);
3081-
argStream.ReadUserData(pVehicle);
3082-
if (!argStream.HasErrors())
3083-
{
3084-
lua_pushboolean(luaVM, CStaticFunctionDefinitions::IsVehicleSmokeTrailEnabled(pVehicle));
3085-
return 1;
3086-
}
3087-
else
3088-
m_pScriptDebugging->LogCustom(luaVM, argStream.GetFullErrorMessage());
3089-
lua_pushboolean(luaVM, false);
3090-
return 1;
3085+
return vehicle->IsSmokeTrailEnabled();
30913086
}

Server/mods/deathmatch/logic/luadefs/CLuaVehicleDefs.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,6 @@ class CLuaVehicleDefs : public CLuaDefs
6767
static bool IsVehicleBlown(CVehicle* vehicle);
6868
LUA_DECLARE(GetVehicleHeadLightColor);
6969
LUA_DECLARE(GetVehicleDoorOpenRatio);
70-
LUA_DECLARE(IsVehicleSmokeTrailEnabled);
7170

7271
// Vehicle set functions
7372
LUA_DECLARE(FixVehicle);
@@ -129,5 +128,6 @@ class CLuaVehicleDefs : public CLuaDefs
129128

130129
static bool SpawnVehicleFlyingComponent(CVehicle* const vehicle, std::uint8_t nodeIndex, std::optional<std::uint8_t> componentCollisionType, std::optional<std::uint32_t> removalTime);
131130
static bool SetVehicleNitroActivated(CVehicle* vehicle, bool state) noexcept;
132-
static bool SetVehicleSmokeTrailEnabled(CVehicle* vehicle, bool state) noexcept;
131+
static bool SetVehicleSmokeTrailEnabled(CVehicle* vehicle, bool state);
132+
static bool IsVehicleSmokeTrailEnabled(CVehicle* vehicle);
133133
};

0 commit comments

Comments
 (0)