temprarily lock objects

This commit is contained in:
Chr1Z93 2024-06-27 00:42:00 +02:00
parent bd65901e3a
commit 699dd82c7b

View File

@ -1012,10 +1012,26 @@ function updateTexture(overrideName)
-- apply texture
local customInfo = self.getCustomObject()
if customInfo.image ~= newUrl then
-- temporarily lock objects so they don't fall through the mat
local objectsToUnlock = {}
for _, obj in ipairs(searchAroundSelf()) do
if not obj.getLock() then
obj.setLock(true)
table.insert(objectsToUnlock, obj)
end
end
self.script_state = onSave()
customInfo.image = newUrl
self.setCustomObject(customInfo)
self.reload()
local reloadedMat = self.reload()
-- unlock objects when mat is reloaded
Wait.condition(function()
for _, obj in ipairs(objectsToUnlock) do
obj.setLock(false)
end
end, function() return reloadedMat.loading_custom == false end)
end
end