Skip to content

Commit c648cbb

Browse files
add getObjectModelOfLOD
1 parent 62cb6e8 commit c648cbb

File tree

6 files changed

+23
-3
lines changed

6 files changed

+23
-3
lines changed

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

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ void CLuaObjectDefs::LoadFunctions()
4242

4343
// Object util functions
4444
{"getObjectLODOfModel", ArgumentParser<GetObjectLODOfModel>},
45+
{"getObjectModelOfLOD", ArgumentParser<GetObjectModelOfLOD>},
4546
};
4647

4748
// Add functions
@@ -733,3 +734,11 @@ std::variant<bool, std::uint32_t> CLuaObjectDefs::GetObjectLODOfModel(lua_State*
733734
return false;
734735
return lodModel;
735736
}
737+
738+
std::variant<bool, std::uint32_t> CLuaObjectDefs::GetObjectModelOfLOD(lua_State* const luaVM, std::uint32_t lodID)
739+
{
740+
std::uint32_t objModel = CLodModels::GetObjectModelOfLOD(lodID);
741+
if (objModel == 0) // Object Model not found for LOD Model provided
742+
return false;
743+
return objModel;
744+
}

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,4 +46,5 @@ class CLuaObjectDefs : public CLuaDefs
4646

4747
// Object util funcs
4848
static std::variant<bool, std::uint32_t> GetObjectLODOfModel(lua_State* const luaVM, std::uint32_t objectID);
49+
static std::variant<bool, std::uint32_t> GetObjectModelOfLOD(lua_State* const luaVM, std::uint32_t lodID);
4950
};

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

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ void CLuaObjectDefs::LoadFunctions()
4040

4141
// Object util functions
4242
{"getObjectLODOfModel", ArgumentParser<GetObjectLODOfModel>},
43+
{"getObjectModelOfLOD", ArgumentParser<GetObjectModelOfLOD>},
4344
};
4445

4546
// Add functions
@@ -345,3 +346,11 @@ std::variant<bool, std::uint32_t> CLuaObjectDefs::GetObjectLODOfModel(lua_State*
345346
return false;
346347
return lodModel;
347348
}
349+
350+
std::variant<bool, std::uint32_t> CLuaObjectDefs::GetObjectModelOfLOD(lua_State* const luaVM, std::uint32_t lodID)
351+
{
352+
std::uint32_t objModel = CLodModels::GetObjectModelOfLOD(lodID);
353+
if (objModel == 0) // Object Model not found for LOD Model provided
354+
return false;
355+
return objModel;
356+
}

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,4 +42,5 @@ class CLuaObjectDefs : public CLuaDefs
4242

4343
// Object util funcs
4444
static std::variant<bool, std::uint32_t> GetObjectLODOfModel(lua_State* const luaVM, std::uint32_t objectID);
45+
static std::variant<bool, std::uint32_t> GetObjectModelOfLOD(lua_State* const luaVM, std::uint32_t objectID);
4546
};

Shared/mods/deathmatch/logic/CLodModels.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -501,11 +501,11 @@ std::uint32_t CLodModels::GetObjectLODOfModel(std::uint32_t objectID)
501501
return 0;
502502
}
503503

504-
std::uint32_t CLodModels::GetObjectModelOfLOD(std::uint32_t lodModelID)
504+
std::uint32_t CLodModels::GetObjectModelOfLOD(std::uint32_t lodID)
505505
{
506506
for (const auto& [objectID, lodModel] : *LOD_MODELS)
507507
{
508-
if (lodModel == lodModelID)
508+
if (lodModel == lodID)
509509
return objectID;
510510
}
511511
return 0;

Shared/mods/deathmatch/logic/CLodModels.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ class CLodModels
1616
{
1717
public:
1818
static std::uint32_t GetObjectLODOfModel(std::uint32_t objectID);
19-
static std::uint32_t GetObjectModelOfLOD(std::uint32_t lodModelID);
19+
static std::uint32_t GetObjectModelOfLOD(std::uint32_t lodID);
2020

2121
private:
2222
// Static pointer to a map that is initialized in the .cpp file

0 commit comments

Comments
 (0)