Skip to content

Commit a5dfc52

Browse files
authored
add setVehicleSmokeTrailEnabled & isVehicleSmokeTrailEnabled function (#3810)
1 parent 792d9aa commit a5dfc52

File tree

2 files changed

+23
-0
lines changed

2 files changed

+23
-0
lines changed

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

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,7 @@ void CLuaVehicleDefs::LoadFunctions()
9292
{"getVehicleModelWheelSize", ArgumentParser<GetVehicleModelWheelSize>},
9393
{"getVehicleWheelFrictionState", ArgumentParser<GetVehicleWheelFrictionState>},
9494
{"getVehicleEntryPoints", ArgumentParser<GetVehicleEntryPoints>},
95+
{"isVehicleSmokeTrailEnabled", ArgumentParser<IsSmokeTrailEnabled>},
9596

9697
// Vehicle set funcs
9798
{"createVehicle", CreateVehicle},
@@ -156,6 +157,7 @@ void CLuaVehicleDefs::LoadFunctions()
156157
{"setVehicleWheelScale", ArgumentParser<SetVehicleWheelScale>},
157158
{"setVehicleModelWheelSize", ArgumentParser<SetVehicleModelWheelSize>},
158159
{"spawnVehicleFlyingComponent", ArgumentParser<SpawnVehicleFlyingComponent>},
160+
{"setVehicleSmokeTrailEnabled", ArgumentParser<SetSmokeTrailEnabled>},
159161
};
160162

161163
// Add functions
@@ -244,6 +246,7 @@ void CLuaVehicleDefs::AddClass(lua_State* luaVM)
244246
lua_classfunction(luaVM, "getModelWheelSize", "getVehicleModelWheelSize");
245247
lua_classfunction(luaVM, "getWheelFrictionState", "getVehicleWheelFrictionState");
246248
lua_classfunction(luaVM, "getEntryPoints", ArgumentParser<OOP_GetVehicleEntryPoints>);
249+
lua_classfunction(luaVM, "isSmokeTrailEnabled", "isVehicleSmokeTrailEnabled");
247250

248251
lua_classfunction(luaVM, "setComponentVisible", "setVehicleComponentVisible");
249252
lua_classfunction(luaVM, "setSirensOn", "setVehicleSirensOn");
@@ -292,6 +295,7 @@ void CLuaVehicleDefs::AddClass(lua_State* luaVM)
292295
lua_classfunction(luaVM, "setVariant", "setVehicleVariant");
293296
lua_classfunction(luaVM, "setWheelScale", "setVehicleWheelScale");
294297
lua_classfunction(luaVM, "setModelWheelSize", "setVehicleModelWheelSize");
298+
lua_classfunction(luaVM, "setSmokeTrailEnabled", "setVehicleSmokeTrailEnabled");
295299

296300
lua_classfunction(luaVM, "resetComponentPosition", "resetVehicleComponentPosition");
297301
lua_classfunction(luaVM, "resetComponentRotation", "resetVehicleComponentRotation");
@@ -4340,3 +4344,19 @@ bool CLuaVehicleDefs::SpawnVehicleFlyingComponent(CClientVehicle* const vehicle,
43404344

43414345
return vehicle->SpawnFlyingComponent(partNodeIndex, collisionType, removalTime.value_or(-1));
43424346
}
4347+
4348+
bool CLuaVehicleDefs::SetSmokeTrailEnabled(CClientVehicle* vehicle, bool state)
4349+
{
4350+
std::uint16_t model = vehicle->GetModel();
4351+
if (model != 512 && model != 513)
4352+
throw LuaFunctionError("Invaild model ID");
4353+
4354+
vehicle->SetSmokeTrailEnabled(state);
4355+
return true;
4356+
}
4357+
4358+
bool CLuaVehicleDefs::IsSmokeTrailEnabled(CClientVehicle* vehicle) noexcept
4359+
{
4360+
return vehicle->IsSmokeTrailEnabled();
4361+
}
4362+

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -181,4 +181,7 @@ class CLuaVehicleDefs : public CLuaDefs
181181
LUA_DECLARE(GetVehicleComponents);
182182

183183
static bool SpawnVehicleFlyingComponent(CClientVehicle* const vehicle, std::uint8_t nodeIndex, std::optional<std::uint8_t> componentCollisionType, std::optional<std::uint32_t> removalTime);
184+
185+
static bool SetSmokeTrailEnabled(CClientVehicle* vehicle, bool state);
186+
static bool IsSmokeTrailEnabled(CClientVehicle* vehicle) noexcept;
184187
};

0 commit comments

Comments
 (0)