Merge pull request #437 from argonui/playermat-hiding
Playermat Hiding!
This commit is contained in:
commit
bb1a4edd7c
@ -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
|
@ -858,11 +858,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
|
||||
@ -873,18 +877,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
|
||||
|
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