Merge branch 'argonui:main' into campaign-exporter-fix

This commit is contained in:
Entrox-Licher 2024-01-09 22:18:02 -05:00 committed by GitHub
commit ab5194e942
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
20 changed files with 531 additions and 69 deletions

View File

@ -23,6 +23,9 @@
"CharlieKane.4deeff",
"FinnEdwards.dd40c0",
"MontereyJack.46b145",
"MontereyJackParallel.46b146",
"MontereyJackParallelBack.46b148",
"MontereyJackParallelFront.46b147",
"Ifitbleeds.acf2b0",
"BeatCop2.7001be",
"BookofLivingMyths.c5fb1f",
@ -1077,6 +1080,7 @@
"Discipline.3247da",
"ShrewdDealings.c70129",
"BuriedSecrets.28080d",
"BuriedSecrets.28080e",
"MechanicsWrench.598ba0",
"FendOff3.0c2449",
"JointheCaravan1.6367dd",
@ -1224,6 +1228,7 @@
"TidalMemento.b4f9ee",
"JacobMorrison3.aa38d0",
"TrustyBullwhip.ca9a60",
"TrustyBullwhip.ca9a61",
"MobGoons.fc1506",
"GuardDog.001ae8",
"FirstAid3.3c7eb1",

View File

@ -22,7 +22,7 @@
"UniqueBack": false
}
},
"Description": "Weakness",
"Description": "",
"DragSelectable": true,
"GMNotes_path": "AllPlayerCards.15bb07/BuriedSecrets.28080d.gmnotes",
"GUID": "28080d",

View File

@ -0,0 +1,8 @@
{
"id": "90064",
"type": "Treachery",
"class": "Neutral",
"traits": "Mystery.",
"weakness": true,
"cycle": "Relics of the Past"
}

View File

@ -0,0 +1,61 @@
{
"AltLookAngle": {
"x": 0,
"y": 0,
"z": 0
},
"Autoraise": true,
"CardID": 13300,
"ColorDiffuse": {
"b": 0.71324,
"g": 0.71324,
"r": 0.71324
},
"CustomDeck": {
"133": {
"BackIsHidden": true,
"BackURL": "https://i.imgur.com/EcbhVuh.jpg/",
"FaceURL": "http://cloud-3.steamusercontent.com/ugc/2278324186517520416/34030F3F4E7DB48038BAC2BB6010D4781C102301/",
"NumHeight": 1,
"NumWidth": 1,
"Type": 0,
"UniqueBack": false
}
},
"Description": "Advanced",
"DragSelectable": true,
"GMNotes_path": "AllPlayerCards.15bb07/BuriedSecrets.28080e.gmnotes",
"GUID": "28080e",
"Grid": true,
"GridProjection": false,
"Hands": true,
"HideWhenFaceDown": true,
"IgnoreFoW": false,
"LayoutGroupSortIndex": 0,
"Locked": false,
"LuaScript": "",
"LuaScriptState": "",
"MeasureMovement": false,
"Name": "CardCustom",
"Nickname": "Buried Secrets",
"SidewaysCard": false,
"Snap": true,
"Sticky": true,
"Tags": [
"PlayerCard"
],
"Tooltip": true,
"Transform": {
"posX": 9.202,
"posY": 2.672,
"posZ": -16.735,
"rotX": 0,
"rotY": 270,
"rotZ": 0,
"scaleX": 1,
"scaleY": 1,
"scaleZ": 1
},
"Value": 0,
"XmlUI": ""
}

View File

@ -0,0 +1,11 @@
{
"id": "08007-p",
"type": "Investigator",
"class": "Rogue",
"traits": "Wayfarer.",
"willpowerIcons": 1,
"intellectIcons": 4,
"combatIcons": 2,
"agilityIcons": 5,
"cycle": "Relics of the Past"
}

View File

