bugfixing and formatting

This commit is contained in:
Chr1Z93 2024-06-26 13:59:20 +02:00
parent b668146ba4
commit 6988ce170b
10 changed files with 647 additions and 596 deletions

View File

@ -37,7 +37,7 @@
{ {
"Name": "Playermat-Seeker-Cache", "Name": "Playermat-Seeker-Cache",
"Type": 0, "Type": 0,
"URL": "http://cloud-3.steamusercontent.com/ugc/2444972799638880905/CFC02BF5A6140B9B4B92312AD6DC74D8DD61180B/" "URL": "http://cloud-3.steamusercontent.com/ugc/2462982115659543571/5D778EA4BC682DAE97E8F59A991BCF8CB3979B04/"
}, },
{ {
"Name": "Playermat-Survivor-Cache", "Name": "Playermat-Survivor-Cache",

View File

@ -1,12 +1,10 @@
tableHeightOffset = -9 tableHeightOffset = -9
function onSave() function onSave()
saved_data = JSON.encode({tid=tableImageData, cd=checkData}) return JSON.encode({ tid = tableImageData, cd = checkData })
--saved_data = ""
return saved_data
end end
function onload(saved_data) function onload(saved_data)
--Loads the tracking for if the game has started yet
if saved_data ~= "" then if saved_data ~= "" then
local loaded_data = JSON.decode(saved_data) local loaded_data = JSON.decode(saved_data)
tableImageData = loaded_data.tid tableImageData = loaded_data.tid
@ -37,12 +35,8 @@ function onload(saved_data)
createOpenCloseButton() createOpenCloseButton()
end end
--Activation/deactivation of control panel --Activation/deactivation of control panel
--Activated by clicking on --Activated by clicking on
function click_toggleControl(_, color) function click_toggleControl(_, color)
if permissionCheck(color) then if permissionCheck(color) then
@ -61,18 +55,12 @@ function click_toggleControl(_, color)
self.clearButtons() self.clearButtons()
self.clearInputs() self.clearInputs()
createOpenCloseButton() createOpenCloseButton()
end end
end end
end end
--Table surface control --Table surface control
--Changes table surface --Changes table surface
function click_applySurface(_, color) function click_applySurface(_, color)
if permissionCheck(color) then if permissionCheck(color) then
@ -139,12 +127,8 @@ function updateSurface()
obj_surface = obj_surface.reload() obj_surface = obj_surface.reload()
end end
--Table Scale control --Table Scale control
--Applies Scale to table pieces --Applies Scale to table pieces
function click_applyScale(_, color) function click_applyScale(_, color)
if permissionCheck(color) then if permissionCheck(color) then
@ -280,7 +264,6 @@ function moveHandZone(p, width2pos, depth2pos)
end end
end end
---Scales hand zones, p=player reference, facts are scaling factors ---Scales hand zones, p=player reference, facts are scaling factors
function scaleHandZone(p, width, depth) function scaleHandZone(p, width, depth)
local widthFact = width / obj_side_top.getScale().x local widthFact = width / obj_side_top.getScale().x
@ -299,12 +282,8 @@ function scaleHandZone(p, width, depth)
end end
end end
--Information gathering --Information gathering
--Checks if a color is promoted or host --Checks if a color is promoted or host
function permissionCheck(color) function permissionCheck(color)
if Player[color].host == true or Player[color].promoted == true then if Player[color].host == true or Player[color].promoted == true then
@ -343,21 +322,22 @@ function findButton(obj, func)
return nil return nil
end end
--Creation of buttons/inputs --Creation of buttons/inputs
function createOpenCloseButton() function createOpenCloseButton()
local tooltip = "Open Table Control Panel" local tooltip = "Open Table Control Panel"
if controlActive then if controlActive then
tooltip = "Close Table Control Panel" tooltip = "Close Table Control Panel"
end end
self.createButton({ self.createButton({
click_function="click_toggleControl", function_owner=self, click_function = "click_toggleControl",
position={0,0,0}, rotation={-45,0,0}, height=400, width=400, function_owner = self,
color={1,1,1,0}, tooltip=tooltip position = { 0, 0, 0 },
rotation = { -45, 0, 0 },
height = 400,
width = 400,
color = { 1, 1, 1, 0 },
tooltip = tooltip
}) })
end end
@ -368,15 +348,27 @@ function createSurfaceInput()
nickname = tableImageData[findInImageDataIndex(currentURL)].name nickname = tableImageData[findInImageDataIndex(currentURL)].name
end end
self.createInput({ self.createInput({
label="Nickname", input_function="none", function_owner=self, label = "Nickname",
alignment=3, position={0,0,2}, height=224, width=4000, input_function = "none",
font_size=200, tooltip="Enter nickname for table image (only used for save)", function_owner = self,
alignment = 3,
position = { 0, 0, 2 },
height = 224,
width = 4000,
font_size = 200,
tooltip = "Enter nickname for table image (only used for save)",
value = nickname value = nickname
}) })
self.createInput({ self.createInput({
label="URL", input_function="none", function_owner=self, label = "URL",
alignment=3, position={0,0,3}, height=224, width=4000, input_function = "none",
font_size=200, tooltip="Enter URL for tabletop image", function_owner = self,
alignment = 3,
position = { 0, 0, 3 },
height = 224,
width = 4000,
font_size = 200,
tooltip = "Enter URL for tabletop image",
value = currentURL value = currentURL
}) })
end end
@ -384,24 +376,44 @@ end
function createSurfaceButtons() function createSurfaceButtons()
--Label --Label
self.createButton({ self.createButton({
label="Tabletop Surface Image", click_function="none", label = "Tabletop Surface Image",
position={0,0,1}, height=0, width=0, font_size=300, font_color={1,1,1} click_function = "none",
position = { 0, 0, 1 },
height = 0,
width = 0,
font_size = 300,
font_color = { 1, 1, 1 }
}) })
--Functional --Functional
self.createButton({ self.createButton({
label="Apply Image\nTo Table", click_function="click_applySurface", label = "Apply Image\nTo Table",
function_owner=self, tooltip="Apply URL as table image", click_function = "click_applySurface",
position={2,0,4}, height=440, width=1400, font_size=200, function_owner = self,
tooltip = "Apply URL as table image",
position = { 2, 0, 4 },
height = 440,
width = 1400,
font_size = 200,
}) })
self.createButton({ self.createButton({
label="Save Image\nTo Memory", click_function="click_saveSurface", label = "Save Image\nTo Memory",
function_owner=self, tooltip="Record URL into memory (requires nickname)", click_function = "click_saveSurface",
position={-2,0,4}, height=440, width=1400, font_size=200, function_owner = self,
tooltip = "Record URL into memory (requires nickname)",
position = { -2, 0, 4 },
height = 440,
width = 1400,
font_size = 200,
}) })
--Label --Label
self.createButton({ self.createButton({
label="Load From Memory", click_function="none", label = "Load From Memory",
position={0,0,5.5}, height=0, width=0, font_size=300, font_color={1,1,1} click_function = "none",
position = { 0, 0, 5.5 },
height = 0,
width = 0,
font_size = 300,
font_color = { 1, 1, 1 }
}) })
--Saves, created dynamically from memory file --Saves, created dynamically from memory file
for i, memoryEntry in ipairs(tableImageData) do for i, memoryEntry in ipairs(tableImageData) do
@ -410,34 +422,57 @@ function createSurfaceButtons()
local func = function(x, y) click_loadMemory(x, y, i) end local func = function(x, y) click_loadMemory(x, y, i) end
self.setVar(funcName, func) self.setVar(funcName, func)
self.createButton({ self.createButton({
label=memoryEntry.name, click_function=funcName, label = memoryEntry.name,
function_owner=self, tooltip=memoryEntry.url, font_size=200, click_function = funcName,
position={-0.6,0,6.5+0.5*(i-1)}, height=240, width=3300, function_owner = self,
tooltip = memoryEntry.url,
font_size = 200,
position = { -0.6, 0, 6.5 + 0.5 * (i - 1) },
height = 240,
width = 3300,
}) })
--Delete --Delete
local funcName = i .. "deleteMemory" local funcName = i .. "deleteMemory"
local func = function(x, y) click_deleteMemory(x, y, i) end local func = function(x, y) click_deleteMemory(x, y, i) end
self.setVar(funcName, func) self.setVar(funcName, func)
self.createButton({ self.createButton({
label="DELETE", click_function=funcName, label = "DELETE",
function_owner=self, tooltip="", click_function = funcName,
position={3.6,0,6.5+0.5*(i-1)}, height=240, width=600, function_owner = self,
font_size=160, font_color={1,0,0}, color={0.8,0.8,0.8} tooltip = "",
position = { 3.6, 0, 6.5 + 0.5 * (i - 1) },
height = 240,
width = 600,
font_size = 160,
font_color = { 1, 0, 0 },
color = { 0.8, 0.8, 0.8 }
}) })
end end
end end
function createScaleInput() function createScaleInput()
self.createInput({ self.createInput({
label=string.char(8644), input_function="none", function_owner=self, label = string.char(8644),
alignment=3, position={-8.5,0,2}, height=224, width=400, input_function = "none",
font_size=200, tooltip="Table Width", function_owner = self,
alignment = 3,
position = { -8.5, 0, 2 },
height = 224,
width = 400,
font_size = 200,
tooltip = "Table Width",
value = round(obj_side_top.getScale().x, 1) value = round(obj_side_top.getScale().x, 1)
}) })
self.createInput({ self.createInput({
label=string.char(8645), input_function="none", function_owner=self, label = string.char(8645),
alignment=3, position={-7.5,0,2}, height=224, width=400, input_function = "none",
font_size=200, tooltip="Table Depth", function_owner = self,
alignment = 3,
position = { -7.5, 0, 2 },
height = 224,
width = 400,
font_size = 200,
tooltip = "Table Depth",
value = round(obj_side_lef.getScale().x, 1) value = round(obj_side_lef.getScale().x, 1)
}) })
end end
@ -445,17 +480,31 @@ end
function createScaleButtons() function createScaleButtons()
--Labels --Labels
self.createButton({ self.createButton({
label="Table Scale", click_function="none", label = "Table Scale",
position={-8,0,1}, height=0, width=0, font_size=300, font_color={1,1,1} click_function = "none",
position = { -8, 0, 1 },
height = 0,
width = 0,
font_size = 300,
font_color = { 1, 1, 1 }
}) })
self.createButton({ self.createButton({
label = string.char(8644) .. " " .. string.char(8645), label = string.char(8644) .. " " .. string.char(8645),
click_function = "none", click_function = "none",
position={-8,0,2}, height=0, width=0, font_size=300, font_color={1,1,1} position = { -8, 0, 2 },
height = 0,
width = 0,
font_size = 300,
font_color = { 1, 1, 1 }
}) })
self.createButton({ self.createButton({
label="Move Hands:", click_function="none", label = "Move Hands:",
position={-8.3,0,3}, height=0, width=0, font_size=200, font_color={1,1,1} click_function = "none",
position = { -8.3, 0, 3 },
height = 0,
width = 0,
font_size = 200,
font_color = { 1, 1, 1 }
}) })
--Disabled due to me removing the feature for technical reasons --Disabled due to me removing the feature for technical reasons
--[[ --[[
@ -468,9 +517,14 @@ function createScaleButtons()
local label = "" local label = ""
if checkData.move == true then label = string.char(10008) end if checkData.move == true then label = string.char(10008) end
self.createButton({ self.createButton({
label=label, click_function="click_checkMove", label = label,
function_owner=self, tooltip="Check to move hands when table is rescaled", click_function = "click_checkMove",
position={-6.8,0,3}, height=224, width=224, font_size=200, function_owner = self,
tooltip = "Check to move hands when table is rescaled",
position = { -6.8, 0, 3 },
height = 224,
width = 224,
font_size = 200,
}) })
--[[ --[[
local label = "" local label = ""
@ -483,21 +537,19 @@ function createScaleButtons()
]] ]]
--Apply button --Apply button
self.createButton({ self.createButton({
label="Apply Scale", click_function="click_applyScale", label = "Apply Scale",
function_owner=self, tooltip="Apply width/depth to table", click_function = "click_applyScale",
position={-8,0,4}, height=440, width=1400, font_size=200, function_owner = self,
tooltip = "Apply width/depth to table",
position = { -8, 0, 4 },
height = 440,
width = 1400,
font_size = 200,
}) })
end end
--Data tables --Data tables
ref_noninteractable = { ref_noninteractable = {
"afc863", "c8edca", "393bf7", "12c65e", "f938a2", "9f95fd", "35b95f", "afc863", "c8edca", "393bf7", "12c65e", "f938a2", "9f95fd", "35b95f",
"5af8f2", "4ee1f2", "bd69bd" "5af8f2", "4ee1f2", "bd69bd"

View File

@ -41,7 +41,7 @@
"LayoutGroupSortIndex": 0, "LayoutGroupSortIndex": 0,
"Locked": false, "Locked": false,
"LuaScript": "require(\"core/UniversalActionAbilityToken\")", "LuaScript": "require(\"core/UniversalActionAbilityToken\")",
"LuaScriptState": "", "LuaScriptState": "{\"class\":\"Neutral\",\"symbol\":\"Neutral\"}",
"MeasureMovement": false, "MeasureMovement": false,
"Memo": "universalActionAbility", "Memo": "universalActionAbility",
"Name": "Custom_Tile", "Name": "Custom_Tile",

View File

@ -11,9 +11,6 @@ local phaseImages = {
"http://cloud-3.steamusercontent.com/ugc/982233321870237261/C287CAED2423970F33E72D6C7415CBEC6794C533/" "http://cloud-3.steamusercontent.com/ugc/982233321870237261/C287CAED2423970F33E72D6C7415CBEC6794C533/"
} }
-- these are intentionally global for remote updating
-- phaseId, broadcastChange
function onSave() function onSave()
return JSON.encode({ return JSON.encode({
phaseId = phaseId, phaseId = phaseId,
@ -21,11 +18,15 @@ function onSave()
}) })
end end
function loadFromSaveTable(savedData)
for var, val in pairs(JSON.decode(savedData)) do
_G[var] = val
end
end
function onLoad(savedData) function onLoad(savedData)
if savedData and savedData ~= "" then if savedData and savedData ~= "" then
local loadedData = JSON.decode(savedData) loadFromSaveTable(savedData)
phaseId = loadedData.phaseId
broadcastChange = loadedData.broadcastChange
else else
phaseId = 1 phaseId = 1
broadcastChange = false broadcastChange = false

View File

@ -1,5 +1,9 @@
local searchLib = require("util/SearchLib") local searchLib = require("util/SearchLib")
function onSave()
return JSON.encode({ saved_hiddenCards = hiddenCards })
end
function onload(savedData) function onload(savedData)
revealCardPositions = { revealCardPositions = {
Vector(3.5, 0.25, 0), Vector(3.5, 0.25, 0),
@ -30,7 +34,7 @@ function onload(savedData)
self.addContextMenuItem('Reset helper', resetHelper) self.addContextMenuItem('Reset helper', resetHelper)
if savedData ~= '' then if savedData and savedData ~= '' then
local loaded_data = JSON.decode(savedData) local loaded_data = JSON.decode(savedData)
hiddenCards = loaded_data.saved_hiddenCards hiddenCards = loaded_data.saved_hiddenCards
@ -39,12 +43,6 @@ function onload(savedData)
end end
end end
function onSave()
return JSON.encode({
saved_hiddenCards = hiddenCards
})
end
function onObjectEnterContainer(container, object) function onObjectEnterContainer(container, object)
if container ~= self then return end if container ~= self then return end

View File

@ -483,13 +483,12 @@ modeData = {
} }
function onSave() function onSave()
local globalState = JSON.encode(SPAWNED_PLAYER_CARD_GUIDS) return JSON.encode(SPAWNED_PLAYER_CARD_GUIDS)
return globalState
end end
function onLoad(save_state) function onLoad(savedData)
if save_state ~= '' then if savedData and savedData ~= '' then
SPAWNED_PLAYER_CARD_GUIDS = JSON.decode(save_state) SPAWNED_PLAYER_CARD_GUIDS = JSON.decode(savedData)
else else
SPAWNED_PLAYER_CARD_GUIDS = {} SPAWNED_PLAYER_CARD_GUIDS = {}
end end

View File

@ -22,7 +22,14 @@ local ENCOUNTER_DISCARD_POSITION = { x = -3.85, y = 1, z = 10.38 }
local isReshuffling = false local isReshuffling = false
local collisionEnabled = false local collisionEnabled = false
local currentScenario, useFrontData, tokenData local currentScenario, useFrontData, tokenData
local TRASH, DATA_HELPER
function onSave()
return JSON.encode({
currentScenario = currentScenario,
useFrontData = useFrontData,
tokenData = tokenData
})
end
function onLoad(savedData) function onLoad(savedData)
if savedData and savedData ~= "" then if savedData and savedData ~= "" then
@ -31,20 +38,9 @@ function onLoad(savedData)
useFrontData = loadedState.useFrontData or true useFrontData = loadedState.useFrontData or true
tokenData = loadedState.tokenData or {} tokenData = loadedState.tokenData or {}
end end
TRASH = guidReferenceApi.getObjectByOwnerAndType("Mythos", "Trash")
DATA_HELPER = guidReferenceApi.getObjectByOwnerAndType("Mythos", "DataHelper")
Wait.time(function() collisionEnabled = true end, 0.1) Wait.time(function() collisionEnabled = true end, 0.1)
end end
function onSave()
return JSON.encode({
currentScenario = currentScenario,
useFrontData = useFrontData,
tokenData = tokenData
})
end
--------------------------------------------------------- ---------------------------------------------------------
-- collison and container event handling -- collison and container event handling
--------------------------------------------------------- ---------------------------------------------------------
@ -182,6 +178,7 @@ end
-- draw the provided card to the requesting playermat -- draw the provided card to the requesting playermat
function actualEncounterCardDraw(card, params) function actualEncounterCardDraw(card, params)
local metadata = JSON.decode(card.getGMNotes()) or {} local metadata = JSON.decode(card.getGMNotes()) or {}
local DATA_HELPER = guidReferenceApi.getObjectByOwnerAndType("Mythos", "DataHelper")
-- draw hidden cards facedown -- draw hidden cards facedown
local faceUpRotation = 0 local faceUpRotation = 0
@ -249,6 +246,7 @@ end
-- removes tokens from the provided card/deck -- removes tokens from the provided card/deck
function removeTokensFromObject(object) function removeTokensFromObject(object)
local TRASH = guidReferenceApi.getObjectByOwnerAndType("Mythos", "Trash")
for _, obj in ipairs(searchLib.onObject(object)) do for _, obj in ipairs(searchLib.onObject(object)) do
if obj.getGUID() ~= "4ee1f2" and -- table if obj.getGUID() ~= "4ee1f2" and -- table
obj ~= self and obj ~= self and

View File

@ -89,13 +89,9 @@ function onLoad(savedData)
pitch = loadedData.pitch pitch = loadedData.pitch
distance = loadedData.distance distance = loadedData.distance
else else
local allColors = Player.getColors() -- initialize tables with defaults
for _, color in ipairs(Player.getColors()) do
for _, color in ipairs(allColors) do
-- default state for claims
claims[color] = {} claims[color] = {}
-- default state for visibility
visibility[color] = { full = false, play = false } visibility[color] = { full = false, play = false }
end end
end end

View File

@ -3,7 +3,12 @@ local optionPanelApi = require("core/OptionPanelApi")
local playAreaApi = require("core/PlayAreaApi") local playAreaApi = require("core/PlayAreaApi")
local typeIndex, selectionIndex, plainNameCache local typeIndex, selectionIndex, plainNameCache
function onSave() return JSON.encode({ typeIndex = typeIndex, selectionIndex = selectionIndex }) end function onSave()
return JSON.encode({
typeIndex = typeIndex,
selectionIndex = selectionIndex
})
end
function onLoad(savedData) function onLoad(savedData)
if savedData and savedData ~= "" then if savedData and savedData ~= "" then

View File

@ -23,7 +23,9 @@ inputParameters.scale = { 0.1, 1, 0.1 }
inputParameters.color = { 0.9, 0.7, 0.5 } inputParameters.color = { 0.9, 0.7, 0.5 }
inputParameters.font_color = { 0, 0, 0 } inputParameters.font_color = { 0, 0, 0 }
function onSave() return JSON.encode({ spawnAll, searchExact, inputParameters.value }) end function onSave()
return JSON.encode({ spawnAll, searchExact, inputParameters.value })
end
function onLoad(savedData) function onLoad(savedData)
local loadedData = JSON.decode(savedData) local loadedData = JSON.decode(savedData)