temprarily lock objects

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

View File

@ -403,7 +403,7 @@ function doUpkeep(_, clickedByColor, isRightClick)
Wait.time(function() deckLib.placeOrMergeIntoDeck(cardsToDiscard[i], returnGlobalDiscardPosition(), self.getRotation()) end, j * 0.1)
end
--add some time if there are any cards to discard, if not, draw up to 5 immediately
-- add some time if there are any cards to discard, if not, draw up to 5 immediately
if j > 0 then
k = 0.7 + (j * 0.1)
else
@ -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