From ad8eb2f2e2ad6a30674af755a756241c997c4b19 Mon Sep 17 00:00:00 2001 From: CrosRoad95 Date: Sat, 30 Jun 2018 20:38:23 +0200 Subject: [PATCH 1/3] test 1 --- .../mods/deathmatch/logic/lua/CLuaManager.cpp | 2 + .../logic/luadefs/CLuaPathFindDefs.cpp | 62 +++++++++++++++++++ .../logic/luadefs/CLuaPathFindDefs.h | 21 +++++++ 3 files changed, 85 insertions(+) create mode 100644 Client/mods/deathmatch/logic/luadefs/CLuaPathFindDefs.cpp create mode 100644 Client/mods/deathmatch/logic/luadefs/CLuaPathFindDefs.h diff --git a/Client/mods/deathmatch/logic/lua/CLuaManager.cpp b/Client/mods/deathmatch/logic/lua/CLuaManager.cpp index 54ac8e964c9..e9fb248e16d 100644 --- a/Client/mods/deathmatch/logic/lua/CLuaManager.cpp +++ b/Client/mods/deathmatch/logic/lua/CLuaManager.cpp @@ -11,6 +11,7 @@ #include "StdInc.h" #include "../luadefs/CLuaFireDefs.h" +#include "../luadefs/CLuaPathFindDefs.h" using std::list; @@ -420,4 +421,5 @@ void CLuaManager::LoadCFunctions(void) CLuaWaterDefs::LoadFunctions(); CLuaWeaponDefs::LoadFunctions(); CLuaXMLDefs::LoadFunctions(); + CLuaPathFindDefs::LoadFunctions(); } diff --git a/Client/mods/deathmatch/logic/luadefs/CLuaPathFindDefs.cpp b/Client/mods/deathmatch/logic/luadefs/CLuaPathFindDefs.cpp new file mode 100644 index 00000000000..01fb85c20fd --- /dev/null +++ b/Client/mods/deathmatch/logic/luadefs/CLuaPathFindDefs.cpp @@ -0,0 +1,62 @@ +/***************************************************************************** +* +* PROJECT: Multi Theft Auto +* LICENSE: See LICENSE in the top level directory +* FILE: Client/mods/deathmatch/logic/luadefs/CLuaFireDefs.cpp +* +* Multi Theft Auto is available from http://www.multitheftauto.com/ +* +*****************************************************************************/ +#include "StdInc.h" +#include "CLuaPathFindDefs.h" +#include "d:\mtasa-blue_cr95\Client\game_sa\CPathFindSA.h" + +void CLuaPathFindDefs::LoadFunctions(void) +{ + CLuaCFunctions::AddFunction("findClosestNode", CLuaPathFindDefs::FindNodeClosestToCoords); +} +void CLuaPathFindDefs::AddClass(lua_State* luaVM) +{ + lua_newclass(luaVM); + + //lua_classfunction(luaVM, "create", "createWater"); + + //lua_classvariable(luaVM, "level", "setWaterLevel", "getWaterLevel"); + + lua_registerclass(luaVM, "PathFind", "Element"); +} + +int CLuaPathFindDefs::FindNodeClosestToCoords(lua_State* luaVM) +{ + // bool findNodeClosestToCoords ( float x, float y, float z [, float size = 1.8 ] ) + + CVector vecPosition; + int iNodeNumber; + int iType; + float fDistance; + + CScriptArgReader argStream(luaVM); + argStream.ReadVector3D(vecPosition); + argStream.ReadNumber(iNodeNumber, 0); + argStream.ReadNumber(iType, 0); + argStream.ReadNumber(fDistance, 9999.0f); + + if (!argStream.HasErrors()) + { + CPathFind* asdf = g_pGame->GetPathFind(); + CNodeAddress* found; + auto as = asdf->FindNthNodeClosestToCoors(&vecPosition, iNodeNumber, iType, found, fDistance); + if ( true ) + { + lua_pushboolean(luaVM, true); + return 1; + } + lua_pushboolean(luaVM, true); + return 1; + } + else + m_pScriptDebugging->LogCustom(luaVM, argStream.GetFullErrorMessage()); + + lua_pushboolean(luaVM, false); + return 1; +} diff --git a/Client/mods/deathmatch/logic/luadefs/CLuaPathFindDefs.h b/Client/mods/deathmatch/logic/luadefs/CLuaPathFindDefs.h new file mode 100644 index 00000000000..8009af85b53 --- /dev/null +++ b/Client/mods/deathmatch/logic/luadefs/CLuaPathFindDefs.h @@ -0,0 +1,21 @@ +/***************************************************************************** +* +* PROJECT: Multi Theft Auto +* LICENSE: See LICENSE in the top level directory +* FILE: Client/mods/deathmatch/logic/luadefs/CLuaFireDefs.h +* +* Multi Theft Auto is available from http://www.multitheftauto.com/ +* +*****************************************************************************/ +#pragma once + +#include "CLuaDefs.h" + +class CLuaPathFindDefs : public CLuaDefs +{ +public: + static void LoadFunctions(void); + static void AddClass(lua_State* luaVM); + + LUA_DECLARE(FindNodeClosestToCoords); +}; From 86baf91d7de7bde60ab802de6fc90babda1b4b28 Mon Sep 17 00:00:00 2001 From: CrosRoad95 Date: Wed, 4 Jul 2018 17:56:20 +0200 Subject: [PATCH 2/3] removed pathfinding from master --- .../mods/deathmatch/logic/lua/CLuaManager.cpp | 2 - .../logic/luadefs/CLuaPathFindDefs.cpp | 62 ------------------- .../logic/luadefs/CLuaPathFindDefs.h | 21 ------- 3 files changed, 85 deletions(-) delete mode 100644 Client/mods/deathmatch/logic/luadefs/CLuaPathFindDefs.cpp delete mode 100644 Client/mods/deathmatch/logic/luadefs/CLuaPathFindDefs.h diff --git a/Client/mods/deathmatch/logic/lua/CLuaManager.cpp b/Client/mods/deathmatch/logic/lua/CLuaManager.cpp index e9fb248e16d..54ac8e964c9 100644 --- a/Client/mods/deathmatch/logic/lua/CLuaManager.cpp +++ b/Client/mods/deathmatch/logic/lua/CLuaManager.cpp @@ -11,7 +11,6 @@ #include "StdInc.h" #include "../luadefs/CLuaFireDefs.h" -#include "../luadefs/CLuaPathFindDefs.h" using std::list; @@ -421,5 +420,4 @@ void CLuaManager::LoadCFunctions(void) CLuaWaterDefs::LoadFunctions(); CLuaWeaponDefs::LoadFunctions(); CLuaXMLDefs::LoadFunctions(); - CLuaPathFindDefs::LoadFunctions(); } diff --git a/Client/mods/deathmatch/logic/luadefs/CLuaPathFindDefs.cpp b/Client/mods/deathmatch/logic/luadefs/CLuaPathFindDefs.cpp deleted file mode 100644 index 01fb85c20fd..00000000000 --- a/Client/mods/deathmatch/logic/luadefs/CLuaPathFindDefs.cpp +++ /dev/null @@ -1,62 +0,0 @@ -/***************************************************************************** -* -* PROJECT: Multi Theft Auto -* LICENSE: See LICENSE in the top level directory -* FILE: Client/mods/deathmatch/logic/luadefs/CLuaFireDefs.cpp -* -* Multi Theft Auto is available from http://www.multitheftauto.com/ -* -*****************************************************************************/ -#include "StdInc.h" -#include "CLuaPathFindDefs.h" -#include "d:\mtasa-blue_cr95\Client\game_sa\CPathFindSA.h" - -void CLuaPathFindDefs::LoadFunctions(void) -{ - CLuaCFunctions::AddFunction("findClosestNode", CLuaPathFindDefs::FindNodeClosestToCoords); -} -void CLuaPathFindDefs::AddClass(lua_State* luaVM) -{ - lua_newclass(luaVM); - - //lua_classfunction(luaVM, "create", "createWater"); - - //lua_classvariable(luaVM, "level", "setWaterLevel", "getWaterLevel"); - - lua_registerclass(luaVM, "PathFind", "Element"); -} - -int CLuaPathFindDefs::FindNodeClosestToCoords(lua_State* luaVM) -{ - // bool findNodeClosestToCoords ( float x, float y, float z [, float size = 1.8 ] ) - - CVector vecPosition; - int iNodeNumber; - int iType; - float fDistance; - - CScriptArgReader argStream(luaVM); - argStream.ReadVector3D(vecPosition); - argStream.ReadNumber(iNodeNumber, 0); - argStream.ReadNumber(iType, 0); - argStream.ReadNumber(fDistance, 9999.0f); - - if (!argStream.HasErrors()) - { - CPathFind* asdf = g_pGame->GetPathFind(); - CNodeAddress* found; - auto as = asdf->FindNthNodeClosestToCoors(&vecPosition, iNodeNumber, iType, found, fDistance); - if ( true ) - { - lua_pushboolean(luaVM, true); - return 1; - } - lua_pushboolean(luaVM, true); - return 1; - } - else - m_pScriptDebugging->LogCustom(luaVM, argStream.GetFullErrorMessage()); - - lua_pushboolean(luaVM, false); - return 1; -} diff --git a/Client/mods/deathmatch/logic/luadefs/CLuaPathFindDefs.h b/Client/mods/deathmatch/logic/luadefs/CLuaPathFindDefs.h deleted file mode 100644 index 8009af85b53..00000000000 --- a/Client/mods/deathmatch/logic/luadefs/CLuaPathFindDefs.h +++ /dev/null @@ -1,21 +0,0 @@ -/***************************************************************************** -* -* PROJECT: Multi Theft Auto -* LICENSE: See LICENSE in the top level directory -* FILE: Client/mods/deathmatch/logic/luadefs/CLuaFireDefs.h -* -* Multi Theft Auto is available from http://www.multitheftauto.com/ -* -*****************************************************************************/ -#pragma once - -#include "CLuaDefs.h" - -class CLuaPathFindDefs : public CLuaDefs -{ -public: - static void LoadFunctions(void); - static void AddClass(lua_State* luaVM); - - LUA_DECLARE(FindNodeClosestToCoords); -}; From bc55e078ca923ecd4a0056309fbe88d17e79764c Mon Sep 17 00:00:00 2001 From: CrosRoad95 Date: Wed, 29 Aug 2018 21:29:59 +0200 Subject: [PATCH 3/3] untested --- .../mods/deathmatch/logic/luadefs/CLuaVehicleDefs.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/Client/mods/deathmatch/logic/luadefs/CLuaVehicleDefs.cpp b/Client/mods/deathmatch/logic/luadefs/CLuaVehicleDefs.cpp index 38722eb15f5..1ffa1a5c8af 100644 --- a/Client/mods/deathmatch/logic/luadefs/CLuaVehicleDefs.cpp +++ b/Client/mods/deathmatch/logic/luadefs/CLuaVehicleDefs.cpp @@ -74,6 +74,11 @@ void CLuaVehicleDefs::LoadFunctions(void) CLuaCFunctions::AddFunction("getVehicleNitroLevel", GetVehicleNitroLevel); CLuaCFunctions::AddFunction("getHeliBladeCollisionsEnabled", GetHeliBladeCollisionsEnabled); CLuaCFunctions::AddFunction("isVehicleWindowOpen", IsVehicleWindowOpen); + CLuaCFunctions::AddFunction("getVehicleComponentPosition", GetVehicleComponentPosition); + CLuaCFunctions::AddFunction("getVehicleComponentRotation", GetVehicleComponentRotation); + CLuaCFunctions::AddFunction("getVehicleComponentVisible", GetVehicleComponentVisible); + CLuaCFunctions::AddFunction("getVehicleComponents", GetVehicleComponents); + CLuaCFunctions::AddFunction("getVehicleModelExhaustFumesPosition", GetVehicleModelExhaustFumesPosition); // Vehicle set funcs CLuaCFunctions::AddFunction("createVehicle", CreateVehicle); @@ -116,14 +121,10 @@ void CLuaVehicleDefs::LoadFunctions(void) CLuaCFunctions::AddFunction("setVehicleHandling", SetVehicleHandling); CLuaCFunctions::AddFunction("setVehicleSirens", SetVehicleSirens); CLuaCFunctions::AddFunction("setVehicleComponentPosition", SetVehicleComponentPosition); - CLuaCFunctions::AddFunction("getVehicleComponentPosition", GetVehicleComponentPosition); CLuaCFunctions::AddFunction("setVehicleComponentRotation", SetVehicleComponentRotation); - CLuaCFunctions::AddFunction("getVehicleComponentRotation", GetVehicleComponentRotation); CLuaCFunctions::AddFunction("resetVehicleComponentPosition", ResetVehicleComponentPosition); CLuaCFunctions::AddFunction("resetVehicleComponentRotation", ResetVehicleComponentRotation); CLuaCFunctions::AddFunction("setVehicleComponentVisible", SetVehicleComponentVisible); - CLuaCFunctions::AddFunction("getVehicleComponentVisible", GetVehicleComponentVisible); - CLuaCFunctions::AddFunction("getVehicleComponents", GetVehicleComponents); CLuaCFunctions::AddFunction("setVehicleNitroActivated", SetVehicleNitroActivated); CLuaCFunctions::AddFunction("setVehicleNitroCount", SetVehicleNitroCount); CLuaCFunctions::AddFunction("setVehicleNitroLevel", SetVehicleNitroLevel); @@ -131,7 +132,6 @@ void CLuaVehicleDefs::LoadFunctions(void) CLuaCFunctions::AddFunction("setHeliBladeCollisionsEnabled", SetHeliBladeCollisionsEnabled); CLuaCFunctions::AddFunction("setVehicleWindowOpen", SetVehicleWindowOpen); CLuaCFunctions::AddFunction("setVehicleModelExhaustFumesPosition", SetVehicleModelExhaustFumesPosition); - CLuaCFunctions::AddFunction("getVehicleModelExhaustFumesPosition", GetVehicleModelExhaustFumesPosition); } void CLuaVehicleDefs::AddClass(lua_State* luaVM)