From d1db22e64e318825521c84f7d04c8384197a6ea0 Mon Sep 17 00:00:00 2001 From: Proxy-99 <77501848+Proxy-99@users.noreply.github.com> Date: Fri, 18 Oct 2024 00:31:41 +0300 Subject: [PATCH 01/10] plane trail enabled --- Client/game_sa/CVehicleSA.cpp | 11 +++++++++++ Client/game_sa/CVehicleSA.h | 2 ++ Client/mods/deathmatch/logic/CClientVehicle.cpp | 6 ++++++ Client/mods/deathmatch/logic/CClientVehicle.h | 2 ++ .../mods/deathmatch/logic/luadefs/CLuaVehicleDefs.cpp | 11 +++++++++++ .../mods/deathmatch/logic/luadefs/CLuaVehicleDefs.h | 2 ++ Client/sdk/game/CVehicle.h | 1 + 7 files changed, 35 insertions(+) diff --git a/Client/game_sa/CVehicleSA.cpp b/Client/game_sa/CVehicleSA.cpp index b4e7a2c4387..5eb43990dd5 100644 --- a/Client/game_sa/CVehicleSA.cpp +++ b/Client/game_sa/CVehicleSA.cpp @@ -2343,3 +2343,14 @@ bool CVehicleSA::SetWindowOpenFlagState(unsigned char ucWindow, bool bState) } return bReturn; } + + +bool CVehicleSA::SetSmoke(bool state) +{ + auto pInterface = static_cast(GetInterface()); + + pInterface->m_bSmokeEjectorEnabled = state; + + return true; +} + diff --git a/Client/game_sa/CVehicleSA.h b/Client/game_sa/CVehicleSA.h index 9674a165cde..2c4de01fd5c 100644 --- a/Client/game_sa/CVehicleSA.h +++ b/Client/game_sa/CVehicleSA.h @@ -692,6 +692,8 @@ class CVehicleSA : public virtual CVehicle, public virtual CPhysicalSA static void SetVehiclesSunGlareEnabled(bool bEnabled); static bool GetVehiclesSunGlareEnabled(); + bool SetSmoke(bool state); + private: static void SetAutomobileDummyPosition(CAutomobileSAInterface* automobile, eVehicleDummies dummy, const CVector& position); diff --git a/Client/mods/deathmatch/logic/CClientVehicle.cpp b/Client/mods/deathmatch/logic/CClientVehicle.cpp index 537f9457dd0..e516bcd5331 100644 --- a/Client/mods/deathmatch/logic/CClientVehicle.cpp +++ b/Client/mods/deathmatch/logic/CClientVehicle.cpp @@ -1615,6 +1615,12 @@ bool CClientVehicle::SetRotorSpeed(float fSpeed) } } +bool CClientVehicle::SetPlaneSmoke(bool state) +{ + if (m_pVehicle && m_eVehicleType == CLIENTVEHICLE_PLANE) + return m_pVehicle->SetSmoke(state); +} + bool CClientVehicle::SetWheelsRotation(float fRot1, float fRot2, float fRot3, float fRot4) noexcept { if (!m_pVehicle) diff --git a/Client/mods/deathmatch/logic/CClientVehicle.h b/Client/mods/deathmatch/logic/CClientVehicle.h index 76ec08eff10..d00a6f89f4e 100644 --- a/Client/mods/deathmatch/logic/CClientVehicle.h +++ b/Client/mods/deathmatch/logic/CClientVehicle.h @@ -547,6 +547,8 @@ class CClientVehicle : public CClientStreamElement CVector GetEntryPoint(std::uint32_t entryPointIndex); + bool SetPlaneSmoke(bool state); + protected: void ConvertComponentRotationBase(const SString& vehicleComponent, CVector& vecInOutRotation, EComponentBaseType inputBase, EComponentBaseType outputBase); void ConvertComponentPositionBase(const SString& vehicleComponent, CVector& vecInOutPosition, EComponentBaseType inputBase, EComponentBaseType outputBase); diff --git a/Client/mods/deathmatch/logic/luadefs/CLuaVehicleDefs.cpp b/Client/mods/deathmatch/logic/luadefs/CLuaVehicleDefs.cpp index 6ac42bf386c..598ec8ca05e 100644 --- a/Client/mods/deathmatch/logic/luadefs/CLuaVehicleDefs.cpp +++ b/Client/mods/deathmatch/logic/luadefs/CLuaVehicleDefs.cpp @@ -156,6 +156,7 @@ void CLuaVehicleDefs::LoadFunctions() {"setVehicleWheelScale", ArgumentParser}, {"setVehicleModelWheelSize", ArgumentParser}, {"spawnVehicleFlyingComponent", ArgumentParser}, + {"setPlaneTrailEnabled", ArgumentParser}, }; // Add functions @@ -4340,3 +4341,13 @@ bool CLuaVehicleDefs::SpawnVehicleFlyingComponent(CClientVehicle* const vehicle, return vehicle->SpawnFlyingComponent(partNodeIndex, collisionType, removalTime.value_or(-1)); } + +bool CLuaVehicleDefs::SetPlaneSmoke(CClientVehicle* vehicle, bool state) +{ + + if (vehicle->GetModel() == 512 || vehicle->GetModel() == 513) // Support Cropduster and Stuntplane + { + return vehicle->SetPlaneSmoke(state); + } + return false; +} diff --git a/Client/mods/deathmatch/logic/luadefs/CLuaVehicleDefs.h b/Client/mods/deathmatch/logic/luadefs/CLuaVehicleDefs.h index 28c2f5e372a..0ae00663383 100644 --- a/Client/mods/deathmatch/logic/luadefs/CLuaVehicleDefs.h +++ b/Client/mods/deathmatch/logic/luadefs/CLuaVehicleDefs.h @@ -181,4 +181,6 @@ class CLuaVehicleDefs : public CLuaDefs LUA_DECLARE(GetVehicleComponents); static bool SpawnVehicleFlyingComponent(CClientVehicle* const vehicle, std::uint8_t nodeIndex, std::optional componentCollisionType, std::optional removalTime); + + static bool SetPlaneSmoke(CClientVehicle* vehicle, bool state); }; diff --git a/Client/sdk/game/CVehicle.h b/Client/sdk/game/CVehicle.h index a5a4f1cdd43..6feca302f60 100644 --- a/Client/sdk/game/CVehicle.h +++ b/Client/sdk/game/CVehicle.h @@ -221,6 +221,7 @@ class CVehicle : public virtual CPhysical virtual void SetAdjustablePropertyValue(unsigned short usAdjustableProperty) = 0; virtual void SetHeliRotorSpeed(float fSpeed) = 0; virtual void SetPlaneRotorSpeed(float fSpeed) = 0; + virtual bool SetSmoke(bool state) = 0; virtual bool SetVehicleWheelRotation(float fRot1, float fRot2, float fRot3, float fRot4) noexcept = 0; virtual void SetTaxiLightOn(bool bLightState) = 0; virtual void SetExplodeTime(unsigned long ulTime) = 0; From 7b44e8f37fc1dbd6595a000c84bc1bdb0753ec0c Mon Sep 17 00:00:00 2001 From: Proxy-99 <77501848+Proxy-99@users.noreply.github.com> Date: Fri, 18 Oct 2024 02:48:55 +0300 Subject: [PATCH 02/10] Revert "plane trail enabled" This reverts commit d1db22e64e318825521c84f7d04c8384197a6ea0. --- Client/game_sa/CVehicleSA.cpp | 11 ----------- Client/game_sa/CVehicleSA.h | 2 -- Client/mods/deathmatch/logic/CClientVehicle.cpp | 6 ------ Client/mods/deathmatch/logic/CClientVehicle.h | 2 -- .../mods/deathmatch/logic/luadefs/CLuaVehicleDefs.cpp | 11 ----------- .../mods/deathmatch/logic/luadefs/CLuaVehicleDefs.h | 2 -- Client/sdk/game/CVehicle.h | 1 - 7 files changed, 35 deletions(-) diff --git a/Client/game_sa/CVehicleSA.cpp b/Client/game_sa/CVehicleSA.cpp index 5eb43990dd5..b4e7a2c4387 100644 --- a/Client/game_sa/CVehicleSA.cpp +++ b/Client/game_sa/CVehicleSA.cpp @@ -2343,14 +2343,3 @@ bool CVehicleSA::SetWindowOpenFlagState(unsigned char ucWindow, bool bState) } return bReturn; } - - -bool CVehicleSA::SetSmoke(bool state) -{ - auto pInterface = static_cast(GetInterface()); - - pInterface->m_bSmokeEjectorEnabled = state; - - return true; -} - diff --git a/Client/game_sa/CVehicleSA.h b/Client/game_sa/CVehicleSA.h index 2c4de01fd5c..9674a165cde 100644 --- a/Client/game_sa/CVehicleSA.h +++ b/Client/game_sa/CVehicleSA.h @@ -692,8 +692,6 @@ class CVehicleSA : public virtual CVehicle, public virtual CPhysicalSA static void SetVehiclesSunGlareEnabled(bool bEnabled); static bool GetVehiclesSunGlareEnabled(); - bool SetSmoke(bool state); - private: static void SetAutomobileDummyPosition(CAutomobileSAInterface* automobile, eVehicleDummies dummy, const CVector& position); diff --git a/Client/mods/deathmatch/logic/CClientVehicle.cpp b/Client/mods/deathmatch/logic/CClientVehicle.cpp index e516bcd5331..537f9457dd0 100644 --- a/Client/mods/deathmatch/logic/CClientVehicle.cpp +++ b/Client/mods/deathmatch/logic/CClientVehicle.cpp @@ -1615,12 +1615,6 @@ bool CClientVehicle::SetRotorSpeed(float fSpeed) } } -bool CClientVehicle::SetPlaneSmoke(bool state) -{ - if (m_pVehicle && m_eVehicleType == CLIENTVEHICLE_PLANE) - return m_pVehicle->SetSmoke(state); -} - bool CClientVehicle::SetWheelsRotation(float fRot1, float fRot2, float fRot3, float fRot4) noexcept { if (!m_pVehicle) diff --git a/Client/mods/deathmatch/logic/CClientVehicle.h b/Client/mods/deathmatch/logic/CClientVehicle.h index d00a6f89f4e..76ec08eff10 100644 --- a/Client/mods/deathmatch/logic/CClientVehicle.h +++ b/Client/mods/deathmatch/logic/CClientVehicle.h @@ -547,8 +547,6 @@ class CClientVehicle : public CClientStreamElement CVector GetEntryPoint(std::uint32_t entryPointIndex); - bool SetPlaneSmoke(bool state); - protected: void ConvertComponentRotationBase(const SString& vehicleComponent, CVector& vecInOutRotation, EComponentBaseType inputBase, EComponentBaseType outputBase); void ConvertComponentPositionBase(const SString& vehicleComponent, CVector& vecInOutPosition, EComponentBaseType inputBase, EComponentBaseType outputBase); diff --git a/Client/mods/deathmatch/logic/luadefs/CLuaVehicleDefs.cpp b/Client/mods/deathmatch/logic/luadefs/CLuaVehicleDefs.cpp index 598ec8ca05e..6ac42bf386c 100644 --- a/Client/mods/deathmatch/logic/luadefs/CLuaVehicleDefs.cpp +++ b/Client/mods/deathmatch/logic/luadefs/CLuaVehicleDefs.cpp @@ -156,7 +156,6 @@ void CLuaVehicleDefs::LoadFunctions() {"setVehicleWheelScale", ArgumentParser}, {"setVehicleModelWheelSize", ArgumentParser}, {"spawnVehicleFlyingComponent", ArgumentParser}, - {"setPlaneTrailEnabled", ArgumentParser}, }; // Add functions @@ -4341,13 +4340,3 @@ bool CLuaVehicleDefs::SpawnVehicleFlyingComponent(CClientVehicle* const vehicle, return vehicle->SpawnFlyingComponent(partNodeIndex, collisionType, removalTime.value_or(-1)); } - -bool CLuaVehicleDefs::SetPlaneSmoke(CClientVehicle* vehicle, bool state) -{ - - if (vehicle->GetModel() == 512 || vehicle->GetModel() == 513) // Support Cropduster and Stuntplane - { - return vehicle->SetPlaneSmoke(state); - } - return false; -} diff --git a/Client/mods/deathmatch/logic/luadefs/CLuaVehicleDefs.h b/Client/mods/deathmatch/logic/luadefs/CLuaVehicleDefs.h index 0ae00663383..28c2f5e372a 100644 --- a/Client/mods/deathmatch/logic/luadefs/CLuaVehicleDefs.h +++ b/Client/mods/deathmatch/logic/luadefs/CLuaVehicleDefs.h @@ -181,6 +181,4 @@ class CLuaVehicleDefs : public CLuaDefs LUA_DECLARE(GetVehicleComponents); static bool SpawnVehicleFlyingComponent(CClientVehicle* const vehicle, std::uint8_t nodeIndex, std::optional componentCollisionType, std::optional removalTime); - - static bool SetPlaneSmoke(CClientVehicle* vehicle, bool state); }; diff --git a/Client/sdk/game/CVehicle.h b/Client/sdk/game/CVehicle.h index 6feca302f60..a5a4f1cdd43 100644 --- a/Client/sdk/game/CVehicle.h +++ b/Client/sdk/game/CVehicle.h @@ -221,7 +221,6 @@ class CVehicle : public virtual CPhysical virtual void SetAdjustablePropertyValue(unsigned short usAdjustableProperty) = 0; virtual void SetHeliRotorSpeed(float fSpeed) = 0; virtual void SetPlaneRotorSpeed(float fSpeed) = 0; - virtual bool SetSmoke(bool state) = 0; virtual bool SetVehicleWheelRotation(float fRot1, float fRot2, float fRot3, float fRot4) noexcept = 0; virtual void SetTaxiLightOn(bool bLightState) = 0; virtual void SetExplodeTime(unsigned long ulTime) = 0; From ecf5afef7890e49305e55a15f7ba2adf31d6a5aa Mon Sep 17 00:00:00 2001 From: Proxy-99 <77501848+Proxy-99@users.noreply.github.com> Date: Fri, 18 Oct 2024 02:58:35 +0300 Subject: [PATCH 03/10] use functions that exist --- .../logic/luadefs/CLuaVehicleDefs.cpp | 18 ++++++++++++++++++ .../deathmatch/logic/luadefs/CLuaVehicleDefs.h | 3 +++ 2 files changed, 21 insertions(+) diff --git a/Client/mods/deathmatch/logic/luadefs/CLuaVehicleDefs.cpp b/Client/mods/deathmatch/logic/luadefs/CLuaVehicleDefs.cpp index 6ac42bf386c..2e47ebbcfb3 100644 --- a/Client/mods/deathmatch/logic/luadefs/CLuaVehicleDefs.cpp +++ b/Client/mods/deathmatch/logic/luadefs/CLuaVehicleDefs.cpp @@ -156,6 +156,8 @@ void CLuaVehicleDefs::LoadFunctions() {"setVehicleWheelScale", ArgumentParser}, {"setVehicleModelWheelSize", ArgumentParser}, {"spawnVehicleFlyingComponent", ArgumentParser}, + {"setPlaneTrailEnabled", ArgumentParser}, + {"IsPlaneTrailEnabled", ArgumentParser}, }; // Add functions @@ -4340,3 +4342,19 @@ bool CLuaVehicleDefs::SpawnVehicleFlyingComponent(CClientVehicle* const vehicle, return vehicle->SpawnFlyingComponent(partNodeIndex, collisionType, removalTime.value_or(-1)); } + +bool CLuaVehicleDefs::SetSmokeTrailEnabled(CClientVehicle* vehicle, bool state) noexcept +{ + if (vehicle->GetModel() == 512 || vehicle->GetModel() == 513) // Support Cropduster and Stuntplane + { + vehicle->SetSmokeTrailEnabled(state); + return true; + } + return false; +} + +bool CLuaVehicleDefs::IsSmokeTrailEnabled(CClientVehicle* vehicle) noexcept +{ + return vehicle->IsSmokeTrailEnabled(); +} + diff --git a/Client/mods/deathmatch/logic/luadefs/CLuaVehicleDefs.h b/Client/mods/deathmatch/logic/luadefs/CLuaVehicleDefs.h index 28c2f5e372a..474799217e4 100644 --- a/Client/mods/deathmatch/logic/luadefs/CLuaVehicleDefs.h +++ b/Client/mods/deathmatch/logic/luadefs/CLuaVehicleDefs.h @@ -181,4 +181,7 @@ class CLuaVehicleDefs : public CLuaDefs LUA_DECLARE(GetVehicleComponents); static bool SpawnVehicleFlyingComponent(CClientVehicle* const vehicle, std::uint8_t nodeIndex, std::optional componentCollisionType, std::optional removalTime); + + static bool SetSmokeTrailEnabled(CClientVehicle* vehicle, bool state) noexcept; + static bool IsSmokeTrailEnabled(CClientVehicle* vehicle) noexcept; }; From 5a8d353d867273a5659bb13c2da3c76268679ae0 Mon Sep 17 00:00:00 2001 From: Proxy-99 <77501848+Proxy-99@users.noreply.github.com> Date: Fri, 18 Oct 2024 03:00:28 +0300 Subject: [PATCH 04/10] typo fix and move above --- Client/mods/deathmatch/logic/luadefs/CLuaVehicleDefs.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Client/mods/deathmatch/logic/luadefs/CLuaVehicleDefs.cpp b/Client/mods/deathmatch/logic/luadefs/CLuaVehicleDefs.cpp index 2e47ebbcfb3..b3b5e1c2769 100644 --- a/Client/mods/deathmatch/logic/luadefs/CLuaVehicleDefs.cpp +++ b/Client/mods/deathmatch/logic/luadefs/CLuaVehicleDefs.cpp @@ -92,6 +92,7 @@ void CLuaVehicleDefs::LoadFunctions() {"getVehicleModelWheelSize", ArgumentParser}, {"getVehicleWheelFrictionState", ArgumentParser}, {"getVehicleEntryPoints", ArgumentParser}, + {"isPlaneTrailEnabled", ArgumentParser}, // Vehicle set funcs {"createVehicle", CreateVehicle}, @@ -157,7 +158,6 @@ void CLuaVehicleDefs::LoadFunctions() {"setVehicleModelWheelSize", ArgumentParser}, {"spawnVehicleFlyingComponent", ArgumentParser}, {"setPlaneTrailEnabled", ArgumentParser}, - {"IsPlaneTrailEnabled", ArgumentParser}, }; // Add functions From d25e200b679383c2ac7d67c82816da917ddd0d8f Mon Sep 17 00:00:00 2001 From: Proxy-99 <77501848+Proxy-99@users.noreply.github.com> Date: Fri, 18 Oct 2024 14:49:32 +0300 Subject: [PATCH 05/10] review --- Client/mods/deathmatch/logic/luadefs/CLuaVehicleDefs.cpp | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/Client/mods/deathmatch/logic/luadefs/CLuaVehicleDefs.cpp b/Client/mods/deathmatch/logic/luadefs/CLuaVehicleDefs.cpp index b3b5e1c2769..c68949256da 100644 --- a/Client/mods/deathmatch/logic/luadefs/CLuaVehicleDefs.cpp +++ b/Client/mods/deathmatch/logic/luadefs/CLuaVehicleDefs.cpp @@ -4345,12 +4345,11 @@ bool CLuaVehicleDefs::SpawnVehicleFlyingComponent(CClientVehicle* const vehicle, bool CLuaVehicleDefs::SetSmokeTrailEnabled(CClientVehicle* vehicle, bool state) noexcept { - if (vehicle->GetModel() == 512 || vehicle->GetModel() == 513) // Support Cropduster and Stuntplane - { - vehicle->SetSmokeTrailEnabled(state); - return true; - } + auto model = vehicle->GetModel(); + if (model != 512 && model != 513) return false; + vehicle->SetSmokeTrailEnabled(state); + return true; } bool CLuaVehicleDefs::IsSmokeTrailEnabled(CClientVehicle* vehicle) noexcept From 6bfe7584c3d8a1973617d7a0cf134db6805b2a3a Mon Sep 17 00:00:00 2001 From: Proxy-99 <77501848+Proxy-99@users.noreply.github.com> Date: Fri, 18 Oct 2024 15:51:27 +0300 Subject: [PATCH 06/10] line --- Client/mods/deathmatch/logic/luadefs/CLuaVehicleDefs.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/Client/mods/deathmatch/logic/luadefs/CLuaVehicleDefs.cpp b/Client/mods/deathmatch/logic/luadefs/CLuaVehicleDefs.cpp index c68949256da..45e3bd75226 100644 --- a/Client/mods/deathmatch/logic/luadefs/CLuaVehicleDefs.cpp +++ b/Client/mods/deathmatch/logic/luadefs/CLuaVehicleDefs.cpp @@ -4348,6 +4348,7 @@ bool CLuaVehicleDefs::SetSmokeTrailEnabled(CClientVehicle* vehicle, bool state) auto model = vehicle->GetModel(); if (model != 512 && model != 513) return false; + vehicle->SetSmokeTrailEnabled(state); return true; } From 55b2af13d04273993a106c8e4b55640a8a5f85fa Mon Sep 17 00:00:00 2001 From: Proxy-99 <77501848+Proxy-99@users.noreply.github.com> Date: Fri, 18 Oct 2024 16:31:22 +0300 Subject: [PATCH 07/10] declare type --- Client/mods/deathmatch/logic/luadefs/CLuaVehicleDefs.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Client/mods/deathmatch/logic/luadefs/CLuaVehicleDefs.cpp b/Client/mods/deathmatch/logic/luadefs/CLuaVehicleDefs.cpp index 45e3bd75226..32036d3e95f 100644 --- a/Client/mods/deathmatch/logic/luadefs/CLuaVehicleDefs.cpp +++ b/Client/mods/deathmatch/logic/luadefs/CLuaVehicleDefs.cpp @@ -4345,7 +4345,7 @@ bool CLuaVehicleDefs::SpawnVehicleFlyingComponent(CClientVehicle* const vehicle, bool CLuaVehicleDefs::SetSmokeTrailEnabled(CClientVehicle* vehicle, bool state) noexcept { - auto model = vehicle->GetModel(); + std::uint16_t model = vehicle->GetModel(); if (model != 512 && model != 513) return false; From 5050df6ce565c79a0935ce0e2bd88265cb7b975e Mon Sep 17 00:00:00 2001 From: Proxy-99 <77501848+Proxy-99@users.noreply.github.com> Date: Sat, 19 Oct 2024 00:51:30 +0300 Subject: [PATCH 08/10] review --- Client/mods/deathmatch/logic/luadefs/CLuaVehicleDefs.cpp | 9 ++++++--- Client/mods/deathmatch/logic/luadefs/CLuaVehicleDefs.h | 2 +- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/Client/mods/deathmatch/logic/luadefs/CLuaVehicleDefs.cpp b/Client/mods/deathmatch/logic/luadefs/CLuaVehicleDefs.cpp index 32036d3e95f..3f63be62a05 100644 --- a/Client/mods/deathmatch/logic/luadefs/CLuaVehicleDefs.cpp +++ b/Client/mods/deathmatch/logic/luadefs/CLuaVehicleDefs.cpp @@ -246,6 +246,7 @@ void CLuaVehicleDefs::AddClass(lua_State* luaVM) lua_classfunction(luaVM, "getModelWheelSize", "getVehicleModelWheelSize"); lua_classfunction(luaVM, "getWheelFrictionState", "getVehicleWheelFrictionState"); lua_classfunction(luaVM, "getEntryPoints", ArgumentParser); + lua_classfunction(luaVM, "isTrailEnabled", "isPlaneTrailEnabled"); lua_classfunction(luaVM, "setComponentVisible", "setVehicleComponentVisible"); lua_classfunction(luaVM, "setSirensOn", "setVehicleSirensOn"); @@ -294,6 +295,7 @@ void CLuaVehicleDefs::AddClass(lua_State* luaVM) lua_classfunction(luaVM, "setVariant", "setVehicleVariant"); lua_classfunction(luaVM, "setWheelScale", "setVehicleWheelScale"); lua_classfunction(luaVM, "setModelWheelSize", "setVehicleModelWheelSize"); + lua_classfunction(luaVM, "setTrailEnabled", "setPlaneTrailEnabled"); lua_classfunction(luaVM, "resetComponentPosition", "resetVehicleComponentPosition"); lua_classfunction(luaVM, "resetComponentRotation", "resetVehicleComponentRotation"); @@ -353,6 +355,7 @@ void CLuaVehicleDefs::AddClass(lua_State* luaVM) lua_classvariable(luaVM, "turnVelocity", SetVehicleTurnVelocity, OOP_GetVehicleTurnVelocity); lua_classvariable(luaVM, "wheelScale", "setVehicleWheelScale", "getVehicleWheelScale"); + lua_registerclass(luaVM, "Vehicle", "Element"); } @@ -4343,12 +4346,12 @@ bool CLuaVehicleDefs::SpawnVehicleFlyingComponent(CClientVehicle* const vehicle, return vehicle->SpawnFlyingComponent(partNodeIndex, collisionType, removalTime.value_or(-1)); } -bool CLuaVehicleDefs::SetSmokeTrailEnabled(CClientVehicle* vehicle, bool state) noexcept +bool CLuaVehicleDefs::SetSmokeTrailEnabled(CClientVehicle* vehicle, bool state) { std::uint16_t model = vehicle->GetModel(); if (model != 512 && model != 513) - return false; - + throw LuaFunctionError("Invaild model ID"); + vehicle->SetSmokeTrailEnabled(state); return true; } diff --git a/Client/mods/deathmatch/logic/luadefs/CLuaVehicleDefs.h b/Client/mods/deathmatch/logic/luadefs/CLuaVehicleDefs.h index 474799217e4..5e4695e8505 100644 --- a/Client/mods/deathmatch/logic/luadefs/CLuaVehicleDefs.h +++ b/Client/mods/deathmatch/logic/luadefs/CLuaVehicleDefs.h @@ -182,6 +182,6 @@ class CLuaVehicleDefs : public CLuaDefs static bool SpawnVehicleFlyingComponent(CClientVehicle* const vehicle, std::uint8_t nodeIndex, std::optional componentCollisionType, std::optional removalTime); - static bool SetSmokeTrailEnabled(CClientVehicle* vehicle, bool state) noexcept; + static bool SetSmokeTrailEnabled(CClientVehicle* vehicle, bool state); static bool IsSmokeTrailEnabled(CClientVehicle* vehicle) noexcept; }; From 1ba21ee6f00111dfe64ae3fe0b6697c7f344b578 Mon Sep 17 00:00:00 2001 From: Proxy-99 <77501848+Proxy-99@users.noreply.github.com> Date: Sat, 19 Oct 2024 00:52:51 +0300 Subject: [PATCH 09/10] remove extra space --- Client/mods/deathmatch/logic/luadefs/CLuaVehicleDefs.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/Client/mods/deathmatch/logic/luadefs/CLuaVehicleDefs.cpp b/Client/mods/deathmatch/logic/luadefs/CLuaVehicleDefs.cpp index 3f63be62a05..208f202e913 100644 --- a/Client/mods/deathmatch/logic/luadefs/CLuaVehicleDefs.cpp +++ b/Client/mods/deathmatch/logic/luadefs/CLuaVehicleDefs.cpp @@ -355,7 +355,6 @@ void CLuaVehicleDefs::AddClass(lua_State* luaVM) lua_classvariable(luaVM, "turnVelocity", SetVehicleTurnVelocity, OOP_GetVehicleTurnVelocity); lua_classvariable(luaVM, "wheelScale", "setVehicleWheelScale", "getVehicleWheelScale"); - lua_registerclass(luaVM, "Vehicle", "Element"); } From cca75a5fe22ba5e8c31317875756710bbb90d222 Mon Sep 17 00:00:00 2001 From: Proxy-99 <77501848+Proxy-99@users.noreply.github.com> Date: Sat, 19 Oct 2024 02:07:19 +0300 Subject: [PATCH 10/10] rename functions in a way general --- Client/mods/deathmatch/logic/luadefs/CLuaVehicleDefs.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Client/mods/deathmatch/logic/luadefs/CLuaVehicleDefs.cpp b/Client/mods/deathmatch/logic/luadefs/CLuaVehicleDefs.cpp index 208f202e913..fabdf76f16d 100644 --- a/Client/mods/deathmatch/logic/luadefs/CLuaVehicleDefs.cpp +++ b/Client/mods/deathmatch/logic/luadefs/CLuaVehicleDefs.cpp @@ -92,7 +92,7 @@ void CLuaVehicleDefs::LoadFunctions() {"getVehicleModelWheelSize", ArgumentParser}, {"getVehicleWheelFrictionState", ArgumentParser}, {"getVehicleEntryPoints", ArgumentParser}, - {"isPlaneTrailEnabled", ArgumentParser}, + {"isVehicleSmokeTrailEnabled", ArgumentParser}, // Vehicle set funcs {"createVehicle", CreateVehicle}, @@ -157,7 +157,7 @@ void CLuaVehicleDefs::LoadFunctions() {"setVehicleWheelScale", ArgumentParser}, {"setVehicleModelWheelSize", ArgumentParser}, {"spawnVehicleFlyingComponent", ArgumentParser}, - {"setPlaneTrailEnabled", ArgumentParser}, + {"setVehicleSmokeTrailEnabled", ArgumentParser}, }; // Add functions @@ -246,7 +246,7 @@ void CLuaVehicleDefs::AddClass(lua_State* luaVM) lua_classfunction(luaVM, "getModelWheelSize", "getVehicleModelWheelSize"); lua_classfunction(luaVM, "getWheelFrictionState", "getVehicleWheelFrictionState"); lua_classfunction(luaVM, "getEntryPoints", ArgumentParser); - lua_classfunction(luaVM, "isTrailEnabled", "isPlaneTrailEnabled"); + lua_classfunction(luaVM, "isSmokeTrailEnabled", "isVehicleSmokeTrailEnabled"); lua_classfunction(luaVM, "setComponentVisible", "setVehicleComponentVisible"); lua_classfunction(luaVM, "setSirensOn", "setVehicleSirensOn"); @@ -295,7 +295,7 @@ void CLuaVehicleDefs::AddClass(lua_State* luaVM) lua_classfunction(luaVM, "setVariant", "setVehicleVariant"); lua_classfunction(luaVM, "setWheelScale", "setVehicleWheelScale"); lua_classfunction(luaVM, "setModelWheelSize", "setVehicleModelWheelSize"); - lua_classfunction(luaVM, "setTrailEnabled", "setPlaneTrailEnabled"); + lua_classfunction(luaVM, "setSmokeTrailEnabled", "setVehicleSmokeTrailEnabled"); lua_classfunction(luaVM, "resetComponentPosition", "resetVehicleComponentPosition"); lua_classfunction(luaVM, "resetComponentRotation", "resetVehicleComponentRotation");