Merge pull request #908 from argonui/navigation-overlay
Fixed navigation overlay non-playermat cameras
This commit is contained in:
commit
027d0ba3c9
@ -449,7 +449,7 @@ function switchSeat(playerColor, direction)
|
|||||||
end
|
end
|
||||||
|
|
||||||
-- swap color
|
-- swap color
|
||||||
navigationOverlayApi.loadCamera(Player[playerColor], usedColors[index])
|
navigationOverlayApi.loadCamera(Player[playerColor], _, usedColors[index])
|
||||||
end
|
end
|
||||||
|
|
||||||
function takeClueFromLocationWhite(_, hoveredObject)
|
function takeClueFromLocationWhite(_, hoveredObject)
|
||||||
|
@ -24,11 +24,13 @@ do
|
|||||||
|
|
||||||
-- loads the specified camera for a player
|
-- loads the specified camera for a player
|
||||||
---@param player tts__Player Player whose camera should be moved
|
---@param player tts__Player Player whose camera should be moved
|
||||||
---@param camera number|string If number: Index of the camera view to load | If string: Color of the playermat to swap to
|
---@param index? number Index of the camera view to load
|
||||||
NavigationOverlayApi.loadCamera = function(player, camera)
|
---@param matColor? string Color of the playermat to swap to
|
||||||
|
NavigationOverlayApi.loadCamera = function(player, index, matColor)
|
||||||
getNOHandler().call("loadCameraFromApi", {
|
getNOHandler().call("loadCameraFromApi", {
|
||||||
player = player,
|
player = player,
|
||||||
camera = camera
|
index = index,
|
||||||
|
matColor = matColor
|
||||||
})
|
})
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -287,36 +287,19 @@ function getDynamicViewBounds(objList)
|
|||||||
end
|
end
|
||||||
|
|
||||||
function loadCameraFromApi(params)
|
function loadCameraFromApi(params)
|
||||||
loadCamera(params.player, params.camera)
|
loadCamera(params.player, params.index, params.matColor)
|
||||||
end
|
end
|
||||||
|
|
||||||
-- loads the specified camera for a player
|
-- loads the specified camera for a player
|
||||||
---@param player tts__Player Player whose camera should be moved
|
---@param player tts__Player Player whose camera should be moved
|
||||||
---@param camera number|string If number: Index of the camera view to load | If string: Color of the playermat to swap to
|
---@param index? number Index of the camera view to load
|
||||||
function loadCamera(player, camera)
|
---@param matColor? string Color of the playermat to swap to
|
||||||
local lookHere, index, matColor
|
function loadCamera(player, index, matColor)
|
||||||
|
-- need at least one of these parameters
|
||||||
|
if not index and not matColor then return end
|
||||||
|
|
||||||
local matColorList = { "White", "Orange", "Green", "Red" }
|
local matColorList = { "White", "Orange", "Green", "Red" }
|
||||||
local indexList = {
|
local lookHere
|
||||||
White = 3,
|
|
||||||
Orange = 4,
|
|
||||||
Green = 5,
|
|
||||||
Red = 6
|
|
||||||
}
|
|
||||||
|
|
||||||
if tonumber(camera) then
|
|
||||||
index = tonumber(camera)
|
|
||||||
matColor = matColorList[index - 2] -- mat index 1 - 4
|
|
||||||
else
|
|
||||||
index = indexList[camera]
|
|
||||||
matColor = camera
|
|
||||||
end
|
|
||||||
|
|
||||||
-- if mat is removed, end here
|
|
||||||
local mat = guidReferenceApi.getObjectByOwnerAndType(matColor, "Playermat")
|
|
||||||
if mat == nil then
|
|
||||||
printToColor("Couldn't find this playermat.", player.color)
|
|
||||||
return
|
|
||||||
end
|
|
||||||
|
|
||||||
-- dynamic view of the play area
|
-- dynamic view of the play area
|
||||||
if index == 2 then
|
if index == 2 then
|
||||||
@ -330,7 +313,17 @@ function loadCamera(player, camera)
|
|||||||
distance = 0.8 * math.max(bounds.diffX, bounds.diffZ) + 7
|
distance = 0.8 * math.max(bounds.diffX, bounds.diffZ) + 7
|
||||||
}
|
}
|
||||||
-- dynamic view of the clicked play mat
|
-- dynamic view of the clicked play mat
|
||||||
elseif index >= 3 and index <= 6 then
|
elseif (index >= 3 and index <= 6) or matColor then
|
||||||
|
-- maybe get matColor (mat index 1 - 4)
|
||||||
|
matColor = matColor or matColorList[index - 2]
|
||||||
|
|
||||||
|
-- if mat is removed, end here
|
||||||
|
local mat = guidReferenceApi.getObjectByOwnerAndType(matColor, "Playermat")
|
||||||
|
if mat == nil then
|
||||||
|
printToColor("Couldn't find this playermat.", player.color)
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
-- check if anyone (except for yourself) has claimed this color
|
-- check if anyone (except for yourself) has claimed this color
|
||||||
local isClaimed = false
|
local isClaimed = false
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user