@ -0,0 +1,62 @@
{
"AltLookAngle": {
"x": 0,
"y": 0,
"z": 0
},
"Autoraise": true,
"CardID": 13600,
"ColorDiffuse": {
"b": 0.71324,
"g": 0.71324,
"r": 0.71324
},
"CustomDeck": {
"136": {
"BackIsHidden": true,
"BackURL": "http://cloud-3.steamusercontent.com/ugc/2278324186517520738/82315ABC94958A349B8144CD56E5988E53BF2294/",
"FaceURL": "http://cloud-3.steamusercontent.com/ugc/2278324186517520906/D92C977B92A6B9CCBFB1EDF94ABE919BF22E0FD4/",
"NumHeight": 1,
"NumWidth": 1,
"Type": 0,
"UniqueBack": false
}
},
"Description": "The Archeologist",
"DragSelectable": true,
"GMNotes_path": "AllPlayerCards.15bb07/MontereyJackParallel.46b146.gmnotes",
"GUID": "46b146",
"Grid": true,
"GridProjection": false,
"Hands": true,
"HideWhenFaceDown": false,
"IgnoreFoW": false,
"LayoutGroupSortIndex": 0,
"Locked": false,
"LuaScript": "",
"LuaScriptState": "",
"MeasureMovement": false,
"Name": "CardCustom",
"Nickname": "Monterey Jack (Parallel)",
"SidewaysCard": true,
"Snap": true,
"Sticky": true,
"Tags": [
"Investigator",
"PlayerCard"
],
"Tooltip": true,
"Transform": {
"posX": 53.274,
"posY": 3.137,
"posZ": 22.081,
"rotX": 0,
"rotY": 180,
"rotZ": 0,
"scaleX": 1.15,
"scaleY": 1,
"scaleZ": 1.15
},
"Value": 0,
"XmlUI": ""
}

View File

@ -0,0 +1,11 @@
{
"id": "08007-pb",
"type": "Investigator",
"class": "Rogue",
"traits": "Wayfarer.",
"willpowerIcons": 1,
"intellectIcons": 4,
"combatIcons": 2,
"agilityIcons": 5,
"cycle": "Relics of the Past"
}

View File

@ -0,0 +1,62 @@
{
"AltLookAngle": {
"x": 0,
"y": 0,
"z": 0
},
"Autoraise": true,
"CardID": 13800,
"ColorDiffuse": {
"b": 0.71324,
"g": 0.71324,
"r": 0.71324
},
"CustomDeck": {
"138": {
"BackIsHidden": true,
"BackURL": "http://cloud-3.steamusercontent.com/ugc/2278324186517520738/82315ABC94958A349B8144CD56E5988E53BF2294/",
"FaceURL": "http://cloud-3.steamusercontent.com/ugc/2278324186517531830/EC1E6D6443C07256771BE6E913FFF97949E8FB7D/",
"NumHeight": 1,
"NumWidth": 1,
"Type": 0,
"UniqueBack": false
}
},
"Description": "The Archeologist",
"DragSelectable": true,
"GMNotes_path": "AllPlayerCards.15bb07/MontereyJackParallelBack.46b148.gmnotes",
"GUID": "46b148",
"Grid": true,
"GridProjection": false,
"Hands": true,
"HideWhenFaceDown": false,
"IgnoreFoW": false,
"LayoutGroupSortIndex": 0,
"Locked": false,
"LuaScript": "",
"LuaScriptState": "",
"MeasureMovement": false,
"Name": "CardCustom",
"Nickname": "Monterey Jack (Parallel Back)",
"SidewaysCard": true,
"Snap": true,
"Sticky": true,
"Tags": [
"Investigator",
"PlayerCard"
],
"Tooltip": true,
"Transform": {
"posX": 53.274,
"posY": 3.137,
"posZ": 22.081,
"rotX": 0,
"rotY": 180,
"rotZ": 0,
"scaleX": 1.15,
"scaleY": 1,
"scaleZ": 1.15
},
"Value": 0,
"XmlUI": ""
}

View File

@ -0,0 +1,11 @@
{
"id": "08007-pf",
"type": "Investigator",
"class": "Rogue",
"traits": "Wayfarer.",
"willpowerIcons": 1,
"intellectIcons": 4,
"combatIcons": 2,
"agilityIcons": 5,
"cycle": "Relics of the Past"
}

View File

