ah_sce_unpacked/unpacked/Custom_Model_Bag Challenge Scenarios 9f6801/Custom_Model Laid to Rest e2dd57.ttslua
2024-07-27 21:47:52 -04:00

84 lines
2.2 KiB
Plaintext

-- Bundled by luabundle {"version":"1.6.0"}
local __bundle_require, __bundle_loaded, __bundle_register, __bundle_modules = (function(superRequire)
local loadingPlaceholder = {[{}] = true}
local register
local modules = {}
local require
local loaded = {}
register = function(name, body)
if not modules[name] then
modules[name] = body
end
end
require = function(name)
local loadedModule = loaded[name]
if loadedModule then
if loadedModule == loadingPlaceholder then
return nil
end
else
if not modules[name] then
if not superRequire then
local identifier = type(name) == 'string' and '\"' .. name .. '\"' or tostring(name)
error('Tried to require ' .. identifier .. ', but no such module has been registered')
else
return superRequire(name)
end
end
loaded[name] = loadingPlaceholder
loadedModule = modules[name](require, loaded, register, modules)
loaded[name] = loadedModule
end
return loadedModule
end
return require, loaded, register, modules
end)(nil)
__bundle_register("__root", function(require, _LOADED, __bundle_register, __bundle_modules)
require("core/DownloadBox")
end)
__bundle_register("core/DownloadBox", function(require, _LOADED, __bundle_register, __bundle_modules)
function onLoad()
-- make sure the model is loaded so that we can use the bounds
Wait.condition(buttonCreation, function() return not self.loading_custom end)
end
-- dynamic download button position based on model
function buttonCreation()
local scale = self.getScale()
local bounds = self.getBoundsNormalized()
self.createButton({
label = "Download",
click_function = "buttonClick_download",
function_owner = self,
position = {
x = 0,
y = -(bounds.size.y / 2 + bounds.offset.y) / scale.y + 0.5,
z = (bounds.size.z / 2 + 1.2) / scale.z
},
height = 700,
width = 2300,
font_size = 430,
color = { 0, 0, 0 },
font_color = { 1, 1, 1 },
scale = { 1 / scale.x, 1, 1 / scale.z }
})
end
function buttonClick_download(_, playerColor)
Global.call('placeholder_download', {
url = self.getGMNotes(),
player = playerColor and Player[playerColor] or nil,
replace = self.guid
})
end
end)
return __bundle_require("__root")