added camera movement to swapping
This commit is contained in:
parent
76e5d3e5f6
commit
04d9878fd1
@ -1,5 +1,6 @@
|
||||
local blessCurseManagerApi = require("chaosbag/BlessCurseManagerApi")
|
||||
local guidReferenceApi = require("core/GUIDReferenceApi")
|
||||
local navigationOverlayApi = require("core/NavigationOverlayApi")
|
||||
local optionPanelApi = require("core/OptionPanelApi")
|
||||
local playmatApi = require("playermat/PlaymatApi")
|
||||
local searchLib = require("util/SearchLib")
|
||||
@ -252,9 +253,7 @@ function switchSeat(playerColor, direction)
|
||||
end
|
||||
|
||||
-- swap color
|
||||
local newMatColor = usedColors[index]
|
||||
local newHandColor = playmatApi.getMatColorByPosition(Player[newMatColor].getHandTransform().position)
|
||||
Player[playerColor].changeColor(newHandColor)
|
||||
navigationOverlayApi.loadCamera(playerColor, usedColors[index])
|
||||
end
|
||||
|
||||
-- takes a clue from a location, player needs to hover the clue directly or the location
|
||||
|
@ -22,5 +22,15 @@ do
|
||||
getNOHandler().call("cycleVisibility", playerColor)
|
||||
end
|
||||
|
||||
-- loads the specified camera for a player
|
||||
---@param player TTSPlayerInstance Player whose camera should be moved
|
||||
---@param camera Variant If number: Index of the camera view to load | If string: Color of the playermat to swap to
|
||||
NavigationOverlayApi.loadCamera = function(playerColor, camera)
|
||||
getNOHandler().call("loadCameraFromApi", {
|
||||
playerColor = playerColor,
|
||||
camera = camera
|
||||
})
|
||||
end
|
||||
|
||||
return NavigationOverlayApi
|
||||
end
|
||||
|
@ -291,9 +291,30 @@ function getDynamicViewBounds(objList)
|
||||
return totalBounds
|
||||
end
|
||||
|
||||
function loadCameraFromApi(params)
|
||||
loadCamera(Player[params.playerColor], params.camera)
|
||||
end
|
||||
|
||||
-- loads the specified camera for a player
|
||||
function loadCamera(player, index)
|
||||
local lookHere
|
||||
---@param player TTSPlayerInstance Player whose camera should be moved
|
||||
---@param camera Variant 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
|
||||
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
|
||||
|
||||
-- dynamic view of the play area
|
||||
if index == 2 then
|
||||
@ -307,9 +328,6 @@ function loadCamera(player, index)
|
||||
}
|
||||
-- dynamic view of the clicked play mat
|
||||
elseif index >= 3 and index <= 6 then
|
||||
local matColorList = { "White", "Orange", "Green", "Red" }
|
||||
local matColor = matColorList[index - 2] -- mat index 1 - 4
|
||||
|
||||
-- check if anyone (except for yourself) has claimed this color
|
||||
local isClaimed = false
|
||||
|
||||
@ -325,6 +343,7 @@ function loadCamera(player, index)
|
||||
local newPlayerColor = playmatApi.getPlayerColor(matColor)
|
||||
copyVisibility({ startColor = player.color, targetColor = newPlayerColor })
|
||||
player.changeColor(newPlayerColor)
|
||||
player = Player[newPlayerColor]
|
||||
end
|
||||
|
||||
-- search on the playmat for objects
|
||||
|
Loading…
x
Reference in New Issue
Block a user