@ -0,0 +1,62 @@
{
"AltLookAngle": {
"x": 0,
"y": 0,
"z": 0
},
"Autoraise": true,
"CardID": 13700,
"ColorDiffuse": {
"b": 0.71324,
"g": 0.71324,
"r": 0.71324
},
"CustomDeck": {
"137": {
"BackIsHidden": true,
"BackURL": "http://cloud-3.steamusercontent.com/ugc/2278324186517531692/2F83981C724FECFD69619EFE558B675129FEE563/",
"FaceURL": "http://cloud-3.steamusercontent.com/ugc/2278324186517520906/D92C977B92A6B9CCBFB1EDF94ABE919BF22E0FD4/",
"NumHeight": 1,
"NumWidth": 1,
"Type": 0,
"UniqueBack": false
}
},
"Description": "The Archeologist",
"DragSelectable": true,
"GMNotes_path": "AllPlayerCards.15bb07/MontereyJackParallelFront.46b147.gmnotes",
"GUID": "46b147",
"Grid": true,
"GridProjection": false,
"Hands": true,
"HideWhenFaceDown": false,
"IgnoreFoW": false,
"LayoutGroupSortIndex": 0,
"Locked": false,
"LuaScript": "",
"LuaScriptState": "",
"MeasureMovement": false,
"Name": "CardCustom",
"Nickname": "Monterey Jack (Parallel Front)",
"SidewaysCard": true,
"Snap": true,
"Sticky": true,
"Tags": [
"Investigator",
"PlayerCard"
],
"Tooltip": true,
"Transform": {
"posX": 53.274,
"posY": 3.137,
"posZ": 22.081,
"rotX": 0,
"rotY": 180,
"rotZ": 0,
"scaleX": 1.15,
"scaleY": 1,
"scaleZ": 1.15
},
"Value": 0,
"XmlUI": ""
}

View File

@ -0,0 +1,12 @@
{
"id": "90063",
"type": "Asset",
"slot": "Hand",
"class": "Neutral",
"cost": 1,
"traits": "Item. Weapon. Melee.",
"agilityIcons": 2,
"intellectIcons": 1,
"wildIcons": 1,
"cycle": "Relics of the Past"
}

View File

@ -0,0 +1,62 @@
{
"AltLookAngle": {
"x": 0,
"y": 0,
"z": 0
},
"Autoraise": true,
"CardID": 13400,
"ColorDiffuse": {
"b": 0.71324,
"g": 0.71324,
"r": 0.71324
},
"CustomDeck": {
"134": {
"BackIsHidden": true,
"BackURL": "https://i.imgur.com/EcbhVuh.jpg/",
"FaceURL": "http://cloud-3.steamusercontent.com/ugc/2278324186517520604/13B2733436FDBFFCAAF9BD76DFE053F96F559A7E/",
"NumHeight": 1,
"NumWidth": 1,
"Type": 0,
"UniqueBack": false
}
},
"Description": "Advanced",
"DragSelectable": true,
"GMNotes_path": "AllPlayerCards.15bb07/TrustyBullwhip.ca9a61.gmnotes",
"GUID": "ca9a61",
"Grid": true,
"GridProjection": false,
"Hands": true,
"HideWhenFaceDown": true,
"IgnoreFoW": false,
"LayoutGroupSortIndex": 0,
"Locked": false,
"LuaScript": "",
"LuaScriptState": "",
"MeasureMovement": false,
"Name": "CardCustom",
"Nickname": "Trusty Bullwhip",
"SidewaysCard": false,
"Snap": true,
"Sticky": true,
"Tags": [
"Asset",
"PlayerCard"
],
"Tooltip": true,
"Transform": {
"posX": 78.563,
"posY": 3.327,
"posZ": 7.389,
"rotX": 0,
"rotY": 270,
"rotZ": 1,
"scaleX": 1,
"scaleY": 1,
"scaleZ": 1
},
"Value": 0,
"XmlUI": ""
}

View File

