bugfixing and formatting
This commit is contained in:
parent
b668146ba4
commit
6988ce170b
@ -37,7 +37,7 @@
|
||||
{
|
||||
"Name": "Playermat-Seeker-Cache",
|
||||
"Type": 0,
|
||||
"URL": "http://cloud-3.steamusercontent.com/ugc/2444972799638880905/CFC02BF5A6140B9B4B92312AD6DC74D8DD61180B/"
|
||||
"URL": "http://cloud-3.steamusercontent.com/ugc/2462982115659543571/5D778EA4BC682DAE97E8F59A991BCF8CB3979B04/"
|
||||
},
|
||||
{
|
||||
"Name": "Playermat-Survivor-Cache",
|
||||
|
@ -1,19 +1,17 @@
|
||||
tableHeightOffset =-9
|
||||
tableHeightOffset = -9
|
||||
|
||||
function onSave()
|
||||
saved_data = JSON.encode({tid=tableImageData, cd=checkData})
|
||||
--saved_data = ""
|
||||
return saved_data
|
||||
return JSON.encode({ tid = tableImageData, cd = checkData })
|
||||
end
|
||||
|
||||
function onload(saved_data)
|
||||
--Loads the tracking for if the game has started yet
|
||||
if saved_data ~= "" then
|
||||
local loaded_data = JSON.decode(saved_data)
|
||||
tableImageData = loaded_data.tid
|
||||
checkData = loaded_data.cd
|
||||
else
|
||||
tableImageData = {}
|
||||
checkData = {move=false, scale=false}
|
||||
checkData = { move = false, scale = false }
|
||||
end
|
||||
|
||||
--Disables interactable status of objects with GUID in list
|
||||
@ -37,12 +35,8 @@ function onload(saved_data)
|
||||
createOpenCloseButton()
|
||||
end
|
||||
|
||||
|
||||
|
||||
--Activation/deactivation of control panel
|
||||
|
||||
|
||||
|
||||
--Activated by clicking on
|
||||
function click_toggleControl(_, color)
|
||||
if permissionCheck(color) then
|
||||
@ -61,23 +55,17 @@ function click_toggleControl(_, color)
|
||||
self.clearButtons()
|
||||
self.clearInputs()
|
||||
createOpenCloseButton()
|
||||
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
|
||||
|
||||
--Table surface control
|
||||
|
||||
|
||||
|
||||
--Changes table surface
|
||||
function click_applySurface(_, color)
|
||||
if permissionCheck(color) then
|
||||
updateSurface()
|
||||
broadcastToAll("New Table Image Applied", {0.2,0.9,0.2})
|
||||
broadcastToAll("New Table Image Applied", { 0.2, 0.9, 0.2 })
|
||||
end
|
||||
end
|
||||
|
||||
@ -88,14 +76,14 @@ function click_saveSurface(_, color)
|
||||
local url = self.getInputs()[2].value
|
||||
if nickname == "" then
|
||||
--No nickname
|
||||
broadcastToAll("Please supply a nickname for this save.", {0.9,0.2,0.2})
|
||||
broadcastToAll("Please supply a nickname for this save.", { 0.9, 0.2, 0.2 })
|
||||
else
|
||||
--Nickname exists
|
||||
|
||||
if findInImageDataIndex(url, nickname) == nil then
|
||||
--Save doesn't exist already
|
||||
table.insert(tableImageData, {url=url, name=nickname})
|
||||
broadcastToAll("Image URL saved to memory.", {0.2,0.9,0.2})
|
||||
table.insert(tableImageData, { url = url, name = nickname })
|
||||
broadcastToAll("Image URL saved to memory.", { 0.2, 0.9, 0.2 })
|
||||
--Refresh buttons
|
||||
self.clearButtons()
|
||||
createOpenCloseButton()
|
||||
@ -103,7 +91,7 @@ function click_saveSurface(_, color)
|
||||
createScaleButtons()
|
||||
else
|
||||
--Save exists already
|
||||
broadcastToAll("Memory already contains a save with this Name or URL. Delete it first.", {0.9,0.2,0.2})
|
||||
broadcastToAll("Memory already contains a save with this Name or URL. Delete it first.", { 0.9, 0.2, 0.2 })
|
||||
end
|
||||
end
|
||||
end
|
||||
@ -112,10 +100,10 @@ end
|
||||
--Loads table surface
|
||||
function click_loadMemory(_, color, index)
|
||||
if permissionCheck(color) then
|
||||
self.editInput({index=0, value=tableImageData[index].name})
|
||||
self.editInput({index=1, value=tableImageData[index].url})
|
||||
self.editInput({ index = 0, value = tableImageData[index].name })
|
||||
self.editInput({ index = 1, value = tableImageData[index].url })
|
||||
updateSurface()
|
||||
broadcastToAll("Table Image Loaded", {0.2,0.9,0.2})
|
||||
broadcastToAll("Table Image Loaded", { 0.2, 0.9, 0.2 })
|
||||
end
|
||||
end
|
||||
|
||||
@ -127,7 +115,7 @@ function click_deleteMemory(_, color, index)
|
||||
createOpenCloseButton()
|
||||
createSurfaceButtons()
|
||||
createScaleButtons()
|
||||
broadcastToAll("Element Removed from Memory", {0.2,0.9,0.2})
|
||||
broadcastToAll("Element Removed from Memory", { 0.2, 0.9, 0.2 })
|
||||
end
|
||||
end
|
||||
|
||||
@ -139,32 +127,28 @@ function updateSurface()
|
||||
obj_surface = obj_surface.reload()
|
||||
end
|
||||
|
||||
|
||||
|
||||
--Table Scale control
|
||||
|
||||
|
||||
|
||||
--Applies Scale to table pieces
|
||||
function click_applyScale(_, color)
|
||||
if permissionCheck(color) then
|
||||
local newWidth = tonumber(self.getInputs()[3].value)
|
||||
local newDepth = tonumber(self.getInputs()[4].value)
|
||||
if type(newWidth) ~= "number" then
|
||||
broadcastToAll("Invalid Width", {0.9,0.2,0.2})
|
||||
broadcastToAll("Invalid Width", { 0.9, 0.2, 0.2 })
|
||||
return
|
||||
elseif type(newDepth) ~= "number" then
|
||||
broadcastToAll("Invalid Depth", {0.9,0.2,0.2})
|
||||
broadcastToAll("Invalid Depth", { 0.9, 0.2, 0.2 })
|
||||
return
|
||||
elseif newWidth<0.1 or newDepth<0.1 then
|
||||
broadcastToAll("Scale cannot go below 0.1", {0.9,0.2,0.2})
|
||||
elseif newWidth < 0.1 or newDepth < 0.1 then
|
||||
broadcastToAll("Scale cannot go below 0.1", { 0.9, 0.2, 0.2 })
|
||||
return
|
||||
elseif newWidth>12 or newDepth>12 then
|
||||
broadcastToAll("Scale should not go over 12 (world size limitation)", {0.9,0.2,0.2})
|
||||
elseif newWidth > 12 or newDepth > 12 then
|
||||
broadcastToAll("Scale should not go over 12 (world size limitation)", { 0.9, 0.2, 0.2 })
|
||||
return
|
||||
else
|
||||
changeTableScale(math.abs(newWidth), math.abs(newDepth))
|
||||
broadcastToAll("Scale applied.", {0.2,0.9,0.2})
|
||||
broadcastToAll("Scale applied.", { 0.2, 0.9, 0.2 })
|
||||
end
|
||||
end
|
||||
end
|
||||
@ -172,15 +156,15 @@ end
|
||||
--Checks/unchecks move box for hands
|
||||
function click_checkMove(_, color)
|
||||
if permissionCheck(color) then
|
||||
local find_func = function(o) return o.click_function=="click_checkMove" end
|
||||
local find_func = function(o) return o.click_function == "click_checkMove" end
|
||||
if checkData.move == true then
|
||||
checkData.move = false
|
||||
local buttonEntry = findButton(self, find_func)
|
||||
self.editButton({index=buttonEntry.index, label=""})
|
||||
self.editButton({ index = buttonEntry.index, label = "" })
|
||||
else
|
||||
checkData.move = true
|
||||
local buttonEntry = findButton(self, find_func)
|
||||
self.editButton({index=buttonEntry.index, label=string.char(10008)})
|
||||
self.editButton({ index = buttonEntry.index, label = string.char(10008) })
|
||||
end
|
||||
end
|
||||
end
|
||||
@ -207,8 +191,8 @@ end
|
||||
--Alters scale of elements and moves them
|
||||
function changeTableScale(width, depth)
|
||||
--Scaling factors used to translate scale to position offset
|
||||
local width2pos = (width-1) * 18
|
||||
local depth2pos = (depth-1) * 18
|
||||
local width2pos = (width - 1) * 18
|
||||
local depth2pos = (depth - 1) * 18
|
||||
|
||||
--Hand zone movement
|
||||
if checkData.move == true then
|
||||
@ -229,22 +213,22 @@ function changeTableScale(width, depth)
|
||||
end
|
||||
|
||||
--Resizing table elements
|
||||
obj_side_top.setScale({width, 1, 1})
|
||||
obj_side_bot.setScale({width, 1, 1})
|
||||
obj_side_lef.setScale({depth, 1, 1})
|
||||
obj_side_rig.setScale({depth, 1, 1})
|
||||
obj_surface.setScale({width, 1, depth})
|
||||
obj_side_top.setScale({ width, 1, 1 })
|
||||
obj_side_bot.setScale({ width, 1, 1 })
|
||||
obj_side_lef.setScale({ depth, 1, 1 })
|
||||
obj_side_rig.setScale({ depth, 1, 1 })
|
||||
obj_surface.setScale({ width, 1, depth })
|
||||
|
||||
--Moving table elements to accomodate new scale
|
||||
obj_side_lef.setPosition({-width2pos,tableHeightOffset,0})
|
||||
obj_side_rig.setPosition({ width2pos,tableHeightOffset,0})
|
||||
obj_side_top.setPosition({0,tableHeightOffset, depth2pos})
|
||||
obj_side_bot.setPosition({0,tableHeightOffset,-depth2pos})
|
||||
obj_leg1.setPosition({-width2pos,tableHeightOffset,-depth2pos})
|
||||
obj_leg2.setPosition({-width2pos,tableHeightOffset, depth2pos})
|
||||
obj_leg3.setPosition({ width2pos,tableHeightOffset, depth2pos})
|
||||
obj_leg4.setPosition({ width2pos,tableHeightOffset,-depth2pos})
|
||||
self.setPosition(obj_leg4.positionToWorld({-22.12, 8.74,-19.16}))
|
||||
obj_side_lef.setPosition({ -width2pos, tableHeightOffset, 0 })
|
||||
obj_side_rig.setPosition({ width2pos, tableHeightOffset, 0 })
|
||||
obj_side_top.setPosition({ 0, tableHeightOffset, depth2pos })
|
||||
obj_side_bot.setPosition({ 0, tableHeightOffset, -depth2pos })
|
||||
obj_leg1.setPosition({ -width2pos, tableHeightOffset, -depth2pos })
|
||||
obj_leg2.setPosition({ -width2pos, tableHeightOffset, depth2pos })
|
||||
obj_leg3.setPosition({ width2pos, tableHeightOffset, depth2pos })
|
||||
obj_leg4.setPosition({ width2pos, tableHeightOffset, -depth2pos })
|
||||
self.setPosition(obj_leg4.positionToWorld({ -22.12, 8.74, -19.16 }))
|
||||
--Only enabled when changing tableHeightOffset
|
||||
--obj_surface.setPosition({0,tableHeightOffset,0})
|
||||
end
|
||||
@ -253,12 +237,12 @@ end
|
||||
function moveHandZone(p, width2pos, depth2pos)
|
||||
local widthX = obj_side_rig.getPosition().x
|
||||
local depthZ = obj_side_top.getPosition().z
|
||||
for i=1, p.getHandCount() do
|
||||
for i = 1, p.getHandCount() do
|
||||
local handT = p.getHandTransform()
|
||||
local pos = handT.position
|
||||
local y = handT.rotation.y
|
||||
|
||||
if y<45 or y>320 or y>135 and y<225 then
|
||||
if y < 45 or y > 320 or y > 135 and y < 225 then
|
||||
if pos.z > 0 then
|
||||
pos.z = pos.z + depth2pos - depthZ
|
||||
else
|
||||
@ -280,16 +264,15 @@ function moveHandZone(p, width2pos, depth2pos)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
---Scales hand zones, p=player reference, facts are scaling factors
|
||||
function scaleHandZone(p, width, depth)
|
||||
local widthFact = width / obj_side_top.getScale().x
|
||||
local depthFact = depth / obj_side_lef.getScale().x
|
||||
for i=1, p.getHandCount() do
|
||||
for i = 1, p.getHandCount() do
|
||||
local handT = p.getHandTransform()
|
||||
local scale = handT.scale
|
||||
local y = handT.rotation.y
|
||||
if y<45 or y>320 or y>135 and y<225 then
|
||||
if y < 45 or y > 320 or y > 135 and y < 225 then
|
||||
scale.x = scale.x * widthFact
|
||||
else
|
||||
scale.x = scale.x * depthFact
|
||||
@ -299,15 +282,11 @@ function scaleHandZone(p, width, depth)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
|
||||
--Information gathering
|
||||
|
||||
|
||||
|
||||
--Checks if a color is promoted or host
|
||||
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
|
||||
return true
|
||||
else
|
||||
return false
|
||||
@ -316,7 +295,7 @@ end
|
||||
|
||||
--Locates a string saved within memory file
|
||||
function findInImageDataIndex(...)
|
||||
for _, str in ipairs({...}) do
|
||||
for _, str in ipairs({ ... }) do
|
||||
for i, v in ipairs(tableImageData) do
|
||||
if v.url == str or v.name == str then
|
||||
return i
|
||||
@ -328,13 +307,13 @@ end
|
||||
|
||||
--Round number (num) to the Nth decimal (dec)
|
||||
function round(num, dec)
|
||||
local mult = 10^(dec or 0)
|
||||
local mult = 10 ^ (dec or 0)
|
||||
return math.floor(num * mult + 0.5) / mult
|
||||
end
|
||||
|
||||
--Locates a button with a helper function
|
||||
function findButton(obj, func)
|
||||
if func==nil then error("No func supplied to findButton") end
|
||||
if func == nil then error("No func supplied to findButton") end
|
||||
for _, v in ipairs(obj.getButtons()) do
|
||||
if func(v) then
|
||||
return v
|
||||
@ -343,21 +322,22 @@ function findButton(obj, func)
|
||||
return nil
|
||||
end
|
||||
|
||||
|
||||
|
||||
--Creation of buttons/inputs
|
||||
|
||||
|
||||
|
||||
function createOpenCloseButton()
|
||||
local tooltip = "Open Table Control Panel"
|
||||
if controlActive then
|
||||
tooltip = "Close Table Control Panel"
|
||||
end
|
||||
self.createButton({
|
||||
click_function="click_toggleControl", function_owner=self,
|
||||
position={0,0,0}, rotation={-45,0,0}, height=400, width=400,
|
||||
color={1,1,1,0}, tooltip=tooltip
|
||||
click_function = "click_toggleControl",
|
||||
function_owner = self,
|
||||
position = { 0, 0, 0 },
|
||||
rotation = { -45, 0, 0 },
|
||||
height = 400,
|
||||
width = 400,
|
||||
color = { 1, 1, 1, 0 },
|
||||
tooltip = tooltip
|
||||
})
|
||||
end
|
||||
|
||||
@ -368,94 +348,163 @@ function createSurfaceInput()
|
||||
nickname = tableImageData[findInImageDataIndex(currentURL)].name
|
||||
end
|
||||
self.createInput({
|
||||
label="Nickname", input_function="none", 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
|
||||
label = "Nickname",
|
||||
input_function = "none",
|
||||
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
|
||||
})
|
||||
self.createInput({
|
||||
label="URL", input_function="none", function_owner=self,
|
||||
alignment=3, position={0,0,3}, height=224, width=4000,
|
||||
font_size=200, tooltip="Enter URL for tabletop image",
|
||||
value=currentURL
|
||||
label = "URL",
|
||||
input_function = "none",
|
||||
function_owner = self,
|
||||
alignment = 3,
|
||||
position = { 0, 0, 3 },
|
||||
height = 224,
|
||||
width = 4000,
|
||||
font_size = 200,
|
||||
tooltip = "Enter URL for tabletop image",
|
||||
value = currentURL
|
||||
})
|
||||
end
|
||||
|
||||
function createSurfaceButtons()
|
||||
--Label
|
||||
self.createButton({
|
||||
label="Tabletop Surface Image", click_function="none",
|
||||
position={0,0,1}, height=0, width=0, font_size=300, font_color={1,1,1}
|
||||
label = "Tabletop Surface Image",
|
||||
click_function = "none",
|
||||
position = { 0, 0, 1 },
|
||||
height = 0,
|
||||
width = 0,
|
||||
font_size = 300,
|
||||
font_color = { 1, 1, 1 }
|
||||
})
|
||||
--Functional
|
||||
self.createButton({
|
||||
label="Apply Image\nTo Table", click_function="click_applySurface",
|
||||
function_owner=self, tooltip="Apply URL as table image",
|
||||
position={2,0,4}, height=440, width=1400, font_size=200,
|
||||
label = "Apply Image\nTo Table",
|
||||
click_function = "click_applySurface",
|
||||
function_owner = self,
|
||||
tooltip = "Apply URL as table image",
|
||||
position = { 2, 0, 4 },
|
||||
height = 440,
|
||||
width = 1400,
|
||||
font_size = 200,
|
||||
})
|
||||
self.createButton({
|
||||
label="Save Image\nTo Memory", click_function="click_saveSurface",
|
||||
function_owner=self, tooltip="Record URL into memory (requires nickname)",
|
||||
position={-2,0,4}, height=440, width=1400, font_size=200,
|
||||
label = "Save Image\nTo Memory",
|
||||
click_function = "click_saveSurface",
|
||||
function_owner = self,
|
||||
tooltip = "Record URL into memory (requires nickname)",
|
||||
position = { -2, 0, 4 },
|
||||
height = 440,
|
||||
width = 1400,
|
||||
font_size = 200,
|
||||
})
|
||||
--Label
|
||||
self.createButton({
|
||||
label="Load From Memory", click_function="none",
|
||||
position={0,0,5.5}, height=0, width=0, font_size=300, font_color={1,1,1}
|
||||
label = "Load From Memory",
|
||||
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
|
||||
for i, memoryEntry in ipairs(tableImageData) do
|
||||
--Load
|
||||
local funcName = i.."loadMemory"
|
||||
local func = function(x,y) click_loadMemory(x,y,i) end
|
||||
local funcName = i .. "loadMemory"
|
||||
local func = function(x, y) click_loadMemory(x, y, i) end
|
||||
self.setVar(funcName, func)
|
||||
self.createButton({
|
||||
label=memoryEntry.name, click_function=funcName,
|
||||
function_owner=self, tooltip=memoryEntry.url, font_size=200,
|
||||
position={-0.6,0,6.5+0.5*(i-1)}, height=240, width=3300,
|
||||
label = memoryEntry.name,
|
||||
click_function = funcName,
|
||||
function_owner = self,
|
||||
tooltip = memoryEntry.url,
|
||||
font_size = 200,
|
||||
position = { -0.6, 0, 6.5 + 0.5 * (i - 1) },
|
||||
height = 240,
|
||||
width = 3300,
|
||||
})
|
||||
--Delete
|
||||
local funcName = i.."deleteMemory"
|
||||
local func = function(x,y) click_deleteMemory(x,y,i) end
|
||||
local funcName = i .. "deleteMemory"
|
||||
local func = function(x, y) click_deleteMemory(x, y, i) end
|
||||
self.setVar(funcName, func)
|
||||
self.createButton({
|
||||
label="DELETE", click_function=funcName,
|
||||
function_owner=self, 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}
|
||||
label = "DELETE",
|
||||
click_function = funcName,
|
||||
function_owner = self,
|
||||
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
|
||||
|
||||
function createScaleInput()
|
||||
self.createInput({
|
||||
label=string.char(8644), input_function="none", 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)
|
||||
label = string.char(8644),
|
||||
input_function = "none",
|
||||
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)
|
||||
})
|
||||
self.createInput({
|
||||
label=string.char(8645), input_function="none", 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)
|
||||
label = string.char(8645),
|
||||
input_function = "none",
|
||||
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)
|
||||
})
|
||||
end
|
||||
|
||||
function createScaleButtons()
|
||||
--Labels
|
||||
self.createButton({
|
||||
label="Table Scale", click_function="none",
|
||||
position={-8,0,1}, height=0, width=0, font_size=300, font_color={1,1,1}
|
||||
label = "Table Scale",
|
||||
click_function = "none",
|
||||
position = { -8, 0, 1 },
|
||||
height = 0,
|
||||
width = 0,
|
||||
font_size = 300,
|
||||
font_color = { 1, 1, 1 }
|
||||
})
|
||||
self.createButton({
|
||||
label=string.char(8644).." "..string.char(8645),
|
||||
click_function="none",
|
||||
position={-8,0,2}, height=0, width=0, font_size=300, font_color={1,1,1}
|
||||
label = string.char(8644) .. " " .. string.char(8645),
|
||||
click_function = "none",
|
||||
position = { -8, 0, 2 },
|
||||
height = 0,
|
||||
width = 0,
|
||||
font_size = 300,
|
||||
font_color = { 1, 1, 1 }
|
||||
})
|
||||
self.createButton({
|
||||
label="Move Hands:", click_function="none",
|
||||
position={-8.3,0,3}, height=0, width=0, font_size=200, font_color={1,1,1}
|
||||
label = "Move Hands:",
|
||||
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
|
||||
--[[
|
||||
@ -468,9 +517,14 @@ function createScaleButtons()
|
||||
local label = ""
|
||||
if checkData.move == true then label = string.char(10008) end
|
||||
self.createButton({
|
||||
label=label, click_function="click_checkMove",
|
||||
function_owner=self, tooltip="Check to move hands when table is rescaled",
|
||||
position={-6.8,0,3}, height=224, width=224, font_size=200,
|
||||
label = label,
|
||||
click_function = "click_checkMove",
|
||||
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 = ""
|
||||
@ -483,24 +537,22 @@ function createScaleButtons()
|
||||
]]
|
||||
--Apply button
|
||||
self.createButton({
|
||||
label="Apply Scale", click_function="click_applyScale",
|
||||
function_owner=self, tooltip="Apply width/depth to table",
|
||||
position={-8,0,4}, height=440, width=1400, font_size=200,
|
||||
label = "Apply Scale",
|
||||
click_function = "click_applyScale",
|
||||
function_owner = self,
|
||||
tooltip = "Apply width/depth to table",
|
||||
position = { -8, 0, 4 },
|
||||
height = 440,
|
||||
width = 1400,
|
||||
font_size = 200,
|
||||
})
|
||||
end
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
--Data tables
|
||||
|
||||
|
||||
|
||||
|
||||
ref_noninteractable = {
|
||||
"afc863","c8edca","393bf7","12c65e","f938a2","9f95fd","35b95f",
|
||||
"5af8f2","4ee1f2","bd69bd"
|
||||
"afc863", "c8edca", "393bf7", "12c65e", "f938a2", "9f95fd", "35b95f",
|
||||
"5af8f2", "4ee1f2", "bd69bd"
|
||||
}
|
||||
|
||||
ref_playerColor = {
|
||||
|
@ -41,7 +41,7 @@
|
||||
"LayoutGroupSortIndex": 0,
|
||||
"Locked": false,
|
||||
"LuaScript": "require(\"core/UniversalActionAbilityToken\")",
|
||||
"LuaScriptState": "",
|
||||
"LuaScriptState": "{\"class\":\"Neutral\",\"symbol\":\"Neutral\"}",
|
||||
"MeasureMovement": false,
|
||||
"Memo": "universalActionAbility",
|
||||
"Name": "Custom_Tile",
|
||||
|
@ -11,9 +11,6 @@ local phaseImages = {
|
||||
"http://cloud-3.steamusercontent.com/ugc/982233321870237261/C287CAED2423970F33E72D6C7415CBEC6794C533/"
|
||||
}
|
||||
|
||||
-- these are intentionally global for remote updating
|
||||
-- phaseId, broadcastChange
|
||||
|
||||
function onSave()
|
||||
return JSON.encode({
|
||||
phaseId = phaseId,
|
||||
@ -21,11 +18,15 @@ function onSave()
|
||||
})
|
||||
end
|
||||
|
||||
function loadFromSaveTable(savedData)
|
||||
for var, val in pairs(JSON.decode(savedData)) do
|
||||
_G[var] = val
|
||||
end
|
||||
end
|
||||
|
||||
function onLoad(savedData)
|
||||
if savedData and savedData ~= "" then
|
||||
local loadedData = JSON.decode(savedData)
|
||||
phaseId = loadedData.phaseId
|
||||
broadcastChange = loadedData.broadcastChange
|
||||
loadFromSaveTable(savedData)
|
||||
else
|
||||
phaseId = 1
|
||||
broadcastChange = false
|
||||
|
@ -1,5 +1,9 @@
|
||||
local searchLib = require("util/SearchLib")
|
||||
|
||||
function onSave()
|
||||
return JSON.encode({ saved_hiddenCards = hiddenCards })
|
||||
end
|
||||
|
||||
function onload(savedData)
|
||||
revealCardPositions = {
|
||||
Vector(3.5, 0.25, 0),
|
||||
@ -15,11 +19,11 @@ function onload(savedData)
|
||||
label = 'Underworld Market\nHelper',
|
||||
click_function = "none",
|
||||
function_owner = self,
|
||||
position = {0,-0.1,-1.6},
|
||||
position = { 0, -0.1, -1.6 },
|
||||
height = 0,
|
||||
width = 0,
|
||||
font_size = 145,
|
||||
font_color = {1,1,1}
|
||||
font_color = { 1, 1, 1 }
|
||||
})
|
||||
|
||||
hiddenCards = 10
|
||||
@ -30,7 +34,7 @@ function onload(savedData)
|
||||
|
||||
self.addContextMenuItem('Reset helper', resetHelper)
|
||||
|
||||
if savedData ~= '' then
|
||||
if savedData and savedData ~= '' then
|
||||
local loaded_data = JSON.decode(savedData)
|
||||
hiddenCards = loaded_data.saved_hiddenCards
|
||||
|
||||
@ -39,12 +43,6 @@ function onload(savedData)
|
||||
end
|
||||
end
|
||||
|
||||
function onSave()
|
||||
return JSON.encode({
|
||||
saved_hiddenCards = hiddenCards
|
||||
})
|
||||
end
|
||||
|
||||
function onObjectEnterContainer(container, object)
|
||||
if container ~= self then return end
|
||||
|
||||
@ -115,29 +113,29 @@ function refreshButtons()
|
||||
label = 'Market Deck:',
|
||||
click_function = "none",
|
||||
function_owner = self,
|
||||
position = {0,-0.1,-1.6},
|
||||
position = { 0, -0.1, -1.6 },
|
||||
height = 0,
|
||||
width = 0,
|
||||
font_size = 150,
|
||||
font_color = {1,1,1}
|
||||
font_color = { 1, 1, 1 }
|
||||
})
|
||||
|
||||
self.createButton({
|
||||
label = cardsList,
|
||||
click_function = "none",
|
||||
function_owner = self,
|
||||
position = {0,-0.1,0.15},
|
||||
position = { 0, -0.1, 0.15 },
|
||||
height = 0,
|
||||
width = 0,
|
||||
font_size = 115,
|
||||
font_color = {1,1,1}
|
||||
font_color = { 1, 1, 1 }
|
||||
})
|
||||
|
||||
self.createButton({
|
||||
click_function = 'revealFirstTwoCards',
|
||||
function_owner = self,
|
||||
label = 'Reveal',
|
||||
position = {-0.85,0,1.6},
|
||||
position = { -0.85, 0, 1.6 },
|
||||
width = 375,
|
||||
height = 175,
|
||||
font_size = 90
|
||||
@ -147,7 +145,7 @@ function refreshButtons()
|
||||
click_function = 'swap',
|
||||
function_owner = self,
|
||||
label = 'Swap',
|
||||
position = {0,0,1.6},
|
||||
position = { 0, 0, 1.6 },
|
||||
width = 375,
|
||||
height = 175,
|
||||
font_size = 90
|
||||
@ -157,7 +155,7 @@ function refreshButtons()
|
||||
click_function = 'finish',
|
||||
function_owner = self,
|
||||
label = 'Finish',
|
||||
position = {0.85,0,1.6},
|
||||
position = { 0.85, 0, 1.6 },
|
||||
width = 375,
|
||||
height = 175,
|
||||
font_size = 90
|
||||
@ -260,11 +258,11 @@ function resetHelper()
|
||||
label = 'Underworld Market\nHelper',
|
||||
click_function = "none",
|
||||
function_owner = self,
|
||||
position = {0,-0.1,-1.6},
|
||||
position = { 0, -0.1, -1.6 },
|
||||
height = 0,
|
||||
width = 0,
|
||||
font_size = 145,
|
||||
font_color = {1,1,1}
|
||||
font_color = { 1, 1, 1 }
|
||||
})
|
||||
|
||||
hiddenCards = 10
|
||||
|
@ -483,13 +483,12 @@ modeData = {
|
||||
}
|
||||
|
||||
function onSave()
|
||||
local globalState = JSON.encode(SPAWNED_PLAYER_CARD_GUIDS)
|
||||
return globalState
|
||||
return JSON.encode(SPAWNED_PLAYER_CARD_GUIDS)
|
||||
end
|
||||
|
||||
function onLoad(save_state)
|
||||
if save_state ~= '' then
|
||||
SPAWNED_PLAYER_CARD_GUIDS = JSON.decode(save_state)
|
||||
function onLoad(savedData)
|
||||
if savedData and savedData ~= '' then
|
||||
SPAWNED_PLAYER_CARD_GUIDS = JSON.decode(savedData)
|
||||
else
|
||||
SPAWNED_PLAYER_CARD_GUIDS = {}
|
||||
end
|
||||
|
@ -22,7 +22,14 @@ local ENCOUNTER_DISCARD_POSITION = { x = -3.85, y = 1, z = 10.38 }
|
||||
local isReshuffling = false
|
||||
local collisionEnabled = false
|
||||
local currentScenario, useFrontData, tokenData
|
||||
local TRASH, DATA_HELPER
|
||||
|
||||
function onSave()
|
||||
return JSON.encode({
|
||||
currentScenario = currentScenario,
|
||||
useFrontData = useFrontData,
|
||||
tokenData = tokenData
|
||||
})
|
||||
end
|
||||
|
||||
function onLoad(savedData)
|
||||
if savedData and savedData ~= "" then
|
||||
@ -31,20 +38,9 @@ function onLoad(savedData)
|
||||
useFrontData = loadedState.useFrontData or true
|
||||
tokenData = loadedState.tokenData or {}
|
||||
end
|
||||
TRASH = guidReferenceApi.getObjectByOwnerAndType("Mythos", "Trash")
|
||||
DATA_HELPER = guidReferenceApi.getObjectByOwnerAndType("Mythos", "DataHelper")
|
||||
|
||||
Wait.time(function() collisionEnabled = true end, 0.1)
|
||||
end
|
||||
|
||||
function onSave()
|
||||
return JSON.encode({
|
||||
currentScenario = currentScenario,
|
||||
useFrontData = useFrontData,
|
||||
tokenData = tokenData
|
||||
})
|
||||
end
|
||||
|
||||
---------------------------------------------------------
|
||||
-- collison and container event handling
|
||||
---------------------------------------------------------
|
||||
@ -182,6 +178,7 @@ end
|
||||
-- draw the provided card to the requesting playermat
|
||||
function actualEncounterCardDraw(card, params)
|
||||
local metadata = JSON.decode(card.getGMNotes()) or {}
|
||||
local DATA_HELPER = guidReferenceApi.getObjectByOwnerAndType("Mythos", "DataHelper")
|
||||
|
||||
-- draw hidden cards facedown
|
||||
local faceUpRotation = 0
|
||||
@ -249,6 +246,7 @@ end
|
||||
|
||||
-- removes tokens from the provided card/deck
|
||||
function removeTokensFromObject(object)
|
||||
local TRASH = guidReferenceApi.getObjectByOwnerAndType("Mythos", "Trash")
|
||||
for _, obj in ipairs(searchLib.onObject(object)) do
|
||||
if obj.getGUID() ~= "4ee1f2" and -- table
|
||||
obj ~= self and
|
||||
|
@ -89,13 +89,9 @@ function onLoad(savedData)
|
||||
pitch = loadedData.pitch
|
||||
distance = loadedData.distance
|
||||
else
|
||||
local allColors = Player.getColors()
|
||||
|
||||
for _, color in ipairs(allColors) do
|
||||
-- default state for claims
|
||||
-- initialize tables with defaults
|
||||
for _, color in ipairs(Player.getColors()) do
|
||||
claims[color] = {}
|
||||
|
||||
-- default state for visibility
|
||||
visibility[color] = { full = false, play = false }
|
||||
end
|
||||
end
|
||||
|
@ -3,7 +3,12 @@ local optionPanelApi = require("core/OptionPanelApi")
|
||||
local playAreaApi = require("core/PlayAreaApi")
|
||||
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)
|
||||
if savedData and savedData ~= "" then
|
||||
|
@ -23,7 +23,9 @@ inputParameters.scale = { 0.1, 1, 0.1 }
|
||||
inputParameters.color = { 0.9, 0.7, 0.5 }
|
||||
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)
|
||||
local loadedData = JSON.decode(savedData)
|
||||
|
Loading…
Reference in New Issue
Block a user