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}
|
|
|
|
|
|
|
|
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/PlayAreaSelector")
|
|
|
|
end)
|
|
|
|
__bundle_register("core/PlayAreaSelector", function(require, _LOADED, __bundle_register, __bundle_modules)
|
2022-10-19 19:07:47 -04:00
|
|
|
-- Playmat Image Swapper
|
|
|
|
-- updated by: Chr1Z
|
|
|
|
-- original by: -
|
|
|
|
-- description: changes the big playmats image
|
|
|
|
information = {
|
2022-12-13 14:02:30 -05:00
|
|
|
version = "1.2",
|
|
|
|
last_updated = "12.11.2022"
|
2022-10-19 19:07:47 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
defaultURL = "http://cloud-3.steamusercontent.com/ugc/998015670465071049/FFAE162920D67CF38045EFBD3B85AD0F916147B2/"
|
|
|
|
|
|
|
|
-- parameters for open/close button for reusing
|
2022-12-13 14:02:30 -05:00
|
|
|
local BUTTON_PARAMETERS = {}
|
2022-10-19 19:07:47 -04:00
|
|
|
BUTTON_PARAMETERS.function_owner = self
|
|
|
|
BUTTON_PARAMETERS.click_function = "click_toggleControl"
|
|
|
|
BUTTON_PARAMETERS.height = 1500
|
|
|
|
BUTTON_PARAMETERS.width = 1500
|
|
|
|
BUTTON_PARAMETERS.color = { 1, 1, 1, 0 }
|
|
|
|
|
2022-12-13 14:02:30 -05:00
|
|
|
function onLoad()
|
2022-10-19 19:07:47 -04:00
|
|
|
controlActive = false
|
|
|
|
createOpenCloseButton()
|
|
|
|
|
|
|
|
self.addContextMenuItem("More Information", function()
|
|
|
|
printToAll("------------------------------", "White")
|
|
|
|
printToAll("Playmat Image Swapper v" .. information["version"] .. " by Chr1Z", "Orange")
|
|
|
|
printToAll("last updated: " .. information["last_updated"], "White")
|
|
|
|
printToAll("Original made by unknown", "White")
|
|
|
|
end)
|
|
|
|
end
|
|
|
|
|
|
|
|
-- click function for main button
|
|
|
|
function click_toggleControl()
|
|
|
|
self.clearButtons()
|
|
|
|
self.clearInputs()
|
|
|
|
|
|
|
|
controlActive = not controlActive
|
|
|
|
createOpenCloseButton()
|
|
|
|
|
|
|
|
if not controlActive then return end
|
|
|
|
|
|
|
|
-- creates the label, input box and apply button
|
|
|
|
self.createButton({
|
|
|
|
function_owner = self,
|
|
|
|
label = "Playmat Image Swapper",
|
|
|
|
tooltip = "",
|
|
|
|
click_function = "none",
|
|
|
|
position = { 0, 0.15, 2.2 },
|
|
|
|
height = 0,
|
|
|
|
width = 0,
|
|
|
|
font_size = 300,
|
|
|
|
font_color = { 1, 1, 1 }
|
|
|
|
})
|
|
|
|
|
|
|
|
self.createInput({
|
|
|
|
function_owner = self,
|
|
|
|
label = "URL",
|
|
|
|
tooltip = "Enter URL for playmat image",
|
|
|
|
input_function = "none",
|
|
|
|
alignment = 3,
|
|
|
|
position = { 0, 0.15, 3 },
|
|
|
|
height = 323,
|
|
|
|
width = 4000,
|
|
|
|
font_size = 300
|
|
|
|
})
|
|
|
|
|
|
|
|
self.createButton({
|
|
|
|
function_owner = self,
|
|
|
|
label = "Apply Image\nTo Playmat",
|
|
|
|
tooltip = "Left-Click: Apply URL\nRight-Click: Reset to default image",
|
|
|
|
click_function = "click_applySurface",
|
|
|
|
position = { 0, 0.15, 4.1 },
|
|
|
|
height = 460,
|
|
|
|
width = 1400,
|
|
|
|
font_size = 200
|
|
|
|
})
|
|
|
|
end
|
|
|
|
|
|
|
|
-- click function for apply button
|
|
|
|
function click_applySurface(_, _, isRightClick)
|
|
|
|
if isRightClick then
|
2022-12-13 14:02:30 -05:00
|
|
|
updateSurface()
|
2022-10-19 19:07:47 -04:00
|
|
|
else
|
|
|
|
updateSurface(self.getInputs()[1].value)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
-- input function for the input box
|
|
|
|
function none() end
|
|
|
|
|
|
|
|
-- main function (can be called by other objects)
|
|
|
|
function updateSurface(newURL)
|
2022-12-13 14:02:30 -05:00
|
|
|
local playArea = getObjectFromGUID("721ba2")
|
|
|
|
local customInfo = playArea.getCustomObject()
|
2022-10-19 19:07:47 -04:00
|
|
|
|
|
|
|
if newURL ~= "" and newURL ~= nil and newURL ~= defaultURL then
|
|
|
|
customInfo.image = newURL
|
|
|
|
broadcastToAll("New Playmat Image Applied", { 0.2, 0.9, 0.2 })
|
|
|
|
else
|
|
|
|
customInfo.image = defaultURL
|
|
|
|
broadcastToAll("Default Playmat Image Applied", { 0.2, 0.9, 0.2 })
|
|
|
|
end
|
|
|
|
|
2022-12-13 14:02:30 -05:00
|
|
|
playArea.setCustomObject(customInfo)
|
|
|
|
|
|
|
|
-- get custom data helper and call it after reloading
|
|
|
|
local guid = playArea.getVar("custom_data_helper_guid")
|
|
|
|
playArea = playArea.reload()
|
|
|
|
|
|
|
|
if guid ~= nil then
|
|
|
|
Wait.time(function() playArea.call("updateLocations", { guid }) end, 1)
|
|
|
|
end
|
2022-10-19 19:07:47 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
-- creates the main button
|
|
|
|
function createOpenCloseButton()
|
2022-12-13 14:02:30 -05:00
|
|
|
BUTTON_PARAMETERS.tooltip = (controlActive and "Close" or "Open") .. " Playmat Panel"
|
2022-10-19 19:07:47 -04:00
|
|
|
self.createButton(BUTTON_PARAMETERS)
|
|
|
|
end
|
2022-12-13 14:02:30 -05:00
|
|
|
end)
|
|
|
|
return __bundle_require("__root")
|