From 38abb7ea0c25dd6e2ccbb85d529ccf93c2dad0a6 Mon Sep 17 00:00:00 2001 From: Chr1Z93 Date: Thu, 5 Jan 2023 16:29:25 +0100 Subject: [PATCH] update position, remove personal information --- objects/PlaymatImageSwapper.b7b45b.json | 10 +++--- src/core/PlayAreaSelector.ttslua | 48 ++++++++----------------- 2 files changed, 19 insertions(+), 39 deletions(-) diff --git a/objects/PlaymatImageSwapper.b7b45b.json b/objects/PlaymatImageSwapper.b7b45b.json index 4408ee70..d5919134 100644 --- a/objects/PlaymatImageSwapper.b7b45b.json +++ b/objects/PlaymatImageSwapper.b7b45b.json @@ -22,7 +22,7 @@ "ImageURL": "https://i.imgur.com/gs1mtXJ.png", "WidthScale": 0 }, - "Description": "Allows changing of the playmat image. Provide URL to the image or leave empty for default image.\n\nSee context menu for additional information.", + "Description": "Allows changing of the playmat image. Provide URL to the image or leave empty for default image.", "DragSelectable": true, "GMNotes": "", "GUID": "b7b45b", @@ -34,7 +34,7 @@ "LayoutGroupSortIndex": 0, "Locked": true, "LuaScript": "require(\"core/PlayAreaSelector\")", - "LuaScriptState": "{\"cd\":{\"move\":false,\"scale\":false},\"tid\":[]}", + "LuaScriptState": "", "MeasureMovement": false, "Name": "Custom_Token", "Nickname": "Playmat Image Swapper", @@ -42,9 +42,9 @@ "Sticky": true, "Tooltip": true, "Transform": { - "posX": -10.358, - "posY": 1.675, - "posZ": 17.063, + "posX": -10.36, + "posY": 1.5, + "posZ": 17.06, "rotX": 0, "rotY": 270, "rotZ": 0, diff --git a/src/core/PlayAreaSelector.ttslua b/src/core/PlayAreaSelector.ttslua index d100ecc9..cdc197d7 100644 --- a/src/core/PlayAreaSelector.ttslua +++ b/src/core/PlayAreaSelector.ttslua @@ -1,32 +1,16 @@ --- Playmat Image Swapper --- updated by: Chr1Z --- original by: - --- description: changes the big playmats image -information = { - version = "1.2", - last_updated = "12.11.2022" -} - -defaultURL = "http://cloud-3.steamusercontent.com/ugc/998015670465071049/FFAE162920D67CF38045EFBD3B85AD0F916147B2/" +local controlActive = false +local DEFAULT_URL = "http://cloud-3.steamusercontent.com/ugc/998015670465071049/FFAE162920D67CF38045EFBD3B85AD0F916147B2/" -- parameters for open/close button for reusing -local BUTTON_PARAMETERS = {} -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 } +local buttonParameters = {} +buttonParameters.function_owner = self +buttonParameters.click_function = "click_toggleControl" +buttonParameters.height = 1500 +buttonParameters.width = 1500 +buttonParameters.color = { 1, 1, 1, 0 } function onLoad() - 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 @@ -78,11 +62,7 @@ end -- click function for apply button function click_applySurface(_, _, isRightClick) - if isRightClick then - updateSurface() - else - updateSurface(self.getInputs()[1].value) - end + updateSurface(isRightClick and "" or self.getInputs()[1].value) end -- input function for the input box @@ -93,17 +73,17 @@ function updateSurface(newURL) local playArea = getObjectFromGUID("721ba2") local customInfo = playArea.getCustomObject() - if newURL ~= "" and newURL ~= nil and newURL ~= defaultURL then + if newURL ~= "" and newURL ~= nil and newURL ~= DEFAULT_URL then customInfo.image = newURL broadcastToAll("New Playmat Image Applied", { 0.2, 0.9, 0.2 }) else - customInfo.image = defaultURL + customInfo.image = DEFAULT_URL broadcastToAll("Default Playmat Image Applied", { 0.2, 0.9, 0.2 }) end playArea.setCustomObject(customInfo) - -- get custom data helper and call it after reloading + -- get custom data helper and call the playarea with it after reloading local guid = playArea.getVar("customDataHelper") playArea = playArea.reload() @@ -114,6 +94,6 @@ end -- creates the main button function createOpenCloseButton() - BUTTON_PARAMETERS.tooltip = (controlActive and "Close" or "Open") .. " Playmat Panel" - self.createButton(BUTTON_PARAMETERS) + buttonParameters.tooltip = (controlActive and "Close" or "Open") .. " Playmat Panel" + self.createButton(buttonParameters) end