added option to disable connections

This commit is contained in:
Chr1Z93 2023-12-18 11:52:00 +01:00
parent 85ab16a3f9
commit 5fd4cd89d7
14 changed files with 93 additions and 42 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 23 KiB

After

Width:  |  Height:  |  Size: 22 KiB

BIN
img/headers/compass.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 20 KiB

After

Width:  |  Height:  |  Size: 19 KiB

Binary file not shown.

Binary file not shown.

Before

Width:  |  Height:  |  Size: 29 KiB

After

Width:  |  Height:  |  Size: 21 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 24 KiB

Binary file not shown.

View File

@ -87,22 +87,22 @@
{ {
"Name": "header_cover", "Name": "header_cover",
"Type": 0, "Type": 0,
"URL": "http://cloud-3.steamusercontent.com/ugc/5118935530977312342/0D22712378B1F9A5A1FC7DA40C355943C878DDC0/" "URL": "http://cloud-3.steamusercontent.com/ugc/2280574378889753624/53E7443E2A9957BC5CA4D73B67D5C1C30971C9F9/"
}, },
{ {
"Name": "header_acolyte", "Name": "header_acolyte",
"Type": 0, "Type": 0,
"URL": "http://cloud-3.steamusercontent.com/ugc/5118935530977311773/B8B2021D42CFB084AFDCCA42EE6B9A57F3E30AC6/" "URL": "http://cloud-3.steamusercontent.com/ugc/2280574378889753484/961371448C1CB9F93D574E0F78CF51A88D0D34F6/"
}, },
{ {
"Name": "header_ruins", "Name": "header_compass",
"Type": 0, "Type": 0,
"URL": "http://cloud-3.steamusercontent.com/ugc/5118935530977312917/E24A34736C912186C7AC58270E3819B6A44B3EE8/" "URL": "http://cloud-3.steamusercontent.com/ugc/2280574378889786684/52E2A801060A523AF5DD956C72A41889B5A1D2C9/"
}, },
{ {
"Name": "header_olive", "Name": "header_olive",
"Type": 0, "Type": 0,
"URL": "http://cloud-3.steamusercontent.com/ugc/5118935530977377198/4E88B41107A29D027D86E6B80D47B03617335990/" "URL": "http://cloud-3.steamusercontent.com/ugc/2280574378889753733/F67B7B37FF7AA253B6D697E577DF54A3E76030C2/"
}, },
{ {
"Name": "option_on", "Name": "option_on",

View File

@ -1 +1 @@
{"acknowledgedUpgradeVersions":[],"optionPanel":{"cardLanguage":"en","changePlayAreaImage":false,"playAreaConnectionColor":{"a":1,"b":0.4,"g":0.4,"r":0.4},"playAreaSnapTags":true,"showAttachmentHelper":false,"showCleanUpHelper":false,"showCYOA":false,"showDisplacementTool":false,"showDrawButton":false,"showHandHelper":[],"showPlayermatHider":false,"showSearchAssistant":[],"showTitleSplash":true,"useClueClickers":false,"useResourceCounters":"disabled","useSnapTags":true}} {"acknowledgedUpgradeVersions":[],"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":[],"showPlayermatHider":false,"showSearchAssistant":[],"showTitleSplash":true,"useClueClickers":false,"useResourceCounters":"disabled","useSnapTags":true}}

View File

@ -1 +1 @@
{"connectionColor":{"a":1,"b":0.4,"g":0.4,"r":0.4},"trackedLocations":[]} {"connectionColor":{"a":1,"b":0.4,"g":0.4,"r":0.4},"connectionsEnabled":true,"trackedLocations":[]}

View File

@ -1240,6 +1240,11 @@ function applyOptionPanelChange(id, state)
local counter = guidReferenceApi.getObjectByOwnerAndType("Mythos", "MasterClueCounter") local counter = guidReferenceApi.getObjectByOwnerAndType("Mythos", "MasterClueCounter")
counter.setVar("useClickableCounters", state) counter.setVar("useClickableCounters", state)
-- option: Play area snap tags
elseif id == "playAreaConnections" then
playAreaApi.setConnectionDrawState(state)
optionPanel[id] = state
-- option: Play area connection color -- option: Play area connection color
elseif id == "playAreaConnectionColor" then elseif id == "playAreaConnectionColor" then
playAreaApi.setConnectionColor(state) playAreaApi.setConnectionColor(state)
@ -1399,6 +1404,7 @@ function onClick_defaultSettings()
optionPanel = { optionPanel = {
cardLanguage = "en", cardLanguage = "en",
playAreaConnectionColor = { 0.4, 0.4, 0.4, 1 }, playAreaConnectionColor = { 0.4, 0.4, 0.4, 1 },
playAreaConnections = true,
playAreaSnapTags = true, playAreaSnapTags = true,
showAttachmentHelper = false, showAttachmentHelper = false,
showCleanUpHelper = false, showCleanUpHelper = false,

View File

@ -18,9 +18,6 @@ local ARROW_ANGLE = 25
-- Height to draw the connector lines, places them just above the table and always below cards -- Height to draw the connector lines, places them just above the table and always below cards
local CONNECTION_LINE_Y = 1.529 local CONNECTION_LINE_Y = 1.529
-- we use this to turn off collision handling until onLoad() is complete
local collisionEnabled = false
-- used for recreating the link to a custom data helper after image change -- used for recreating the link to a custom data helper after image change
customDataHelper = nil customDataHelper = nil
@ -51,7 +48,7 @@ local locations = {}
local locationConnections = {} local locationConnections = {}
local draggingGuids = {} local draggingGuids = {}
local missingData = {} local missingData = {}
local locationData, currentScenario local locationData, currentScenario, connectionsEnabled
--------------------------------------------------------- ---------------------------------------------------------
-- general code -- general code
@ -59,19 +56,19 @@ local locationData, currentScenario
function onSave() function onSave()
return JSON.encode({ return JSON.encode({
trackedLocations = locations, trackedLocations = locations,
currentScenario = currentScenario, currentScenario = currentScenario,
connectionColor = connectionColor connectionColor = connectionColor,
connectionsEnabled = connectionsEnabled
}) })
end end
function onLoad(savedData) function onLoad(savedData)
local loadedData = JSON.decode(savedData) or {} local loadedData = JSON.decode(savedData) or {}
locations = loadedData.trackedLocations or {} locations = loadedData.trackedLocations or {}
currentScenario = loadedData.currentScenario currentScenario = loadedData.currentScenario
connectionColor = loadedData.connectionColor or { 0.4, 0.4, 0.4, 1 } connectionColor = loadedData.connectionColor or { 0.4, 0.4, 0.4, 1 }
connectionsEnabled = loadedData.connectionsEnabled or true
Wait.time(function() collisionEnabled = true end, 1)
end end
-- Called by Custom Data Helpers to push their location data into the Data Helper. This adds the -- Called by Custom Data Helpers to push their location data into the Data Helper. This adds the
@ -114,7 +111,7 @@ function onCollisionEnter(collisionInfo)
local objType = obj.name local objType = obj.name
-- only continue for cards -- only continue for cards
if not collisionEnabled or (objType ~= "Card" and objType ~= "CardCustom") then if objType ~= "Card" and objType ~= "CardCustom" then
if objType == "Deck" then if objType == "Deck" then
table.insert(missingData, obj) table.insert(missingData, obj)
end end
@ -353,6 +350,7 @@ end
function drawBaseConnections() function drawBaseConnections()
if not showLocationLinks() then if not showLocationLinks() then
locationConnections = {} locationConnections = {}
self.setVectorLines({})
return return
end end
local cardConnectionLines = {} local cardConnectionLines = {}
@ -557,7 +555,7 @@ function onScenarioChanged(scenarioName)
end end
function showLocationLinks() function showLocationLinks()
return not LOC_LINK_EXCLUDE_SCENARIOS[currentScenario] return not LOC_LINK_EXCLUDE_SCENARIOS[currentScenario] and connectionsEnabled
end end
-- Sets this playmat's snap points to limit snapping to locations or not. -- Sets this playmat's snap points to limit snapping to locations or not.
@ -580,6 +578,20 @@ function setLimitSnapsByType(matchTypes)
self.setSnapPoints(snaps) self.setSnapPoints(snaps)
end end
-- called by the option panel to enabled / disable location connections
function setConnectionDrawState(state)
connectionsEnabled = state
rebuildConnectionList()
drawBaseConnections()
end
-- called by the option panel to edit the location connection color
function setConnectionColor(color)
connectionColor = color
rebuildConnectionList()
drawBaseConnections()
end
-- count victory points on locations in play area -- count victory points on locations in play area
---@param highlightOff Boolean True if highlighting should be enabled ---@param highlightOff Boolean True if highlighting should be enabled
---@return. Returns the total amount of VP found in the play area ---@return. Returns the total amount of VP found in the play area

View File

@ -46,10 +46,14 @@ do
return getPlayArea().call("resetSpawnedCards") return getPlayArea().call("resetSpawnedCards")
end end
-- Sets whether location connections should be drawn
PlayAreaApi.setConnectionDrawState = function(state)
getPlayArea().call("setConnectionDrawState", state)
end
-- Sets the connection color -- Sets the connection color
PlayAreaApi.setConnectionColor = function(color) PlayAreaApi.setConnectionColor = function(color)
getPlayArea().setTable("connectionColor", color) getPlayArea().call("setConnectionColor")
getPlayArea().call("drawBaseConnections")
end end
-- Event to be called when the current scenario has changed. -- Event to be called when the current scenario has changed.

View File

@ -26,8 +26,9 @@
<!-- group headers --> <!-- group headers -->
<Row class="group-header" <Row class="group-header"
preferredHeight="54" /> preferredHeight="44" />
<Cell class="group-header" <Cell class="group-header"
padding="10 10 0 0"
columnSpan="3" columnSpan="3"
color="#222222" /> color="#222222" />
<Panel class="group-header" <Panel class="group-header"
@ -42,14 +43,18 @@
tooltipPosition="Left" tooltipPosition="Left"
tooltipBackgroundColor="rgba(0,0,0,1)"/> tooltipBackgroundColor="rgba(0,0,0,1)"/>
<Cell class="option-text" <Cell class="option-text"
padding="10 10 5 5"
color="#333333" color="#333333"
columnSpan="2"/> columnSpan="2"/>
<Cell class="option-button" <Cell class="option-button"
padding="10 10 5 5"
color="#333333"/> color="#333333"/>
<Cell class="option-singleColumn" <Cell class="option-singleColumn"
padding="10 10 5 5"
color="#333333" color="#333333"
columnSpan="1"/> columnSpan="1"/>
<Cell class="option-doubleColumn" <Cell class="option-doubleColumn"
padding="10 10 5 5"
color="#333333" color="#333333"
columnSpan="2"/> columnSpan="2"/>
<Panel class="singleColumn-wrapper" <Panel class="singleColumn-wrapper"
@ -102,7 +107,7 @@
raycastTarget="true"> raycastTarget="true">
<TableLayout columnWidths="0 100 75" <TableLayout columnWidths="0 100 75"
autoCalculateHeight="1" autoCalculateHeight="1"
cellPadding="10 10 5 5"> useGlobalCellPadding="false">
<!-- Group: general settings --> <!-- Group: general settings -->
<Row class="group-header"> <Row class="group-header">
@ -137,12 +142,36 @@
</Cell> </Cell>
</Row> --> </Row> -->
<!-- Option: splash scenario name on setup -->
<Row class="option-text"
tooltip="Fade in the name of the scenario for 2 seconds&#xA;when placing down a scenario.">
<Cell class="option-text">
<Panel class="singleColumn-wrapper">
<Text class="option-header">Show scenario title on setup</Text>
</Panel>
</Cell>
<Cell class="option-button">
<Toggle id="showTitleSplash"
onValueChanged="onClick_toggleOption(showTitleSplash)"/>
</Cell>
</Row>
<!-- Group: play area settings -->
<Row class="group-header">
<Cell class="group-header">
<Panel class="group-header"
image="header_compass">
<Text class="group-header">PLAY AREA SETTINGS</Text>
</Panel>
</Cell>
</Row>
<!-- Option: play area snap tags --> <!-- Option: play area snap tags -->
<Row class="option-text" <Row class="option-text"
tooltip="Only cards with the tag 'Location' will snap (official cards are supported by default).&#xA;Disable this if you are having issues with custom content."> tooltip="Only cards with the tag 'Location' will snap (official cards are supported by default).&#xA;Disable this if you are having issues with custom content.">
<Cell class="option-text"> <Cell class="option-text">
<Panel class="singleColumn-wrapper"> <Panel class="singleColumn-wrapper">
<Text class="option-header">Enable snap tags for play area</Text> <Text class="option-header">Enable snap tags</Text>
</Panel> </Panel>
</Cell> </Cell>
<Cell class="option-button"> <Cell class="option-button">
@ -151,6 +180,20 @@
</Cell> </Cell>
</Row> </Row>
<!-- Option: location connections -->
<Row class="option-text"
tooltip="Automatically draw location connections based on card metadata.">
<Cell class="option-text">
<Panel class="singleColumn-wrapper">
<Text class="option-header">Draw location connections</Text>
</Panel>
</Cell>
<Cell class="option-button">
<Toggle id="playAreaConnections"
onValueChanged="onClick_toggleOption(playAreaConnections)"/>
</Cell>
</Row>
<!-- Option: play area connection color --> <!-- Option: play area connection color -->
<Row class="option-text" <Row class="option-text"
tooltip="This color will be used to draw lines&#xA;for location connections."> tooltip="This color will be used to draw lines&#xA;for location connections.">
@ -168,26 +211,12 @@
</Cell> </Cell>
</Row> </Row>
<!-- Option: splash scenario name on setup -->
<Row class="option-text"
tooltip="Fade in the name of the scenario for 2 seconds&#xA;when placing down a scenario.">
<Cell class="option-text">
<Panel class="singleColumn-wrapper">
<Text class="option-header">Show scenario title on setup</Text>
</Panel>
</Cell>
<Cell class="option-button">
<Toggle id="showTitleSplash"
onValueChanged="onClick_toggleOption(showTitleSplash)"/>
</Cell>
</Row>
<!-- Option: change custom playarea image on setup --> <!-- Option: change custom playarea image on setup -->
<Row class="option-text" <Row class="option-text"
tooltip="Attempts to set the play area to a fitting image&#xA;from the play area image gallery."> tooltip="Attempts to set the play area to a fitting image&#xA;from the play area image gallery.">
<Cell class="option-text"> <Cell class="option-text">
<Panel class="singleColumn-wrapper"> <Panel class="singleColumn-wrapper">
<Text class="option-header">Change playarea background on setup</Text> <Text class="option-header">Change background on setup</Text>
</Panel> </Panel>
</Cell> </Cell>
<Cell class="option-button"> <Cell class="option-button">