Skip to content

Commit c09c049

Browse files
Merge pull request #64 from denjifb/feature/physical-properties-group
Add support for Physical Properties Group
2 parents ea9b970 + 0b96320 commit c09c049

File tree

3 files changed

+13
-0
lines changed

3 files changed

+13
-0
lines changed

newmodels_azul/models/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,4 +22,5 @@ See the [example files](/newmodels_azul/models/) to visualize the structure of t
2222
- `dff=PATH_TO_DFF_FILE_INSIDE_models_FOLDER` (used for shared models)
2323
- `col=PATH_TO_COL_FILE_INSIDE_models_FOLDER` (used for shared collisions)
2424
- `lodDistance=NUMBER` (used for setting https://wiki.multitheftauto.com/wiki/EngineSetModelLODDistance)
25+
- `physicalPropsGroup=GROUP_ID` (used for setting https://wiki.multitheftauto.com/wiki/EngineSetModelPhysicalPropertiesGroup)
2526
- `settings=PATH_TO_ANOTHER_SETTINGS_FILE_INSIDE_models_FOLDER` (in case you want to share the same settings between multiple models)

newmodels_azul/scripts/core/client_logic.lua

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,11 @@ local function finishLoadCustomModel(customModel)
9898
engineSetModelLODDistance(allocatedModel, lodDistance)
9999
end
100100

101+
local physicalPropsGroup = customInfo.settings.physicalPropsGroup
102+
if physicalPropsGroup then
103+
engineSetModelPhysicalPropertiesGroup(allocatedModel, physicalPropsGroup)
104+
end
105+
101106
-- Set loadedModel info
102107
loadedModels[customModel] = {
103108
id = allocatedModel,
@@ -273,6 +278,7 @@ local function freeAllocatedModelNow(customModel)
273278
killTimer(loadedModel.freeAllocatedTimer)
274279
end
275280
engineResetModelLODDistance(loadedModel.id)
281+
engineRestoreModelPhysicalPropertiesGroup(loadedModel.id)
276282
engineFreeModel(loadedModel.id)
277283

278284
-- Destroy model elements unless used by another loaded model

newmodels_azul/scripts/core/server_logic.lua

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,12 @@ local function parseModelSettings(customModel, customModelInfo, thisFullPath, is
4040
return false, "invalid lodDistance value: " .. settingStr
4141
end
4242
customModelSettings.lodDistance = lodDistance
43+
elseif stringStartswith(settingStr, "physicalPropsGroup=") then
44+
local physicalPropsGroup = tonumber(settingStr:sub(20))
45+
if not physicalPropsGroup then
46+
return false, "invalid physicalPropsGroup value: " .. settingStr
47+
end
48+
customModelSettings.physicalPropsGroup = physicalPropsGroup
4349
elseif stringStartswith(settingStr, "settings=") then
4450
if isFromSettingsOption then -- prevent inception and recursion
4551
return false, "settings option cannot point to a settings file that contains another settings option @ " .. thisFullPath

0 commit comments

Comments
 (0)