update group of helper handling

This commit is contained in:
Chr1Z93 2024-02-19 11:25:02 +01:00
parent 6d1bf009b5
commit c5dd28525c
2 changed files with 14 additions and 17 deletions

View File

@ -1 +1 @@
{"acknowledgedUpgradeVersions":[],"chaosTokensGUID":[],"optionPanel":{"cardLanguage":"en","changePlayAreaImage":false,"playAreaConnectionColor":{"a":1,"b":0.4,"g":0.4,"r":0.4},"playAreaConnections":true,"playAreaSnapTags":true,"showAttachmentHelper":false,"showCleanUpHelper":false,"showCYOA":false,"showDisplacementTool":false,"showDrawButton":false,"showHandHelper":[],"showSearchAssistant":[],"showTitleSplash":true,"useClueClickers":false,"useResourceCounters":"disabled","useSnapTags":true}}
{"acknowledgedUpgradeVersions":[],"chaosTokensGUID":[],"optionPanel":{"cardLanguage":"en","playAreaConnectionColor":{"a":1,"b":0.4,"g":0.4,"r":0.4},"playAreaConnections":true,"playAreaSnapTags":true,"showAttachmentHelper":false,"showCleanUpHelper":false,"showCYOA":false,"showDisplacementTool":false,"showDrawButton":false,"showHandHelper":false,"showSearchAssistant":false,"showTitleSplash":true,"useClueClickers":false,"useResourceCounters":"disabled","useSnapTags":true}}

View File

@ -1367,24 +1367,12 @@ function applyOptionPanelChange(id, state)
-- option: Show hand helper for each player
elseif id == "showHandHelper" then
local helperName = "Hand Helper"
local spawnData = playmatApi.getHelperSpawnData("All", helperName)
for color, data in pairs(spawnData) do
spawnOrRemoveHelper(state, helperName, data.position, data.rotation, color)
end
spawnOrRemoveHelperForPlayermats("Hand Helper", state)
optionPanel[id] = state
-- option: Show search assistant for each player
elseif id == "showSearchAssistant" then
local helperName = "Search Assistant"
local spawnData = playmatApi.getHelperSpawnData("All", helperName)
for color, data in pairs(spawnData) do
spawnOrRemoveHelper(state, helperName, data.position, data.rotation, color)
end
spawnOrRemoveHelperForPlayermats("Search Assistant", state)
optionPanel[id] = state
-- option: Show attachment helper
@ -1401,6 +1389,15 @@ function applyOptionPanelChange(id, state)
end
end
-- spawns or removes a helper object for all playermats
---@param helperName string Name of the helper object
---@param state boolean Contains the state of the option: true = spawn it, false = remove it
function spawnOrRemoveHelperForPlayermats(helperName, state)
for color, data in pairs(playmatApi.getHelperSpawnData("All", helperName)) do
spawnOrRemoveHelper(state, helperName, data.position, data.rotation, color)
end
end
-- handler for spawn / remove functions of helper objects
---@param state boolean Contains the state of the option: true = spawn it, false = remove it
---@param name string Name of the helper object
@ -1424,7 +1421,7 @@ end
---@param position tts__Vector Desired position of the object
---@param rotation? tts__Vector Desired rotation of the object (defaults to object's rotation)
function spawnHelperObject(name, position, rotation)
local sourceBag = guidReferenceApi.getObjectByOwnerAndType("Mythos","OptionPanelSource")
local sourceBag = guidReferenceApi.getObjectByOwnerAndType("Mythos", "OptionPanelSource")
-- error handling for missing sourceBag
if not sourceBag then
@ -1487,7 +1484,7 @@ function onClick_defaultSettings()
-- clean reset of variables
optionPanel = {
cardLanguage = "en",
playAreaConnectionColor = { 0.4, 0.4, 0.4, 1 },
playAreaConnectionColor = { a = 1, b = 0.4, g = 0.4, r = 0.4 },
playAreaConnections = true,
playAreaSnapTags = true,
showAttachmentHelper = false,