reworking variable names
This commit is contained in:
parent
bcfd405651
commit
d50f34bdc0
@ -1,79 +1,75 @@
|
||||
local playmatApi = require("playermat/PlaymatApi")
|
||||
fullButtonData = {
|
||||
{ id = "1", width = "84", height = "33", offsetX = "1", offsetY = "2" }, -- Act/Agenda
|
||||
{ id = "2", width = "78", height = "69", offsetX = "1", offsetY = "-62" }, -- Map
|
||||
{ id = "3", width = "70", height = "36", offsetX = "-36", offsetY = "-126" }, -- White
|
||||
{ id = "4", width = "70", height = "36", offsetX = "39", offsetY = "-126" }, -- Orange
|
||||
{ id = "5", width = "36", height = "70", offsetX = "-62", offsetY = "-66" }, -- Green
|
||||
{ id = "6", width = "36", height = "70", offsetX = "64", offsetY = "-66" }, -- Red
|
||||
{ id = "7", width = "38", height = "38", offsetX = "-64", offsetY = "-3" }, -- Victory
|
||||
{ id = "8", width = "40", height = "40", offsetX = "66", offsetY = "-3" }, -- Guide
|
||||
{ id = "9", width = "56", height = "16", offsetX = "1", offsetY = "-20" }, -- Player count
|
||||
{ id = "10", width = "36", height = "16", offsetX = "1", offsetY = "-102" }, -- Bless/Curse
|
||||
{ id = "11", width = "168", height = "56", offsetX = "1", offsetY = "47" }, -- Scenarios
|
||||
{ id = "12", width = "52", height = "53", offsetX = "-154", offsetY = "134" }, -- Player card panel
|
||||
{ id = "13", width = "22", height = "22", offsetX = "-116", offsetY = "132" }, -- Search card panel
|
||||
{ id = "14", width = "120", height = "75", offsetX = "-152", offsetY = "70" }, -- Player card display
|
||||
{ id = "15", width = "40", height = "54", offsetX = "-150", offsetY = "-38" }, -- Deck builder
|
||||
{ id = "16", width = "104", height = "84", offsetX = "-154", offsetY = "-114" }, -- Rules area
|
||||
{ id = "17", width = "100", height = "170", offsetX = "152", offsetY = "72" }, -- Cycle area
|
||||
{ id = "18", width = "56", height = "60", offsetX = "182", offsetY = "-124" }, -- Additions
|
||||
{ id = "19", width = "20", height = "20", offsetX = "-8", offsetY = "150" }, -- Shrink
|
||||
{ id = "20", width = "20", height = "20", offsetX = "12", offsetY = "150" } -- Close
|
||||
{ id = "1", width = "84", height = "33", offset = "1 2" }, -- Act/Agenda
|
||||
{ id = "2", width = "78", height = "69", offset = "1 -62" }, -- Map
|
||||
{ id = "3", width = "70", height = "36", offset = "-38 -126" }, -- White
|
||||
{ id = "4", width = "70", height = "36", offset = "38 -126" }, -- Orange
|
||||
{ id = "5", width = "36", height = "70", offset = "-63 -66" }, -- Green
|
||||
{ id = "6", width = "36", height = "70", offset = "63 -66" }, -- Red
|
||||
{ id = "7", width = "38", height = "38", offset = "-65 -3" }, -- Victory
|
||||
{ id = "8", width = "40", height = "40", offset = "65 -3" }, -- Guide
|
||||
{ id = "9", width = "56", height = "16", offset = "1 -20" }, -- Player count
|
||||
{ id = "10", width = "36", height = "16", offset = "1 -102" }, -- Bless/Curse
|
||||
{ id = "11", width = "168", height = "56", offset = "1 47" }, -- Scenarios
|
||||
{ id = "12", width = "52", height = "53", offset = "-154 134" }, -- Player card panel
|
||||
{ id = "13", width = "22", height = "22", offset = "-116 132" }, -- Search card panel
|
||||
{ id = "14", width = "120", height = "75", offset = "-152 70" }, -- Player card display
|
||||
{ id = "15", width = "40", height = "54", offset = "-150 -38" }, -- Deck builder
|
||||
{ id = "16", width = "104", height = "84", offset = "-154 -114" }, -- Rules area
|
||||
{ id = "17", width = "100", height = "170", offset = "152 72" }, -- Cycle area
|
||||
{ id = "18", width = "56", height = "60", offset = "182 -124" }, -- Additions
|
||||
{ id = "19", width = "20", height = "20", offset = "-8 150" }, -- Shrink
|
||||
{ id = "20", width = "20", height = "20", offset = "12 150" } -- Close
|
||||
}
|
||||
|
||||
playButtonData = {
|
||||
{ id = "1", width = "80", height = "33", offsetX = "0", offsetY = "55" },
|
||||
{ id = "2", width = "78", height = "70", offsetX = "0", offsetY = "-8" },
|
||||
{ id = "3", width = "68", height = "32", offsetX = "-36", offsetY = "-71" },
|
||||
{ id = "4", width = "68", height = "32", offsetX = "36", offsetY = "-71" },
|
||||
{ id = "5", width = "35", height = "66", offsetX = "-65", offsetY = "-10" },
|
||||
{ id = "6", width = "35", height = "66", offsetX = "65", offsetY = "-10" },
|
||||
{ id = "7", width = "38", height = "38", offsetX = "-66", offsetY = "52" },
|
||||
{ id = "8", width = "38", height = "38", offsetX = "66", offsetY = "52" },
|
||||
{ id = "9", width = "50", height = "12", offsetX = "0", offsetY = "33" },
|
||||
{ id = "10", width = "32", height = "12", offsetX = "0", offsetY = "-48" },
|
||||
{ id = "19", width = "20", height = "20", offsetX = "-10", offsetY = "80" },
|
||||
{ id = "20", width = "20", height = "20", offsetX = "10", offsetY = "80" }
|
||||
{ id = "1", width = "80", height = "33", offset = "0 55" },
|
||||
{ id = "2", width = "78", height = "70", offset = "0 -8" },
|
||||
{ id = "3", width = "68", height = "32", offset = "-36 -71" },
|
||||
{ id = "4", width = "68", height = "32", offset = "36 -71" },
|
||||
{ id = "5", width = "35", height = "66", offset = "-65 -10" },
|
||||
{ id = "6", width = "35", height = "66", offset = "65 -10" },
|
||||
{ id = "7", width = "38", height = "38", offset = "-66 52" },
|
||||
{ id = "8", width = "38", height = "38", offset = "66 52" },
|
||||
{ id = "9", width = "50", height = "12", offset = "0 33" },
|
||||
{ id = "10", width = "32", height = "12", offset = "0 -48" },
|
||||
{ id = "19", width = "20", height = "20", offset = "-10 80" },
|
||||
{ id = "20", width = "20", height = "20", offset = "10 80" }
|
||||
}
|
||||
|
||||
defaultCameraParams = {
|
||||
{ position = { -1.626, -2.5, 0 }, pitch = 74, yaw = 90, distance = 18 }, -- 1. ActAgenda
|
||||
{ position = { -27.822, -2.5, 0.424 }, pitch = 74, yaw = 90, distance = -1 }, -- 2. Map
|
||||
{ position = { -31.592, -2.5, 26.392 }, pitch = 74, yaw = 180, distance = -1 }, -- 3. Green playmat
|
||||
{ position = { -55.026, -2.5, 12.052 }, pitch = 74, yaw = 90, distance = -1 }, -- 4. White playmat
|
||||
{ position = { -55.026, -2.5, -11.479 }, pitch = 74, yaw = 90, distance = -1 }, -- 5. Orange playmat
|
||||
{ position = { -31.592, -2.5, -26.392 }, pitch = 74, yaw = 0, distance = -1 }, -- 6. Red playmat
|
||||
{ position = { -3.029, 1.652, 24.296 }, pitch = 74, yaw = 90, distance = 16 }, -- 7. Victory / SetAside
|
||||
{ position = { -2.936, 1.552, -26.757 }, pitch = 74, yaw = 90, distance = 16 }, -- 8. Guide
|
||||
{ position = { -11.833, 1.491, -0.145 }, pitch = 74, yaw = 90, distance = 10 }, -- 9. Player count
|
||||
{ position = { -48.352, 1.552, -0.055 }, pitch = 74, yaw = 90, distance = 10 }, -- 10. Bless/Curse
|
||||
{ position = { 12.560, 1.912, 0.458 }, pitch = 74, yaw = 90, distance = 35 }, -- 11. Scenarios
|
||||
{ position = { 57.835, 1.552, 75.385 }, pitch = 74, yaw = 90, distance = 22 }, -- 12. Player card panel
|
||||
{ position = { 60.377, 1.552, 55.941 }, pitch = 74, yaw = 90, distance = 10 }, -- 13. Card search panel
|
||||
{ position = { 27.482, 1.480, 71.057 }, pitch = 74, yaw = 90, distance = 35 }, -- 14. Player card area
|
||||
{ position = { -19.481, 1.552, 70.880 }, pitch = 74, yaw = 90, distance = 22 }, -- 15. Deck builder
|
||||
{ position = { -52.918, 1.478, 70.899 }, pitch = 74, yaw = 90, distance = 42 }, -- 16. Rules area
|
||||
{ position = { 24.551, 2.222, -71.284 }, pitch = 60, yaw = 90, distance = 60 }, -- 17. Cycle area
|
||||
{ position = { -59.077, 1.462, -85.472 }, pitch = 74, yaw = 90, distance = 27 } -- 18. Additions
|
||||
{ position = { -1.6, 1.55, 0 }, distance = 18 }, -- 1. ActAgenda
|
||||
{ position = { -28, 1.55, 0.42 }, distance = -1 }, -- 2. Map
|
||||
{ position = { -31.6, 1.55, 26.4 }, distance = -1 }, -- 3. Green playmat
|
||||
{ position = { -55, 1.55, 12.05 }, distance = -1 }, -- 4. White playmat
|
||||
{ position = { -55, 1.55, -11.48 }, distance = -1 }, -- 5. Orange playmat
|
||||
{ position = { -31.6, 1.55, -26.4 }, distance = -1 }, -- 6. Red playmat
|
||||
{ position = { -3, 1.55, 30 }, distance = 16 }, -- 7. Victory / SetAside
|
||||
{ position = { -3, 1.55, -26.76 }, distance = 16 }, -- 8. Guide
|
||||
{ position = { -11.83, 1.55, 0 }, distance = 10 }, -- 9. Player count
|
||||
{ position = { -48.35, 1.55, 0 }, distance = 10 }, -- 10. Bless/Curse
|
||||
{ position = { 12.56, 1.55, 0 }, distance = 45 }, -- 11. Scenarios
|
||||
{ position = { 57.8, 1.55, 71 }, distance = 22 }, -- 12. Player card panel
|
||||
{ position = { 60.38, 1.55, 56 }, distance = 10 }, -- 13. Card search panel
|
||||
{ position = { 27.48, 1.55, 71 }, distance = 35 }, -- 14. Player card area
|
||||
{ position = { -19.48, 1.55, 71 }, distance = 22 }, -- 15. Deck builder
|
||||
{ position = { -52.92, 1.55, 71 }, distance = 42 }, -- 16. Rules area
|
||||
{ position = { 26, 1.55, -71 }, distance = 65 }, -- 17. Cycle area
|
||||
{ position = { -59.08, 1.55, -83 }, distance = 27 } -- 18. Additions
|
||||
}
|
||||
|
||||
local playermatData = { {}, {}, {}, {} }
|
||||
local editing = false
|
||||
local claiming = false
|
||||
local cameraParams = { {}, {}, {}, {} }
|
||||
local playermatData = { {}, {}, {}, {} }
|
||||
local editing = false
|
||||
local claiming = false
|
||||
local visibility = {}
|
||||
local claims = {}
|
||||
|
||||
function onSave()
|
||||
local allclaims = {}
|
||||
|
||||
for i = 1, 4 do
|
||||
table.insert(allclaims, playermatData[i].claims)
|
||||
end
|
||||
|
||||
return JSON.encode({
|
||||
cameras = cameraParams,
|
||||
fullVis = fullVisibility,
|
||||
playVis = playVisibility,
|
||||
claims = allclaims
|
||||
cameras = cameraParams,
|
||||
visibility = visibility,
|
||||
claims = claims
|
||||
})
|
||||
end
|
||||
|
||||
@ -81,92 +77,16 @@ function onLoad(savedData)
|
||||
if savedData ~= "" then
|
||||
local loadedData = JSON.decode(savedData)
|
||||
cameraParams = loadedData.cameras
|
||||
fullVisibility = loadedData.fullVis
|
||||
playVisibility = loadedData.playVis
|
||||
|
||||
for i = 1, 4 do
|
||||
playermatData[i].claims = loadedData.claims[i]
|
||||
end
|
||||
visibility = loadedData.visibility
|
||||
claims = loadedData.claims
|
||||
else
|
||||
cameraParams = { {}, {}, {}, {} }
|
||||
|
||||
for i = 1, 4 do
|
||||
for j = 1, #defaultCameraParams do
|
||||
cameraParams[i][j] = defaultCameraParams[j]
|
||||
end
|
||||
end
|
||||
|
||||
fullVisibility = { false, false, false, false }
|
||||
playVisibility = { false, false, false, false }
|
||||
resetCameras()
|
||||
resetClaimColors()
|
||||
end
|
||||
|
||||
createTileButtons()
|
||||
updateOverlay()
|
||||
end
|
||||
|
||||
function createTileButtons()
|
||||
local buttonParameters = {}
|
||||
buttonParameters.function_owner = self
|
||||
buttonParameters.label = ""
|
||||
|
||||
-- index 0: Full Area
|
||||
buttonParameters.tooltip = "Display full overlay"
|
||||
buttonParameters.click_function = "displayFull"
|
||||
buttonParameters.position = { x = 0, y = 0.1, z = -0.63 }
|
||||
buttonParameters.height = 70
|
||||
buttonParameters.width = 700
|
||||
buttonParameters.color = { 1, 0, 0, 0 }
|
||||
self.createButton(buttonParameters)
|
||||
|
||||
-- index 1: Play Area
|
||||
buttonParameters.tooltip = "Display only play area"
|
||||
buttonParameters.click_function = "displayPlayArea"
|
||||
buttonParameters.position = { x = 0, y = 0.1, z = -0.39 }
|
||||
self.createButton(buttonParameters)
|
||||
|
||||
-- index 2: Close Overlay
|
||||
buttonParameters.tooltip = "Close overlay"
|
||||
buttonParameters.click_function = "closeOverlay"
|
||||
buttonParameters.position = { x = 0, y = 0.1, z = -0.16 }
|
||||
self.createButton(buttonParameters)
|
||||
|
||||
-- index 3: Modify Camera
|
||||
buttonParameters.tooltip = "Modify a camera position"
|
||||
buttonParameters.click_function = "beginSetCamera"
|
||||
buttonParameters.position = { x = 0, y = 0.1, z = 0.19 }
|
||||
self.createButton(buttonParameters)
|
||||
|
||||
-- index 4: Claim a color
|
||||
buttonParameters.tooltip = "Claim a color (you will switch to this color when clicking in the overlay)"
|
||||
buttonParameters.click_function = "beginClaimColor"
|
||||
buttonParameters.width = 475
|
||||
buttonParameters.position = { x = -0.22, y = 0.1, z = 0.42 }
|
||||
self.createButton(buttonParameters)
|
||||
|
||||
-- index 4: Reset color claims
|
||||
buttonParameters.tooltip = "Reset all color claims"
|
||||
buttonParameters.click_function = "resetClaimColors"
|
||||
buttonParameters.width = 230
|
||||
buttonParameters.position = { x = 0.48, y = 0.1, z = 0.42 }
|
||||
self.createButton(buttonParameters)
|
||||
|
||||
-- index 5: Reset camera positions
|
||||
buttonParameters.tooltip = "Reset camera positions to default"
|
||||
buttonParameters.click_function = "resetCameras"
|
||||
buttonParameters.width = 700
|
||||
buttonParameters.position = { x = 0, y = 0.1, z = 0.78 }
|
||||
self.createButton(buttonParameters)
|
||||
end
|
||||
|
||||
function displayFull(_, color)
|
||||
setVisibility("full", color)
|
||||
end
|
||||
|
||||
function displayPlayArea(_, color)
|
||||
setVisibility("play", color)
|
||||
end
|
||||
|
||||
function closeOverlay(_, color)
|
||||
setVisibility("close", color)
|
||||
end
|
||||
@ -174,39 +94,24 @@ end
|
||||
function cycleVisibility(color)
|
||||
setVisibility("next", color)
|
||||
end
|
||||
|
||||
function setVisibility(type, color)
|
||||
local colors = getColors(color)
|
||||
local visibility
|
||||
local visibility[color] = { full = false, play = false }
|
||||
|
||||
if type == "full" then
|
||||
visibility = { full = true, play = false }
|
||||
elseif type == "play" then
|
||||
visibility = { full = false, play = true }
|
||||
else
|
||||
visibility = { full = false, play = false }
|
||||
end
|
||||
|
||||
for _, v in ipairs(colors) do
|
||||
if v > 0 then
|
||||
-- override visibility to cycle to the next
|
||||
if type == "next" then
|
||||
if fullVisibility[v] then
|
||||
visibility = { full = false, play = true }
|
||||
elseif playVisibility[v] then
|
||||
visibility = { full = false, play = false }
|
||||
else
|
||||
visibility = { full = true, play = false }
|
||||
end
|
||||
end
|
||||
fullVisibility[v] = visibility.full
|
||||
playVisibility[v] = visibility.play
|
||||
if type == "next" then
|
||||
if visibility[color].full then
|
||||
visibility[color] = { full = false, play = true }
|
||||
elseif visibility[color].play then
|
||||
visibility[color] = { full = false, play = false }
|
||||
else
|
||||
visibility[color] = { full = true, play = false }
|
||||
end
|
||||
end
|
||||
|
||||
updateOverlay()
|
||||
end
|
||||
|
||||
function getColors(color)
|
||||
function getIndices(color)
|
||||
local playerCount = #getSeatedPlayers()
|
||||
|
||||
if playerCount == 0 then
|
||||
@ -218,25 +123,21 @@ function getColors(color)
|
||||
end
|
||||
end
|
||||
|
||||
function resetCameras(_, color)
|
||||
local colors = getColors(color)
|
||||
|
||||
for iv, v in ipairs(colors) do
|
||||
if v > 0 then
|
||||
for i = 1, #defaultCameraParams do
|
||||
cameraParams[v][i].position = defaultCameraParams[i].position
|
||||
cameraParams[v][i].pitch = defaultCameraParams[i].pitch
|
||||
cameraParams[v][i].yaw = defaultCameraParams[i].yaw
|
||||
cameraParams[v][i].distance = defaultCameraParams[i].distance
|
||||
end
|
||||
function resetCameras()
|
||||
for v = 1, 4 do
|
||||
cameraParams[v] = {}
|
||||
for i = 1, #defaultCameraParams do
|
||||
cameraParams[v][i] = {}
|
||||
cameraParams[v][i].position = defaultCameraParams[i].position
|
||||
cameraParams[v][i].pitch = 75
|
||||
cameraParams[v][i].yaw = 90
|
||||
cameraParams[v][i].distance = defaultCameraParams[i].distance
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function resizeOverlay(object, color)
|
||||
local colors = getColors(color)
|
||||
|
||||
for _, v in ipairs(colors) do
|
||||
for _, v in ipairs(getIndices(color)) do
|
||||
if v > 0 then
|
||||
local full = fullVisibility[v]
|
||||
fullVisibility[v] = not full
|
||||
@ -344,7 +245,7 @@ function updateXMLbuttons(type)
|
||||
id = d.id,
|
||||
height = d.height,
|
||||
width = d.width,
|
||||
offsetXY = d.offsetX .. " " .. d.offsetY,
|
||||
offsetXY = d.offset,
|
||||
color = color
|
||||
}
|
||||
})
|
||||
@ -381,9 +282,7 @@ function buttonClicked(player, _, idValue)
|
||||
selectedEditButton = buttonID
|
||||
else
|
||||
if buttonID == selectedEditButton and editDistance > 0 then
|
||||
local colors = getColors(color)
|
||||
|
||||
for _, v in ipairs(colors) do
|
||||
for _, v in ipairs(getIndices(color)) do
|
||||
cameraParams[v][selectedEditButton].position = editPos
|
||||
cameraParams[v][selectedEditButton].pitch = editPitch
|
||||
cameraParams[v][selectedEditButton].yaw = editYaw
|
||||
@ -425,33 +324,20 @@ function buttonClicked(player, _, idValue)
|
||||
claiming = false
|
||||
updateOverlay()
|
||||
else
|
||||
loadCamera(player, _, idValue)
|
||||
loadCamera(player, _, buttonID)
|
||||
end
|
||||
end
|
||||
|
||||
function loadCamera(player, _, idValue)
|
||||
local index = tonumber(idValue)
|
||||
function loadCamera(player, _, index)
|
||||
local playerColor = player.color
|
||||
local playerIndex = getIndexForPlayerColor(playerColor)
|
||||
|
||||
-- only do map zooming if the camera hasn't been specially set by user
|
||||
if index == 2 and cameraParams[playerIndex][index].distance <= 0 then
|
||||
local mapObjects = Physics.cast({
|
||||
origin = { x = -29.2, y = 0, z = 0.0 },
|
||||
direction = { x = 0, y = 1, z = 0 },
|
||||
type = 3,
|
||||
size = { x = 36, y = 5, z = 31.4 },
|
||||
orientation = { x = 0, y = 90, z = 0 }
|
||||
})
|
||||
|
||||
local minX = 100
|
||||
local maxX = -100
|
||||
local minZ = 100
|
||||
local maxZ = -100
|
||||
|
||||
for _, v in pairs(mapObjects) do
|
||||
local obj = v.hit_object
|
||||
local zone = getObjectFromGUID("a2f932")
|
||||
local minX, minZ, maxX, maxZ = 100, 100, -100, -100
|
||||
|
||||
for _, obj in pairs(zone.getObjects()) do
|
||||
if obj.type == 'Card' or obj.type == 'Infinite' then
|
||||
local bounds = obj.getBounds()
|
||||
local x1 = bounds['center'][1] - bounds['size'][1] / 2
|
||||
@ -466,51 +352,34 @@ function loadCamera(player, _, idValue)
|
||||
end
|
||||
end
|
||||
|
||||
if minX < 100 then
|
||||
local dx = maxX - minX
|
||||
local dz = (maxZ - minZ) / 1.6 -- screen ratio * 1.2 (for my macbook pro, no idea how to generalize this)
|
||||
player.lookAt({
|
||||
position = { (minX + maxX) / 2, 0, (minZ + maxZ) / 2 },
|
||||
pitch = 74,
|
||||
yaw = 90,
|
||||
distance = 0.96 * math.max(dx, dz) + 5
|
||||
})
|
||||
else
|
||||
player.lookAt({ position = { -30.667, 0, 0 }, pitch = 74, yaw = 90, distance = 32 })
|
||||
end
|
||||
player.lookAt({
|
||||
position = { (minX + maxX) / 2, 0, (minZ + maxZ) / 2 },
|
||||
pitch = 75,
|
||||
yaw = 90,
|
||||
distance = 0.96 * math.max(maxX - minX, (maxZ - minZ) / 1.6) + 5
|
||||
})
|
||||
elseif index >= 3 and index <= 6 then
|
||||
local newMatIndex = index - 2 -- mat index 1 - 4
|
||||
local newMatColor = getPlayerColorForIndex(newMatIndex)
|
||||
|
||||
if newMatColor ~= nil then
|
||||
local playerCount = #getSeatedPlayers()
|
||||
|
||||
if playerCount <= 1 or playermatData[playerIndex].claims[newMatIndex] then
|
||||
player.changeColor(newMatColor)
|
||||
end
|
||||
if newMatColor ~= nil and (#getSeatedPlayers() == 1 or playermatData[playerIndex].claims[newMatIndex]) then
|
||||
player.changeColor(newMatColor)
|
||||
end
|
||||
|
||||
if cameraParams[newMatIndex][index].distance <= 0 then
|
||||
local divisor, minX, maxX, minZ, maxZ
|
||||
|
||||
for i, v in pairs(playmatApi.searchPlaymat(newMatColor)) do
|
||||
for _, v in pairs(playmatApi.searchPlaymat(newMatColor)) do
|
||||
local bounds = v.hit_object.getBounds()
|
||||
local x1 = bounds['center'][1] - bounds['size'][1] / 2
|
||||
local x2 = bounds['center'][1] + bounds['size'][1] / 2
|
||||
local z1 = bounds['center'][3] - bounds['size'][3] / 2
|
||||
local z2 = bounds['center'][3] + bounds['size'][3] / 2
|
||||
|
||||
if i == 1 then
|
||||
minX = x1
|
||||
maxX = x2
|
||||
minZ = z1
|
||||
maxZ = z2
|
||||
else
|
||||
minX = math.min(x1, minX)
|
||||
maxX = math.max(x2, maxX)
|
||||
minZ = math.min(z1, minZ)
|
||||
maxZ = math.max(z2, maxZ)
|
||||
end
|
||||
minX = math.min(x1, minX or x1)
|
||||
maxX = math.max(x2, maxX or x2)
|
||||
minZ = math.min(z1, minZ or z1)
|
||||
maxZ = math.max(z2, maxZ or z2)
|
||||
end
|
||||
|
||||
-- White/Orange
|
||||
@ -521,14 +390,12 @@ function loadCamera(player, _, idValue)
|
||||
divisor = {x = 1.6, z = 1}
|
||||
end
|
||||
|
||||
local rotation = playmatApi.returnRotation()
|
||||
|
||||
-- need to wait if the player color changed
|
||||
Wait.frames(
|
||||
function() player.lookAt({
|
||||
position = { (minX + maxX) / 2, 0, (minZ + maxZ) / 2 },
|
||||
pitch = 75.823,
|
||||
yaw = rotation.y + 180,
|
||||
pitch = 75,
|
||||
yaw = playmatApi.returnRotation(newMatColor).y + 180,
|
||||
distance = 0.64 * math.max((maxX - minX) / divisor.x, (maxZ - minZ) / divisor.z) + 7
|
||||
})
|
||||
end, 2)
|
||||
@ -541,9 +408,6 @@ function loadCamera(player, _, idValue)
|
||||
end
|
||||
|
||||
function beginSetCamera(object, color)
|
||||
if #getSeatedPlayers() == 0 then return end
|
||||
if getIndexForPlayerColor(color) < 0 then return end
|
||||
|
||||
editing = true
|
||||
updateOverlay()
|
||||
end
|
||||
@ -563,15 +427,11 @@ function updateEditCamera(params)
|
||||
end
|
||||
|
||||
function beginClaimColor()
|
||||
if #getSeatedPlayers() == 0 then return end
|
||||
|
||||
claiming = true
|
||||
updateOverlay()
|
||||
end
|
||||
|
||||
function resetClaimColors()
|
||||
if #getSeatedPlayers() == 0 then return end
|
||||
|
||||
for i = 1, 4 do
|
||||
for j = 1, 4 do
|
||||
playermatData[i].claims = {}
|
||||
|
@ -46,8 +46,8 @@
|
||||
onClick="onClick_toggleUi(Options)"/>
|
||||
</VerticalLayout>
|
||||
|
||||
<!-- Navigation Overlay button (not visibly to Grey) -->
|
||||
<Panel visibility="White|Brown|Red|Orange|Yellow|Green|Teal|Blue|Purple|Pink|Black"
|
||||
<!-- Navigation Overlay button (not visibly to Grey and Black) -->
|
||||
<Panel visibility="White|Brown|Red|Orange|Yellow|Green|Teal|Blue|Purple|Pink"
|
||||
color="#000000"
|
||||
outlineSize="1 1"
|
||||
outline="#303030"
|
||||
|
Loading…
Reference in New Issue
Block a user