@ -14,12 +14,13 @@
"r": 1
},
"ContainedObjects_order": [
"AllorNothing.72ab92",
"BadBlood.451eaa",
"BytheBook.cc7eb3",
"LaidtoRest.e2dd57",
"RelicsofthePast.0d6da1",
"RedTideRising.5302f2",
"ReadorDie.9e73fa",
"RedTideRising.5302f2"
"LaidtoRest.e2dd57",
"BytheBook.cc7eb3",
"BadBlood.451eaa",
"AllorNothing.72ab92"
],
"ContainedObjects_path": "ChallengeScenarios.9f6801",
"CustomMesh": {

View File

@ -1 +1 @@
{"ml":{"451eaa":{"lock":false,"pos":{"x":12.252,"y":1.4815,"z":11.986},"rot":{"x":0,"y":269.9999,"z":0}},"5302f2":{"lock":false,"pos":{"x":12.2505,"y":1.4815,"z":-20.0137},"rot":{"x":0,"y":270.0014,"z":0}},"72ab92":{"lock":false,"pos":{"x":12.25,"y":1.4815,"z":19.986},"rot":{"x":0,"y":269.9999,"z":0}},"9e73fa":{"lock":false,"pos":{"x":12.2501,"y":1.4815,"z":-12.0137},"rot":{"x":0,"y":269.9998,"z":0}},"cc7eb3":{"lock":false,"pos":{"x":12.25,"y":1.4815,"z":3.986},"rot":{"x":0,"y":269.9999,"z":0}},"e2dd57":{"lock":false,"pos":{"x":12.25,"y":1.4815,"z":-4.014},"rot":{"x":0,"y":270,"z":0}}}}
{"ml":{"0d6da1":{"lock":false,"pos":{"x":12.25,"y":1.4815,"z":-28.014},"rot":{"x":0,"y":270.0014,"z":0}},"451eaa":{"lock":false,"pos":{"x":12.252,"y":1.4815,"z":11.986},"rot":{"x":0,"y":269.9999,"z":0}},"5302f2":{"lock":false,"pos":{"x":12.2505,"y":1.4815,"z":-20.0137},"rot":{"x":0,"y":270.0014,"z":0}},"72ab92":{"lock":false,"pos":{"x":12.25,"y":1.4815,"z":19.986},"rot":{"x":0,"y":269.9999,"z":0}},"9e73fa":{"lock":false,"pos":{"x":12.2501,"y":1.4815,"z":-12.0137},"rot":{"x":0,"y":269.9998,"z":0}},"cc7eb3":{"lock":false,"pos":{"x":12.25,"y":1.4815,"z":3.986},"rot":{"x":0,"y":269.9999,"z":0}},"e2dd57":{"lock":false,"pos":{"x":12.25,"y":1.4815,"z":-4.014},"rot":{"x":0,"y":270,"z":0}}}}

View File

@ -0,0 +1,86 @@
{
"AltLookAngle": {
"x": 0,
"y": 0,
"z": 0
},
"AttachedDecals": [
{
"CustomDecal": {
"ImageURL": "http://cloud-3.steamusercontent.com/ugc/959719855119695911/931B9829687A20F4DEADB36DA57B7E6D76792231/",
"Name": "dunwich_back",
"Size": 7.4
},
"Transform": {
"posX": -0.0021877822,
"posY": -0.08963572,
"posZ": -0.00288731651,
"rotX": 270,
"rotY": 359.869568,
"rotZ": 0,
"scaleX": 2.00000215,
"scaleY": 2.00000238,
"scaleZ": 2.00000262
}
}
],
"Autoraise": true,
"ColorDiffuse": {
"a": 0.27451,
"b": 1,
"g": 1,
"r": 1
},
"CustomMesh": {
"CastShadows": true,
"ColliderURL": "",
"Convex": true,
"CustomShader": {
"FresnelStrength": 0,
"SpecularColor": {
"b": 1,
"g": 1,
"r": 1
},
"SpecularIntensity": 0,
"SpecularSharpness": 2
},
"DiffuseURL": "http://cloud-3.steamusercontent.com/ugc/2299716459828640802/A224024254ABCFB818F12B50C1E5E0B32060F972/",
"MaterialIndex": 3,
"MeshURL": "https://raw.githubusercontent.com/RobMayer/TTSLibrary/master/advboxes/tuckbox_h_MSH.obj",
"NormalURL": "",
"TypeIndex": 0
},
"Description": "Challenge Scenario",
"DragSelectable": true,
"GMNotes": "scenarios/challenge_relics_of_the_past.json",
"GUID": "0d6da1",
"Grid": true,
"GridProjection": false,
"Hands": false,
"HideWhenFaceDown": false,
"IgnoreFoW": false,
"LayoutGroupSortIndex": 0,
"Locked": false,
"LuaScript": "require(\"core/DownloadBox\")",
"LuaScriptState": "",
"MeasureMovement": false,
"Name": "Custom_Model",
"Nickname": "Relics of the Past",
"Snap": true,
"Sticky": true,
"Tooltip": true,
"Transform": {
"posX": 12.25,
"posY": 1.481,
"posZ": -28.014,
"rotX": 0,
"rotY": 270,
"rotZ": 0,
"scaleX": 2.21,
"scaleY": 0.46,
"scaleZ": 2.42
},
"Value": 0,
"XmlUI": ""
}

View File

@ -150,7 +150,7 @@ function removeOneUse(playerColor, hoveredObject)
local searchForType = useInfo.type
if searchForType then searchForType = searchForType:lower() end
for _, obj in ipairs(searchLib.onObject(hoveredObject), "isTileOrToken") do
for _, obj in ipairs(searchLib.onObject(hoveredObject, "isTileOrToken")) do
if not obj.locked and obj.memo ~= "resourceCounter" then
-- check for matching object, otherwise use the first hit
if obj.memo == searchForType then

View File

@ -1,3 +1,4 @@
local deckLib = require("util/DeckLib")
local guidReferenceApi = require("core/GUIDReferenceApi")
local playAreaApi = require("core/PlayAreaApi")
local searchLib = require("util/SearchLib")
@ -171,8 +172,7 @@ function actualEncounterCardDraw(card, params)
faceUpRotation = 180
end
end
card.setPositionSmooth(params.pos, false, false)
card.setRotationSmooth({ 0, params.rotY, faceUpRotation }, false, false)
deckLib.placeOrMergeIntoDeck(card, params.pos, { 0, params.rotY, faceUpRotation })
end
function reshuffleEncounterDeck(params)

View File

@ -203,7 +203,7 @@ INVESTIGATOR_GROUPS = {
}
INVESTIGATORS = {}
--Core--
-- Core Box
INVESTIGATORS["Roland Banks"] = {
cards = { "01001", "01001-p", "01001-pf", "01001-pb" },
minicards = { "01001-m" },
@ -234,7 +234,7 @@ INVESTIGATORS["Wendy Adams"] = {
signatures = { "01014", "01015", "01515", "90039", "90040", "90038" },
starterDeck = "2624949"
}
--Dunwich--
-- The Dunwich Legacy
INVESTIGATORS["Zoey Samaras"] = {
cards = { "02001", "02001-p", "02001-pf", "02001-pb" },
minicards = { "02001-m" },
@ -265,7 +265,7 @@ INVESTIGATORS["\"Ashcan\" Pete"] = {
signatures = { "02014", "02015", "90047", "90048" },
starterDeck = "2624969"
}
--Carcosa--
-- The Path to Carcosa
INVESTIGATORS["Mark Harrigan"] = {
cards = { "03001" },
minicards = { "03001-m" },
@ -302,7 +302,7 @@ INVESTIGATORS["Lola Hayes"] = {
signatures = { "03018", "03018", "03019", "03019", "03019-t", "03019-t" },
starterDeck = "2624990"
}
--Forgotten--
-- The Forgotten Age
INVESTIGATORS["Leo Anderson"] = {
cards = { "04001" },
minicards = { "04001-m" },
@ -333,7 +333,7 @@ INVESTIGATORS["Calvin Wright"] = {
signatures = { "04015", "04016" },
starterDeck = "2625007"
}
--Circle--
-- The Circle Undone
INVESTIGATORS["Carolyn Fern"] = {
cards = { "05001" },
minicards = { "05001-m" },
@ -370,7 +370,7 @@ INVESTIGATORS["Marie Lambeau"] = {
signatures = { "05018", "05019" },
starterDeck = "2626395"
}
--Dream--
-- The Dream-Eaters
INVESTIGATORS["Tommy Muldoon"] = {
cards = { "06001" },
minicards = { "06001-m" },
@ -401,7 +401,7 @@ INVESTIGATORS["Patrice Hathaway"] = {
signatures = { "06016", "06017" },
starterDeck = "2626461"
}
--Starter--
-- Starter Decks
INVESTIGATORS["Nathaniel Cho"] = {
cards = { "60101" },
minicards = { "60101-m" },
@ -432,7 +432,7 @@ INVESTIGATORS["Stella Clark"] = {
signatures = { "60502", "60502", "60502", "60503" },
starterDeck = "2643934"
}
--Innsmouth--
-- The Innsmouth Conspiracy
INVESTIGATORS["Sister Mary"] = {
cards = { "07001" },
minicards = { "07001-m" },
@ -463,7 +463,7 @@ INVESTIGATORS["Silas Marsh"] = {
signatures = { "07014", "07015", "07016", "98014", "98015" },
starterDeck = "2626685"
}
--Edge--
-- Edge of the Earth
INVESTIGATORS["Daniela Reyes"] = {
cards = { "08001" },
minicards = { "08001-m" },
@ -477,9 +477,9 @@ INVESTIGATORS["Norman Withers"] = {
starterDeck = "2634603"
}
INVESTIGATORS["Monterey Jack"] = {
cards = { "08007" },
cards = { "08007", "08007-p", "08007-pf", "08007-pb" },
minicards = { "08007-m" },
signatures = { "08008", "08009" },
signatures = { "08008", "08009", "90063", "90064" },
starterDeck = "2634652"
}
INVESTIGATORS["Lily Chen"] = {
@ -494,7 +494,7 @@ INVESTIGATORS["Bob Jenkins"] = {
signatures = { "08017", "08018" },
starterDeck = "2634643"
}
--Scarlet--
-- The Scarlet Keys
INVESTIGATORS["Carson Sinclair"] = {
cards = { "09001" },
minicards = { "09001-m" },
@ -531,7 +531,7 @@ INVESTIGATORS["Charlie Kane"] = {
signatures = { "09019", "09020" },
starterDeck = "2634706"
}
--Hemlock Vale--
-- The Feast of Hemlock Vale
INVESTIGATORS["Wilson Richards"] = {
cards = { "10001" },
minicards = { "10001-m" },
@ -556,14 +556,14 @@ INVESTIGATORS["Kōhaku Narukami"] = {
signatures = { "10013", "10014" },
starterDeck = "2636199" --gloria deck as placeholder
}
--PnP--
-- PnP content
INVESTIGATORS["Subject 5U-21"] = {
cards = { "89001" },
minicards = { "89001-m" },
signatures = { "89002", "89003", "89003", "89003", "89004", "89004", "89004", "89005" },
starterDeck = "2624990" -- Lola's deck id until Suzi is on ArkhamDB
}
--Promo--
-- Promo content
INVESTIGATORS["Gloria Goldberg"] = {
cards = { "98019" },
minicards = { "98019-m" },

View File

@ -1,8 +1,9 @@
local searchLib = require("util/SearchLib")
local chaosBagApi = require("chaosbag/ChaosBagApi")
local deckLib = require("util/DeckLib")
local guidReferenceApi = require("core/GUIDReferenceApi")
local mythosAreaApi = require("core/MythosAreaApi")
local navigationOverlayApi = require("core/NavigationOverlayApi")
local searchLib = require("util/SearchLib")
local tokenChecker = require("core/token/TokenChecker")
local tokenManager = require("core/token/TokenManager")
@ -210,9 +211,9 @@ function discardListOfObjects(objList)
for _, obj in ipairs(objList) do
if obj.type == "Card" or obj.type == "Deck" then
if obj.hasTag("PlayerCard") then
placeOrMergeIntoDeck(obj, returnGlobalDiscardPosition(), self.getRotation())
deckLib.placeOrMergeIntoDeck(obj, returnGlobalDiscardPosition(), self.getRotation())
else
placeOrMergeIntoDeck(obj, ENCOUNTER_DISCARD_POSITION, {x = 0, y = -90, z = 0})
deckLib.placeOrMergeIntoDeck(obj, ENCOUNTER_DISCARD_POSITION, {x = 0, y = -90, z = 0})
end
-- put chaos tokens back into bag (e.g. Unrelenting)
elseif tokenChecker.isChaosToken(obj) then
@ -225,46 +226,6 @@ function discardListOfObjects(objList)
end
end
-- places a card/deck at a position or merges into an existing deck
-- rotation is optional
function placeOrMergeIntoDeck(obj, pos, rot)
if not pos then return end
local offset = 0.5
-- search the new position for existing card/deck
local searchResult = searchArea(pos, { 1, 1, 1 }, "isCardOrDeck")
-- get new position
local newPos
if #searchResult == 1 then
local bounds = searchResult[1].getBounds()
newPos = Vector(pos):setAt("y", bounds.center.y + bounds.size.y / 2 + offset)
else
newPos = Vector(pos) + Vector(0, offset, 0)
end
-- allow moving the objects smoothly out of the hand
obj.use_hands = false
if rot then
obj.setRotationSmooth(rot, false, true)
end
obj.setPositionSmooth(newPos, false, true)
-- continue if the card stops smooth moving
Wait.condition(
function()
obj.use_hands = true
-- this avoids a TTS bug that merges unrelated cards that are not resting
if #searchResult == 1 and searchResult[1] ~= obj then
-- call this with avoiding errors (physics is sometimes too fast so the object doesn't exist for the put)
pcall(function() searchResult[1].putObject(obj) end)
end
end,
function() return not obj.isSmoothMoving() end, 3)
end
-- build a discard button to discard from searchPosition (number must be unique)
function makeDiscardButton(xValue, number)
local position = { xValue, 0.1, -0.94}
@ -530,7 +491,7 @@ function doDiscardOne()
-- get a random non-hidden card (from the "choices" table)
local num = math.random(1, #choices)
placeOrMergeIntoDeck(hand[choices[num]], returnGlobalDiscardPosition(), self.getRotation())
deckLib.placeOrMergeIntoDeck(hand[choices[num]], returnGlobalDiscardPosition(), self.getRotation())
broadcastToAll(playerColor .. " randomly discarded card " .. choices[num] .. "/" .. #hand .. ".", "White")
end
end

47
src/util/DeckLib.ttslua Normal file
View File

@ -0,0 +1,47 @@
do
local DeckLib = {}
local searchLib = require("util/SearchLib")
-- places a card/deck at a position or merges into an existing deck
---@param obj TTSObject Object to move
---@param pos Table New position for the object
---@param rot Table New rotation for the object (optional)
DeckLib.placeOrMergeIntoDeck = function(obj, pos, rot)
if obj == nil or pos == nil then return end
-- search the new position for existing card/deck
local searchResult = searchLib.atPosition(pos, "isCardOrDeck")
-- get new position
local newPos
local offset = 0.5
if #searchResult == 1 then
local bounds = searchResult[1].getBounds()
newPos = Vector(pos):setAt("y", bounds.center.y + bounds.size.y / 2 + offset)
else
newPos = Vector(pos) + Vector(0, offset, 0)
end
-- allow moving the objects smoothly out of the hand
obj.use_hands = false
if rot then
obj.setRotationSmooth(rot, false, true)
end
obj.setPositionSmooth(newPos, false, true)
-- continue if the card stops smooth moving
Wait.condition(
function()
obj.use_hands = true
-- this avoids a TTS bug that merges unrelated cards that are not resting
if #searchResult == 1 and searchResult[1] ~= obj then
-- call this with avoiding errors (physics is sometimes too fast so the object doesn't exist for the put)
pcall(function() searchResult[1].putObject(obj) end)
end
end,
function() return not obj.isSmoothMoving() end, 3)
end
return DeckLib
end