ah_sce_unpacked/unpacked/Custom_Model_Bag Challenge Scenarios 9f6801/Custom_Model By the Book cc7eb3.ttslua

84 lines
2.2 KiB
Plaintext
Raw Normal View History

2022-12-13 14:02:30 -05:00
-- Bundled by luabundle {"version":"1.6.0"}
local __bundle_require, __bundle_loaded, __bundle_register, __bundle_modules = (function(superRequire)
local loadingPlaceholder = {[{}] = true}
2021-10-18 15:54:27 -04:00
2022-12-13 14:02:30 -05:00
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]
2021-10-18 15:54:27 -04:00
2022-12-13 14:02:30 -05:00
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
2021-10-18 15:54:27 -04:00
2022-12-13 14:02:30 -05:00
loaded[name] = loadingPlaceholder
loadedModule = modules[name](require, loaded, register, modules)
loaded[name] = loadedModule
end
2021-10-18 15:54:27 -04:00
2022-12-13 14:02:30 -05:00
return loadedModule
end
2021-10-18 15:54:27 -04:00
2022-12-13 14:02:30 -05:00
return require, loaded, register, modules
end)(nil)
2024-03-10 09:56:22 -04:00
__bundle_register("__root", function(require, _LOADED, __bundle_register, __bundle_modules)
require("core/DownloadBox")
end)
2022-12-13 14:02:30 -05:00
__bundle_register("core/DownloadBox", function(require, _LOADED, __bundle_register, __bundle_modules)
function onLoad()
2024-07-27 21:47:52 -04:00
-- 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()
2023-01-29 19:31:52 -05:00
2024-07-27 21:47:52 -04:00
self.createButton({
2022-12-13 14:02:30 -05:00
label = "Download",
click_function = "buttonClick_download",
function_owner = self,
2024-07-27 21:47:52 -04:00
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,
2022-12-13 14:02:30 -05:00
color = { 0, 0, 0 },
2024-07-27 21:47:52 -04:00
font_color = { 1, 1, 1 },
scale = { 1 / scale.x, 1, 1 / scale.z }
})
2021-10-18 15:54:27 -04:00
end
2024-03-10 09:56:22 -04:00
function buttonClick_download(_, playerColor)
2024-07-27 21:47:52 -04:00
Global.call('placeholder_download', {
url = self.getGMNotes(),
player = playerColor and Player[playerColor] or nil,
replace = self.guid
})
2021-10-18 15:54:27 -04:00
end
2022-12-13 14:02:30 -05:00
end)
return __bundle_require("__root")