Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions Client/mods/deathmatch/logic/luadefs/CLuaEngineDefs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,7 @@ void CLuaEngineDefs::LoadFunctions()
{"engineGetPoolUsedCapacity", ArgumentParser<EngineGetPoolUsedCapacity>},
{"engineSetPoolCapacity", ArgumentParser<EngineSetPoolCapacity>},
{"enginePreloadWorldArea", ArgumentParser<EnginePreloadWorldArea>},
{"engineIsModelValid", ArgumentParser<EngineIsModelValid>}

// CLuaCFunctions::AddFunction ( "engineReplaceMatchingAtomics", EngineReplaceMatchingAtomics );
// CLuaCFunctions::AddFunction ( "engineReplaceWheelAtomics", EngineReplaceWheelAtomics );
Expand Down Expand Up @@ -2593,3 +2594,13 @@ void CLuaEngineDefs::EnginePreloadWorldArea(CVector position, std::optional<Prel
if (option == PreloadAreaOption::ALL || option == PreloadAreaOption::COLLISIONS)
g_pGame->GetStreaming()->LoadSceneCollision(&position);
}

bool CLuaEngineDefs::EngineIsModelValid(uint uiModelId)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

uint -> std::uint32_t

{
CModelInfo* pModelInfo = g_pGame->GetModelInfo(uiModelId);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

CModelInfo* modelInfo = g_pGame->GetModelInfo(modelId);


if (uiModelId >= 20000 || !pModelInfo)
return false;

return true;
Comment on lines +2602 to +2605
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

return (modelId < 20000 && modelInfo);

}
1 change: 1 addition & 0 deletions Client/mods/deathmatch/logic/luadefs/CLuaEngineDefs.h
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ class CLuaEngineDefs : public CLuaDefs
static bool EngineRestreamWorld();
static bool EngineSetModelVisibleTime(std::string strModelId, char cHourOn, char cHourOff);
static std::variant<bool, CLuaMultiReturn<char, char>> EngineGetModelVisibleTime(std::string strModelId);
static bool EngineIsModelValid(uint uiModelID);

static size_t EngineGetPoolCapacity(ePools pool);
static size_t EngineGetPoolDefaultCapacity(ePools pool);
Expand Down