Merge branch 'main' into norman-withers-qol
This commit is contained in:
commit
bd28bb9d53
@ -127,7 +127,6 @@
|
||||
"DataHelper.708279",
|
||||
"BlessCurseManager.5933fb",
|
||||
"Notecard.d8d357",
|
||||
"ArkhamDeckCutter.445115",
|
||||
"ScriptingTrigger.a2f932",
|
||||
"EdgeoftheEarth.895eaa",
|
||||
"TheDream-Eaters.a16a1a",
|
||||
|
@ -1,45 +0,0 @@
|
||||
{
|
||||
"AltLookAngle": {
|
||||
"x": 0,
|
||||
"y": 0,
|
||||
"z": 0
|
||||
},
|
||||
"Autoraise": true,
|
||||
"ColorDiffuse": {
|
||||
"b": 0,
|
||||
"g": 0,
|
||||
"r": 0
|
||||
},
|
||||
"Description": "",
|
||||
"DragSelectable": true,
|
||||
"GMNotes": "",
|
||||
"GUID": "445115",
|
||||
"Grid": true,
|
||||
"GridProjection": false,
|
||||
"Hands": false,
|
||||
"HideWhenFaceDown": false,
|
||||
"IgnoreFoW": false,
|
||||
"LayoutGroupSortIndex": 0,
|
||||
"Locked": true,
|
||||
"LuaScript": "require(\"util/DeckCutter\")",
|
||||
"LuaScriptState": "",
|
||||
"MeasureMovement": false,
|
||||
"Name": "Checker_black",
|
||||
"Nickname": "Arkham Deck Cutter",
|
||||
"Snap": true,
|
||||
"Sticky": true,
|
||||
"Tooltip": true,
|
||||
"Transform": {
|
||||
"posX": 78,
|
||||
"posY": 1.208,
|
||||
"posZ": 6.315,
|
||||
"rotX": 0,
|
||||
"rotY": 270,
|
||||
"rotZ": 180,
|
||||
"scaleX": 0.25,
|
||||
"scaleY": 0.25,
|
||||
"scaleZ": 0.25
|
||||
},
|
||||
"Value": 0,
|
||||
"XmlUI": ""
|
||||
}
|
@ -46,7 +46,7 @@
|
||||
"Tooltip": false,
|
||||
"Transform": {
|
||||
"posX": -59.426,
|
||||
"posY": 1.3,
|
||||
"posY": 1,
|
||||
"posZ": -22.721,
|
||||
"rotX": 0,
|
||||
"rotY": 280,
|
||||
|
@ -46,7 +46,7 @@
|
||||
"Tooltip": false,
|
||||
"Transform": {
|
||||
"posX": -23.89,
|
||||
"posY": 1.3,
|
||||
"posY": 1,
|
||||
"posZ": -30.977,
|
||||
"rotX": 0,
|
||||
"rotY": 190,
|
||||
|
@ -46,7 +46,7 @@
|
||||
"Tooltip": false,
|
||||
"Transform": {
|
||||
"posX": -36.87,
|
||||
"posY": 1.3,
|
||||
"posY": 1,
|
||||
"posZ": 30.977,
|
||||
"rotX": 0,
|
||||
"rotY": 10,
|
||||
|
@ -46,7 +46,7 @@
|
||||
"Tooltip": false,
|
||||
"Transform": {
|
||||
"posX": -59.426,
|
||||
"posY": 1.3,
|
||||
"posY": 1,
|
||||
"posZ": 9.395,
|
||||
"rotX": 0,
|
||||
"rotY": 280,
|
||||
|
@ -56,5 +56,5 @@
|
||||
"scaleZ": 0.42
|
||||
},
|
||||
"Value": 0,
|
||||
"XmlUI_path": "DoomCounter.85c4c6.xml"
|
||||
"XmlUI": "\u003cInclude src=\"DoomCounter.xml\"/\u003e"
|
||||
}
|
||||
|
@ -23,6 +23,7 @@
|
||||
"CustomDataHelper.2547b3",
|
||||
"UnderworldMarketHelper.3650ea",
|
||||
"Subject5U-21Helper.1335e8",
|
||||
"PlayermatHider.a758b2",
|
||||
"Auto-failCounter.a9a321",
|
||||
"ElderSignCounter.e62cb5"
|
||||
],
|
||||
|
@ -0,0 +1,60 @@
|
||||
{
|
||||
"AltLookAngle": {
|
||||
"x": 0,
|
||||
"y": 0,
|
||||
"z": 0
|
||||
},
|
||||
"Autoraise": true,
|
||||
"ColorDiffuse": {
|
||||
"b": 1,
|
||||
"g": 1,
|
||||
"r": 1
|
||||
},
|
||||
"CustomImage": {
|
||||
"CustomTile": {
|
||||
"Stackable": false,
|
||||
"Stretch": true,
|
||||
"Thickness": 0.1,
|
||||
"Type": 3
|
||||
},
|
||||
"ImageScalar": 1,
|
||||
"ImageSecondaryURL": "",
|
||||
"ImageURL": "http://cloud-3.steamusercontent.com/ugc/2115061845796985108/F0ADB7094641DA966FFA3AF0CC6987D33D2D9591/",
|
||||
"WidthScale": 0
|
||||
},
|
||||
"Description": "Use the buttons to show / hide a playmat.",
|
||||
"DragSelectable": true,
|
||||
"GMNotes": "",
|
||||
"GUID": "a758b2",
|
||||
"Grid": true,
|
||||
"GridProjection": false,
|
||||
"Hands": false,
|
||||
"HideWhenFaceDown": false,
|
||||
"IgnoreFoW": false,
|
||||
"LayoutGroupSortIndex": 0,
|
||||
"Locked": false,
|
||||
"LuaScript": "require(\"accessories/PlayermatHider\")",
|
||||
"LuaScriptState": "",
|
||||
"MeasureMovement": false,
|
||||
"Name": "Custom_Tile",
|
||||
"Nickname": "PlayermatHider",
|
||||
"Snap": true,
|
||||
"Sticky": true,
|
||||
"Tags": [
|
||||
"CleanUpHelper_ignore"
|
||||
],
|
||||
"Tooltip": true,
|
||||
"Transform": {
|
||||
"posX": 0,
|
||||
"posY": 2,
|
||||
"posZ": 0,
|
||||
"rotX": 0,
|
||||
"rotY": 270,
|
||||
"rotZ": 0,
|
||||
"scaleX": 5,
|
||||
"scaleY": 1,
|
||||
"scaleZ": 5
|
||||
},
|
||||
"Value": 0,
|
||||
"XmlUI": "\u003cInclude src=\"accessories/PlayermatHider.xml\"/\u003e"
|
||||
}
|
@ -73,5 +73,5 @@
|
||||
"scaleZ": 1.5
|
||||
},
|
||||
"Value": 0,
|
||||
"XmlUI_path": "OptionPanelSource.830bd0/CleanUpHelper.26cf4b.xml"
|
||||
"XmlUI": "\u003cInclude src=\"accessories/CleanUpHelper.xml\"/\u003e"
|
||||
}
|
||||
|
41
src/accessories/PlayermatHider.ttslua
Normal file
41
src/accessories/PlayermatHider.ttslua
Normal file
@ -0,0 +1,41 @@
|
||||
local guidReferenceApi = require("core/GUIDReferenceApi")
|
||||
local objects
|
||||
|
||||
function onClick_hideShow(player, matColor)
|
||||
objects = guidReferenceApi.getObjectsByOwner(matColor)
|
||||
local actionTokens = searchMat(objects.Playermat.positionToWorld({-1.1, 0.05, -0.27}), {4, 1, 1}, isActionToken)
|
||||
local pos = objects.Playermat.getPosition()
|
||||
local mod = (pos.y > 0) and -2 or 2
|
||||
|
||||
-- move all objects
|
||||
for _, obj in pairs(objects) do
|
||||
obj.setPosition(obj.getPosition() + Vector(0, mod, 0))
|
||||
end
|
||||
|
||||
-- move action tokens
|
||||
for _, obj in ipairs(actionTokens) do
|
||||
obj.setLock(pos.y > 0)
|
||||
obj.setPosition(obj.getPosition() + Vector(0, mod, 0))
|
||||
end
|
||||
end
|
||||
|
||||
function isActionToken(x) return x.getDescription() == 'Action Token' end
|
||||
|
||||
function searchMat(origin, size, filter)
|
||||
local searchResult = Physics.cast({
|
||||
origin = origin,
|
||||
direction = { 0, 1, 0 },
|
||||
orientation = objects.Playermat.getRotation(),
|
||||
type = 3,
|
||||
size = size,
|
||||
max_distance = 0
|
||||
})
|
||||
|
||||
local objList = {}
|
||||
for _, v in ipairs(searchResult) do
|
||||
if not filter or (filter and filter(v.hit_object)) then
|
||||
table.insert(objList, v.hit_object)
|
||||
end
|
||||
end
|
||||
return objList
|
||||
end
|
@ -44,19 +44,15 @@ local LOC_LINK_EXCLUDE_SCENARIOS = {
|
||||
["The Heart of Madness"] = true
|
||||
}
|
||||
|
||||
local guidReferenceApi = require("core/GUIDReferenceApi")
|
||||
local guidReferenceApi = require("core/GUIDReferenceApi")
|
||||
local tokenManager = require("core/token/TokenManager")
|
||||
|
||||
local clueData = {}
|
||||
local spawnedLocationGUIDs = {}
|
||||
local locations = {}
|
||||
local locationConnections = {}
|
||||
local draggingGuids = {}
|
||||
local locationData
|
||||
local currentScenario
|
||||
|
||||
local missingData = {}
|
||||
local countedVP = {}
|
||||
local locationData, currentScenario
|
||||
|
||||
---------------------------------------------------------
|
||||
-- general code
|
||||
@ -579,17 +575,23 @@ function setLimitSnapsByType(matchTypes)
|
||||
end
|
||||
|
||||
-- count victory points on locations in play area
|
||||
---@param highlightOff Boolean True if highlighting should be enabled
|
||||
---@return. Returns the total amount of VP found in the play area
|
||||
function countVP()
|
||||
function countVP(highlightOff)
|
||||
local totalVP = 0
|
||||
|
||||
for cardId, metadata in pairs(locations) do
|
||||
if metadata ~= nil then
|
||||
local card = getObjectFromGUID(cardId)
|
||||
if metadata ~= nil and card ~= nil then
|
||||
if highlightOff == true then
|
||||
card.highlightOff("Green")
|
||||
end
|
||||
|
||||
local cardVP = tonumber(metadata.victory) or 0
|
||||
if cardVP ~= 0 and not cardHasClues(cardId) then
|
||||
if cardVP ~= 0 and not cardHasClues(card) then
|
||||
totalVP = totalVP + cardVP
|
||||
if cardVP > 0 then
|
||||
table.insert(countedVP, getObjectFromGUID(cardId))
|
||||
if highlightOff == false then
|
||||
card.highlightOn("Green")
|
||||
end
|
||||
end
|
||||
end
|
||||
@ -599,9 +601,8 @@ function countVP()
|
||||
end
|
||||
|
||||
-- checks if a card has clues on it, returns true if clues are on it
|
||||
---@param cardId String GUID of the card to check for clues
|
||||
function cardHasClues(cardId)
|
||||
local card = getObjectFromGUID(cardId)
|
||||
---@param card TTSObject Card to check for clues
|
||||
function cardHasClues(card)
|
||||
for _, v in ipairs(searchOnObj(card)) do
|
||||
local obj = v.hit_object
|
||||
if obj.memo == "clueDoom" and obj.is_face_down == false then
|
||||
@ -639,22 +640,6 @@ function highlightMissingData(state)
|
||||
end
|
||||
end
|
||||
|
||||
-- highlights all locations in the play area with VP
|
||||
---@param state Boolean True if highlighting should be enabled
|
||||
function highlightCountedVP(state)
|
||||
for i, obj in pairs(countedVP) do
|
||||
if obj ~= nil then
|
||||
if state then
|
||||
obj.highlightOff("Green")
|
||||
else
|
||||
obj.highlightOn("Green")
|
||||
end
|
||||
else
|
||||
countedVP[i] = nil
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
-- rebuilds local snap points (could be useful in the future again)
|
||||
function buildSnaps()
|
||||
local upperleft = { x = 1.53, z = -1.09 }
|
||||
|
@ -79,7 +79,7 @@ do
|
||||
-- highlights all locations in the play area with VP
|
||||
---@param state Boolean True if highlighting should be enabled
|
||||
PlayAreaApi.highlightCountedVP = function(state)
|
||||
return getPlayArea().call("highlightCountedVP", state)
|
||||
return getPlayArea().call("countVP", state)
|
||||
end
|
||||
|
||||
-- Checks if an object is in the play area (returns true or false)
|
||||
|
@ -212,8 +212,7 @@ end
|
||||
function highlightMissingData()
|
||||
self.editButton({
|
||||
index = 3,
|
||||
tooltip = (highlightMissing and "Enable" or "Disable") ..
|
||||
" highlighting of cards without metadata (VP on these is not counted)."
|
||||
tooltip = (highlightMissing and "Enable" or "Disable") .. " highlighting of cards without metadata (VP on these is not counted)."
|
||||
})
|
||||
for _, obj in pairs(missingData) do
|
||||
if obj ~= nil then
|
||||
|
@ -868,11 +868,15 @@ function showDrawButton(visible)
|
||||
end
|
||||
end
|
||||
|
||||
-- Spawns / destroys a clickable clue counter for this playmat with the correct amount of clues
|
||||
---@param showCounter Boolean Whether the clickable clue counter should be present
|
||||
-- shows / hides a clickable clue counter for this playmat and sets the correct amount of clues
|
||||
---@param showCounter Boolean Whether the clickable clue counter should be visible
|
||||
function clickableClues(showCounter)
|
||||
local clickerPos = ownedObjects.ClickableClueCounter.getPosition()
|
||||
local clueCount = 0
|
||||
|
||||
-- move clue counters
|
||||
local modY = showcounter and -0.525 or 0.525
|
||||
ownedObjects.ClickableClueCounter.setPosition(clickerPos + Vector(0, modY, 0))
|
||||
|
||||
if showCounter then
|
||||
-- current clue count
|
||||
@ -883,18 +887,10 @@ function clickableClues(showCounter)
|
||||
|
||||
-- set value for clue clickers
|
||||
ownedObjects.ClickableClueCounter.call("updateVal", clueCount)
|
||||
|
||||
-- move clue counters up
|
||||
clickerPos.y = 1.52
|
||||
ownedObjects.ClickableClueCounter.setPosition(clickerPos)
|
||||
else
|
||||
-- current clue count
|
||||
clueCount = ownedObjects.ClickableClueCounter.getVar("val")
|
||||
|
||||
-- move clue counters down
|
||||
clickerPos.y = 1.3
|
||||
ownedObjects.ClickableClueCounter.setPosition(clickerPos)
|
||||
|
||||
-- spawn clues
|
||||
local pos = self.positionToWorld({x = -1.12, y = 0.05, z = 0.7})
|
||||
for i = 1, clueCount do
|
||||
|
@ -1,30 +0,0 @@
|
||||
-- cut 3 (6) cards from a deck if numpad 1 (2) is pressed
|
||||
function onScriptingButtonDown(index, player_color)
|
||||
if not (index >= 1 and index <= 2) then return end
|
||||
|
||||
local count = index * 3
|
||||
local player = Player[player_color]
|
||||
local object = player.getHoverObject()
|
||||
|
||||
if not object then
|
||||
broadcastToColor("Hover over a deck and try again.", player_color, "Orange")
|
||||
return
|
||||
end
|
||||
if object.tag ~= "Deck" then
|
||||
broadcastToColor("Hover over a deck and try again.", player_color, "Orange")
|
||||
return
|
||||
end
|
||||
if count >= object.getQuantity() then
|
||||
broadcastToColor("Deck is too small to cut " .. count .. " cards.", player_color, "Orange")
|
||||
return
|
||||
end
|
||||
|
||||
local pos = object.positionToWorld(Vector(0, 0, -3.5))
|
||||
for _ = 1, count do
|
||||
object.takeObject {
|
||||
index = 0,
|
||||
position = pos,
|
||||
smooth = false
|
||||
}
|
||||
end
|
||||
end
|
@ -59,6 +59,28 @@ function onScriptingButtonDown(index, playerColor)
|
||||
if stateID ~= nil and stateID ~= 1 then
|
||||
callback = function(spawned) spawned.setState(stateID) end
|
||||
end
|
||||
-- check hovered object for "resourceCounter" tokens and increase them instead
|
||||
elseif tokenType == "resourceCounter" then
|
||||
local hoverObj = Player[playerColor].getHoverObject()
|
||||
if hoverObj then
|
||||
if tokenType == hoverObj.getMemo() then
|
||||
hoverObj.call("addOrSubtract")
|
||||
return
|
||||
end
|
||||
end
|
||||
-- check hovered object for "damage" and "horror" tokens and increase them instead
|
||||
elseif tokenType == "damage" or tokenType == "horror" then
|
||||
local hoverObj = Player[playerColor].getHoverObject()
|
||||
if hoverObj then
|
||||
if tokenType == hoverObj.getMemo() then
|
||||
local stateInfo = hoverObj.getStates()
|
||||
local stateId = hoverObj.getStateId()
|
||||
if stateId <= #stateInfo then
|
||||
hoverObj.setState(stateId + 1)
|
||||
return
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
tokenManager.spawnToken(position, tokenType, rotation, callback)
|
||||
|
76
xml/accessories/PlayermatHider.xml
Normal file
76
xml/accessories/PlayermatHider.xml
Normal file
@ -0,0 +1,76 @@
|
||||
<Defaults>
|
||||
<Text color="White"
|
||||
fontSize="110"
|
||||
alignment="MiddleLeft"
|
||||
font="font_teutonic-arkham"/>
|
||||
<Button fontSize="110"
|
||||
height="200"
|
||||
width="600"
|
||||
hoverClass="bGrey"
|
||||
pressClass="bWhite"
|
||||
selectClass="bWhite"
|
||||
color="#aaaaaa"
|
||||
font="font_teutonic-arkham"/>
|
||||
<Button class="bGrey"
|
||||
color="grey"/>
|
||||
<Button class="bWhite"
|
||||
color="white"/>
|
||||
<Button class="activeTab"
|
||||
color="#ffffff"/>
|
||||
<Row preferredHeight="300"/>
|
||||
</Defaults>
|
||||
|
||||
<TableLayout height="1600"
|
||||
width="1800"
|
||||
columnWidths="1000 800"
|
||||
rotation="0 0 180"
|
||||
position="0 0 -11"
|
||||
scale="0.1 0.1 0.1"
|
||||
cellBackgroundColor="none">
|
||||
<Row preferredHeight="400">
|
||||
<Cell columnSpan="2">
|
||||
<Text fontSize="200"
|
||||
alignment="UpperCenter">Playermat Hider</Text>
|
||||
</Cell>
|
||||
</Row>
|
||||
<Row>
|
||||
<Cell>
|
||||
<Text color="White">Playermat 1 (White)</Text>
|
||||
</Cell>
|
||||
<Cell>
|
||||
<Panel>
|
||||
<Button onClick="onClick_hideShow(White)">Show / Hide</Button>
|
||||
</Panel>
|
||||
</Cell>
|
||||
</Row>
|
||||
<Row>
|
||||
<Cell>
|
||||
<Text color="Orange">Playermat 2 (Orange)</Text>
|
||||
</Cell>
|
||||
<Cell>
|
||||
<Panel>
|
||||
<Button onClick="onClick_hideShow(Orange)">Show / Hide</Button>
|
||||
</Panel>
|
||||
</Cell>
|
||||
</Row>
|
||||
<Row>
|
||||
<Cell>
|
||||
<Text color="Green">Playermat 3 (Green)</Text>
|
||||
</Cell>
|
||||
<Cell>
|
||||
<Panel>
|
||||
<Button onClick="onClick_hideShow(Green)">Show / Hide</Button>
|
||||
</Panel>
|
||||
</Cell>
|
||||
</Row>
|
||||
<Row>
|
||||
<Cell>
|
||||
<Text color="Red">Playermat 4 (Red)</Text>
|
||||
</Cell>
|
||||
<Cell>
|
||||
<Panel>
|
||||
<Button onClick="onClick_hideShow(Red)">Show / Hide</Button>
|
||||
</Panel>
|
||||
</Cell>
|
||||
</Row>
|
||||
</TableLayout>
|
Loading…
Reference in New Issue
Block a user