Merge pull request #438 from argonui/numpad-keys
Numpad Keys: increase same counters instead if hovered
This commit is contained in:
commit
3900d91588
@ -127,7 +127,6 @@
|
|||||||
"DataHelper.708279",
|
"DataHelper.708279",
|
||||||
"BlessCurseManager.5933fb",
|
"BlessCurseManager.5933fb",
|
||||||
"Notecard.d8d357",
|
"Notecard.d8d357",
|
||||||
"ArkhamDeckCutter.445115",
|
|
||||||
"ScriptingTrigger.a2f932",
|
"ScriptingTrigger.a2f932",
|
||||||
"EdgeoftheEarth.895eaa",
|
"EdgeoftheEarth.895eaa",
|
||||||
"TheDream-Eaters.a16a1a",
|
"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": ""
|
|
||||||
}
|
|
@ -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
|
if stateID ~= nil and stateID ~= 1 then
|
||||||
callback = function(spawned) spawned.setState(stateID) end
|
callback = function(spawned) spawned.setState(stateID) end
|
||||||
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
|
end
|
||||||
|
|
||||||
tokenManager.spawnToken(position, tokenType, rotation, callback)
|
tokenManager.spawnToken(position, tokenType, rotation, callback)
|
||||||
|
Loading…
Reference in New Issue
Block a user