Fixed navigation overlay non-playermat cameras
This commit is contained in:
parent
f2279c55bd
commit
739fcc4155
@ -449,7 +449,7 @@ function switchSeat(playerColor, direction)
|
||||
end
|
||||
|
||||
-- swap color
|
||||
navigationOverlayApi.loadCamera(Player[playerColor], usedColors[index])
|
||||
navigationOverlayApi.loadCamera(Player[playerColor], _, usedColors[index])
|
||||
end
|
||||
|
||||
function takeClueFromLocationWhite(_, hoveredObject)
|
||||
|
@ -24,11 +24,13 @@ do
|
||||
|
||||
-- loads the specified camera for a player
|
||||
---@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
|
||||
NavigationOverlayApi.loadCamera = function(player, camera)
|
||||
---@param index? number Index of the camera view to load
|
||||
---@param matColor? string Color of the playermat to swap to
|
||||
NavigationOverlayApi.loadCamera = function(player, index, matColor)
|
||||
getNOHandler().call("loadCameraFromApi", {
|
||||
player = player,
|
||||
camera = camera
|
||||
index = index,
|
||||
matColor = matColor
|
||||
})
|
||||
end
|
||||
|
||||
|
@ -287,36 +287,19 @@ function getDynamicViewBounds(objList)
|
||||
end
|
||||
|
||||
function loadCameraFromApi(params)
|
||||
loadCamera(params.player, params.camera)
|
||||
loadCamera(params.player, params.index, params.matColor)
|
||||
end
|
||||
|
||||
-- loads the specified camera for a player
|
||||
---@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
|
||||
function loadCamera(player, camera)
|
||||
local lookHere, index, matColor
|
||||
---@param index? number Index of the camera view to load
|
||||
---@param matColor? string Color of the playermat to swap to
|
||||
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 indexList = {
|
||||
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
|
||||
local lookHere
|
||||
|
||||
-- dynamic view of the play area
|
||||
if index == 2 then
|
||||
@ -330,7 +313,17 @@ function loadCamera(player, camera)
|
||||
distance = 0.8 * math.max(bounds.diffX, bounds.diffZ) + 7
|
||||
}
|
||||
-- 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
|
||||
local isClaimed = false
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user