diff --git a/[gameplay]/mapfixes/meta.xml b/[gameplay]/mapfixes/meta.xml
index 6d3e5063f..9ef3eabce 100644
--- a/[gameplay]/mapfixes/meta.xml
+++ b/[gameplay]/mapfixes/meta.xml
@@ -12,5 +12,6 @@
+
\ No newline at end of file
diff --git a/[gameplay]/mapfixes/scripts/client/main.lua b/[gameplay]/mapfixes/scripts/client/main.lua
index ce5e070ba..beb8974f0 100644
--- a/[gameplay]/mapfixes/scripts/client/main.lua
+++ b/[gameplay]/mapfixes/scripts/client/main.lua
@@ -1,7 +1,7 @@
addEvent("mapfixes:client:loadAllComponents", true)
addEvent("mapfixes:client:togOneComponent", true)
-local function loadOneMapFixComponent(name, data)
+local function loadOneMapFixComponent(name, data, wasToggled)
-- Clear the previous elements if any
local createdElements = data.createdElements
if createdElements then
@@ -34,9 +34,22 @@ local function loadOneMapFixComponent(name, data)
setGarageOpen(garageID, false)
end
end
+ -- Revert previously set model flags
+ local modelFlagsToSet = data.modelFlagsToSet
+ if modelFlagsToSet then
+ for _, v in pairs(modelFlagsToSet) do
+ engineSetModelFlag(v[1], v[2], not v[3])
+ end
+ end
-- Don't proceed if the component is disabled
if not data.enabled then
+
+ -- Force restream world after unloading this component
+ -- only if it was the only one toggled
+ if wasToggled then
+ engineRestreamWorld()
+ end
return
end
@@ -60,7 +73,6 @@ local function loadOneMapFixComponent(name, data)
if allocatedID then
if not data.allocatedIDs then data.allocatedIDs = {} end
data.allocatedIDs[#data.allocatedIDs + 1] = allocatedID
-
object = createObject(allocatedID, v.x, v.y, v.z, v.rx, v.ry, v.rz)
if object then
engineSetModelPhysicalPropertiesGroup(allocatedID, v.physicalPropertiesGroup)
@@ -94,6 +106,18 @@ local function loadOneMapFixComponent(name, data)
setGarageOpen(garageID, true)
end
end
+ -- Set model flags if any
+ if modelFlagsToSet then
+ for _, v in pairs(modelFlagsToSet) do
+ engineSetModelFlag(v[1], v[2], v[3])
+ end
+ end
+
+ -- Force restream world after loading this component
+ -- only if it was the only one toggled
+ if wasToggled then
+ engineRestreamWorld()
+ end
end
local function loadMapFixComponents(mapFixComponentStatuses)
@@ -105,6 +129,7 @@ local function loadMapFixComponents(mapFixComponentStatuses)
loadOneMapFixComponent(name, data)
end
end
+ engineRestreamWorld()
end
addEventHandler("mapfixes:client:loadAllComponents", localPlayer, loadMapFixComponents, false)
@@ -116,7 +141,7 @@ local function toggleOneMapFixComponent(name, enable)
return
end
data.enabled = (enable == true)
- loadOneMapFixComponent(name, data)
+ loadOneMapFixComponent(name, data, true)
if eventName ~= "onClientResourceStop" then
outputDebugString("Map fix component '" .. name .. "' is now " .. (data.enabled and "enabled" or "disabled"))
end
@@ -127,5 +152,6 @@ local function unloadAllMapFixComponents()
for name, _ in pairs(mapFixComponents) do
toggleOneMapFixComponent(name, false)
end
+ engineRestreamWorld()
end
addEventHandler("onClientResourceStop", resourceRoot, unloadAllMapFixComponents, false)
diff --git a/[gameplay]/mapfixes/scripts/shared/data.lua b/[gameplay]/mapfixes/scripts/shared/data.lua
index 640c18e3f..508138c5b 100644
--- a/[gameplay]/mapfixes/scripts/shared/data.lua
+++ b/[gameplay]/mapfixes/scripts/shared/data.lua
@@ -90,4 +90,9 @@ mapFixComponents = {
{ 11236, 25, -2164.4531, -255.39062, 38.125, 0 }, -- crackfactwalke
},
},
+ ["model_transparency_fixes"] = {
+ modelFlagsToSet = {
+ { 3089, 'draw_last', true }, -- ab_casdorLok (brown door with glass window)
+ }
+ },
}