addition of "load default" functionality

This commit is contained in:
Chr1Z93 2022-12-22 12:50:02 +01:00
parent f3c1bf169d
commit d5f04cf465
11 changed files with 55 additions and 20 deletions

View File

@ -22,7 +22,7 @@
}, },
"Lighting_path": "Lighting.json", "Lighting_path": "Lighting.json",
"LuaScript": "require(\"core/Global\")", "LuaScript": "require(\"core/Global\")",
"LuaScriptState": "{\"optionPanel\":{\"showDrawButton\":false,\"showHandHelper\":[],\"useClueClickers\":false,\"useSnapTags\":true}}", "LuaScriptState_path": "LuaScriptState.luascriptstate",
"MusicPlayer_path": "MusicPlayer.json", "MusicPlayer_path": "MusicPlayer.json",
"Note": "", "Note": "",
"ObjectStates_order": [ "ObjectStates_order": [

View File

@ -0,0 +1 @@
{"optionPanel":{"showChaosBagManager":false,"showCleanUpHelper":false,"showDrawButton":false,"showHandHelper":false,"showNavigationOverlay":false,"showTokenArranger":false,"useClueClickers":false,"useSnapTags":true}}

View File

@ -273,7 +273,7 @@
"IgnoreFoW": false, "IgnoreFoW": false,
"LayoutGroupSortIndex": 0, "LayoutGroupSortIndex": 0,
"Locked": true, "Locked": true,
"LuaScriptState": "{\"activeInvestigatorId\":\"00000\",\"playerColor\":\"White\",\"zoneID\":\"7af2cf\"}", "LuaScriptState_path": "Playermat1White.8b081b.luascriptstate",
"LuaScript_path": "Playermat1White.8b081b.ttslua", "LuaScript_path": "Playermat1White.8b081b.ttslua",
"MeasureMovement": false, "MeasureMovement": false,
"Name": "Custom_Tile", "Name": "Custom_Tile",

View File

@ -0,0 +1 @@
{"activeInvestigatorId":"00000","isDrawButtonVisible":false,"playerColor":"White","zoneID":"7af2cf"}

View File

@ -273,7 +273,7 @@
"IgnoreFoW": false, "IgnoreFoW": false,
"LayoutGroupSortIndex": 0, "LayoutGroupSortIndex": 0,
"Locked": true, "Locked": true,
"LuaScriptState": "{\"activeInvestigatorId\":\"00000\",\"playerColor\":\"Orange\",\"zoneID\":\"b047f8\"}", "LuaScriptState_path": "Playermat2Orange.bd0ff4.luascriptstate",
"LuaScript_path": "Playermat2Orange.bd0ff4.ttslua", "LuaScript_path": "Playermat2Orange.bd0ff4.ttslua",
"MeasureMovement": false, "MeasureMovement": false,
"Name": "Custom_Tile", "Name": "Custom_Tile",

View File

@ -0,0 +1 @@
{"activeInvestigatorId":"00000","isDrawButtonVisible":false,"playerColor":"Orange","zoneID":"b047f8"}

View File

@ -273,7 +273,7 @@
"IgnoreFoW": false, "IgnoreFoW": false,
"LayoutGroupSortIndex": 0, "LayoutGroupSortIndex": 0,
"Locked": true, "Locked": true,
"LuaScriptState": "{\"activeInvestigatorId\":\"00000\",\"playerColor\":\"Green\",\"zoneID\":\"fb28e1\"}", "LuaScriptState_path": "Playermat3Green.383d8b.luascriptstate",
"LuaScript_path": "Playermat3Green.383d8b.ttslua", "LuaScript_path": "Playermat3Green.383d8b.ttslua",
"MeasureMovement": false, "MeasureMovement": false,
"Name": "Custom_Tile", "Name": "Custom_Tile",

View File

@ -0,0 +1 @@
{"activeInvestigatorId":"00000","isDrawButtonVisible":false,"playerColor":"Green","zoneID":"fb28e1"}

View File

@ -273,7 +273,7 @@
"IgnoreFoW": false, "IgnoreFoW": false,
"LayoutGroupSortIndex": 0, "LayoutGroupSortIndex": 0,
"Locked": true, "Locked": true,
"LuaScriptState": "{\"activeInvestigatorId\":\"00000\",\"playerColor\":\"Red\",\"zoneID\":\"18538f\"}", "LuaScriptState_path": "Playermat4Red.0840d5.luascriptstate",
"LuaScript_path": "Playermat4Red.0840d5.ttslua", "LuaScript_path": "Playermat4Red.0840d5.ttslua",
"MeasureMovement": false, "MeasureMovement": false,
"Name": "Custom_Tile", "Name": "Custom_Tile",

View File

@ -0,0 +1 @@
{"activeInvestigatorId":"00000","isDrawButtonVisible":false,"playerColor":"Red","zoneID":"18538f"}

View File

@ -787,11 +787,6 @@ end
-- Option Panel related functionality -- Option Panel related functionality
--------------------------------------------------------- ---------------------------------------------------------
-- loads the default options
function onClick_defaultSettings()
print("Dummy: Load default settings")
end
-- called by toggling an option -- called by toggling an option
function onClick_toggleOption(_, id) function onClick_toggleOption(_, id)
local state = self.UI.getAttribute(id, "isOn") local state = self.UI.getAttribute(id, "isOn")
@ -814,6 +809,8 @@ function updateOptionPanelState()
or (type(enabled) == "string" and enabled) or (type(enabled) == "string" and enabled)
or (type(enabled) == "table" and #enabled ~= 0) then or (type(enabled) == "table" and #enabled ~= 0) then
self.UI.setAttribute(id, "isOn", true) self.UI.setAttribute(id, "isOn", true)
else
self.UI.setAttribute(id, "isOn", "False")
end end
end end
end end
@ -888,12 +885,8 @@ end
---@param name String Name of the object that should be copied ---@param name String Name of the object that should be copied
---@param position Position Desired position of the object ---@param position Position Desired position of the object
function spawnHelperObject(name, position, rotation, color) function spawnHelperObject(name, position, rotation, color)
for _, obj in ipairs(getObjectFromGUID(BARREL_GUID).getData().ContainedObjects) do local spawnTable = {
if obj["Nickname"] == name then
return spawnObjectData({
data = obj,
position = position, position = position,
rotation = rotation or {0, 270, 0},
callback_function = function(object) callback_function = function(object)
if name == "Hand Helper" then if name == "Hand Helper" then
Wait.time(function() object.call("externalColorChange", color) end, 1) Wait.time(function() object.call("externalColorChange", color) end, 1)
@ -901,13 +894,23 @@ function spawnHelperObject(name, position, rotation, color)
Wait.time(function() object.call("layout") end, 1) Wait.time(function() object.call("layout") end, 1)
end end
end end
}) }
-- only overrride rotation if there is one provided (object's rotation used instead)
if rotation then
spawnTable.rotation = rotation
end
for _, obj in ipairs(getObjectFromGUID(BARREL_GUID).getData().ContainedObjects) do
if obj["Nickname"] == name then
spawnTable.data = obj
return spawnObjectData(spawnTable)
end end
end end
end end
-- removes the specified tool (by name) -- removes the specified tool (by name)
---@param name String Name of the object that should be removed ---@param name String Object that should be removed
function removeHelperObject(name) function removeHelperObject(name)
-- links objects name to the respective option name (to grab the GUID for removal) -- links objects name to the respective option name (to grab the GUID for removal)
local referenceTable = { local referenceTable = {
@ -933,3 +936,30 @@ function removeHelperObject(name)
end end
end end
end end
-- loads the default options
function onClick_defaultSettings()
for id, _ in pairs(optionPanel) do
local state = false
-- override for settings that are enabled by default
if id == "useSnapTags" then
state = true
end
applyOptionPanelChange(id, state)
end
-- clean reset of variable
optionPanel = {
useSnapTags = true,
showDrawButton = false,
useClueClickers = false,
showTokenArranger = false,
showCleanUpHelper = false,
showHandHelper = false,
showChaosBagManager = false,
showNavigationOverlay = false
}
-- update UI
updateOptionPanelState()
end