[Cleanup] Move Zones to a basic require structure

I was trying to use a scoped require, which the tooling didn't like and 
TTS doesn't respect anyway.  Removed the extra structure and changed the 
require() to a simple one.
This commit is contained in:
Buhallin 2022-11-04 11:55:42 -07:00
parent 6d4db4b356
commit 495f3a1d8a
2 changed files with 112 additions and 117 deletions

View File

@ -1,4 +1,4 @@
local Zones = require("playermat/Zones") require("playermat/Zones")
require("arkhamdb/LoaderUi") require("arkhamdb/LoaderUi")
local bondedList = { } local bondedList = { }

View File

@ -19,126 +19,121 @@
-- SetAside4: Upgrade sheets for customizable cards -- SetAside4: Upgrade sheets for customizable cards
-- SetAside5: Hunch Deck for Joe Diamond -- SetAside5: Hunch Deck for Joe Diamond
-- SetAside6: currently unused -- SetAside6: currently unused
do local playerMatGuids = {}
playerMatGuids["Red"] = "0840d5"
playerMatGuids["Orange"] = "bd0ff4"
playerMatGuids["White"] = "8b081b"
playerMatGuids["Green"] = "383d8b"
local playerMatGuids = {} commonZones = {}
playerMatGuids["Red"] = "0840d5" commonZones["Investigator"] = { -1.17702, 0, 0.00209 }
playerMatGuids["Orange"] = "bd0ff4" commonZones["Minicard"] = { -0.4668214, 0, -1.222326 }
playerMatGuids["White"] = "8b081b" commonZones["Deck"] = { -1.822724, 0, -0.02940192 }
playerMatGuids["Green"] = "383d8b" commonZones["Discard"] = { -1.822451, 0, 0.6092291 }
commonZones["Ally"] = { -0.6157398, 0, 0.02435675 }
commonZones["Body"] = { -0.6306521, 0, 0.553170 }
commonZones["Hand1"] = { 0.2155387, 0, 0.04257287 }
commonZones["Hand2"] = { -0.1803701, 0, 0.03745948 }
commonZones["Arcane1"] = { 0.2124223, 0, 0.5596902 }
commonZones["Arcane2"] = { -0.1711275, 0, 0.5567944 }
commonZones["Tarot"] = { 0.6016169, 0, 0.03273106 }
commonZones["Accessory"] = { 0.6049907, 0, 0.5546234 }
commonZones["BlankTop"] = { 1.758446, 0, 0.03965336 }
commonZones["BlankBottom"] = { 1.754469, 0, 0.5634764 }
commonZones["Threat1"] = { -0.9116555, 0, -0.6446251 }
commonZones["Threat2"] = { -0.4544126, 0, -0.6428719 }
commonZones["Threat3"] = { 0.002246313, 0, -0.6430681 }
commonZones["Threat4"] = { 0.4590618, 0, -0.6432732 }
commonZones = {} Zones = {}
commonZones["Investigator"] = { -1.17702, 0, 0.00209 } Zones["White"] = {}
commonZones["Minicard"] = { -0.4668214, 0, -1.222326 } Zones["White"]["Investigator"] = commonZones["Investigator"]
commonZones["Deck"] = { -1.822724, 0, -0.02940192 } Zones["White"]["Minicard"] = commonZones["Minicard"]
commonZones["Discard"] = { -1.822451, 0, 0.6092291 } Zones["White"]["Deck"] = commonZones["Deck"]
commonZones["Ally"] = { -0.6157398, 0, 0.02435675 } Zones["White"]["Discard"] = commonZones["Discard"]
commonZones["Body"] = { -0.6306521, 0, 0.553170 } Zones["White"]["Ally"] = commonZones["Ally"]
commonZones["Hand1"] = { 0.2155387, 0, 0.04257287 } Zones["White"]["Body"] = commonZones["Body"]
commonZones["Hand2"] = { -0.1803701, 0, 0.03745948 } Zones["White"]["Hand1"] = commonZones["Hand1"]
commonZones["Arcane1"] = { 0.2124223, 0, 0.5596902 } Zones["White"]["Hand2"] = commonZones["Hand2"]
commonZones["Arcane2"] = { -0.1711275, 0, 0.5567944 } Zones["White"]["Arcane1"] = commonZones["Arcane1"]
commonZones["Tarot"] = { 0.6016169, 0, 0.03273106 } Zones["White"]["Arcane2"] = commonZones["Arcane2"]
commonZones["Accessory"] = { 0.6049907, 0, 0.5546234 } Zones["White"]["Tarot"] = commonZones["Tarot"]
commonZones["BlankTop"] = { 1.758446, 0, 0.03965336 } Zones["White"]["Accessory"] = commonZones["Accessory"]
commonZones["BlankBottom"] = { 1.754469, 0, 0.5634764 } Zones["White"]["BlankTop"] = commonZones["BlankTop"]
commonZones["Threat1"] = { -0.9116555, 0, -0.6446251 } Zones["White"]["BlankBottom"] = commonZones["BlankBottom"]
commonZones["Threat2"] = { -0.4544126, 0, -0.6428719 } Zones["White"]["Threat1"] = commonZones["Threat1"]
commonZones["Threat3"] = { 0.002246313, 0, -0.6430681 } Zones["White"]["Threat2"] = commonZones["Threat2"]
commonZones["Threat4"] = { 0.4590618, 0, -0.6432732 } Zones["White"]["Threat3"] = commonZones["Threat3"]
Zones["White"]["Threat4"] = commonZones["Threat4"]
Zones["White"]["SetAside1"] = { 2.345893, 0, -0.520315 }
Zones["White"]["SetAside2"] = { 2.345893, 0, 0.042552 }
Zones["White"]["SetAside3"] = { 2.345893, 0, 0.605419 }
Zones["White"]["UnderSetAside3"] = { 2.495893, 0, 0.805419 }
Zones["White"]["SetAside4"] = { 2.775893, 0, -0.520315 }
Zones["White"]["SetAside5"] = { 2.775893, 0, 0.042552 }
Zones["White"]["SetAside6"] = { 2.775893, 0, 0.605419 }
Zones["White"]["UnderSetAside6"] = { 2.925893, 0, 0.805419 }
Zones = {} Zones["Orange"] = {}
Zones["White"] = {} Zones["Orange"]["Investigator"] = commonZones["Investigator"]
Zones["White"]["Investigator"] = commonZones["Investigator"] Zones["Orange"]["Minicard"] = commonZones["Minicard"]
Zones["White"]["Minicard"] = commonZones["Minicard"] Zones["Orange"]["Deck"] = commonZones["Deck"]
Zones["White"]["Deck"] = commonZones["Deck"] Zones["Orange"]["Discard"] = commonZones["Discard"]
Zones["White"]["Discard"] = commonZones["Discard"] Zones["Orange"]["Ally"] = commonZones["Ally"]
Zones["White"]["Ally"] = commonZones["Ally"] Zones["Orange"]["Body"] = commonZones["Body"]
Zones["White"]["Body"] = commonZones["Body"] Zones["Orange"]["Hand1"] = commonZones["Hand1"]
Zones["White"]["Hand1"] = commonZones["Hand1"] Zones["Orange"]["Hand2"] = commonZones["Hand2"]
Zones["White"]["Hand2"] = commonZones["Hand2"] Zones["Orange"]["Arcane1"] = commonZones["Arcane1"]
Zones["White"]["Arcane1"] = commonZones["Arcane1"] Zones["Orange"]["Arcane2"] = commonZones["Arcane2"]
Zones["White"]["Arcane2"] = commonZones["Arcane2"] Zones["Orange"]["Tarot"] = commonZones["Tarot"]
Zones["White"]["Tarot"] = commonZones["Tarot"] Zones["Orange"]["Accessory"] = commonZones["Accessory"]
Zones["White"]["Accessory"] = commonZones["Accessory"] Zones["Orange"]["BlankTop"] = commonZones["BlankTop"]
Zones["White"]["BlankTop"] = commonZones["BlankTop"] Zones["Orange"]["BlankBottom"] = commonZones["BlankBottom"]
Zones["White"]["BlankBottom"] = commonZones["BlankBottom"] Zones["Orange"]["Threat1"] = commonZones["Threat1"]
Zones["White"]["Threat1"] = commonZones["Threat1"] Zones["Orange"]["Threat2"] = commonZones["Threat2"]
Zones["White"]["Threat2"] = commonZones["Threat2"] Zones["Orange"]["Threat3"] = commonZones["Threat3"]
Zones["White"]["Threat3"] = commonZones["Threat3"] Zones["Orange"]["Threat4"] = commonZones["Threat4"]
Zones["White"]["Threat4"] = commonZones["Threat4"] Zones["Orange"]["SetAside1"] = { -2.350362, 0, -0.520315 }
Zones["White"]["SetAside1"] = { 2.345893, 0, -0.520315 } Zones["Orange"]["SetAside2"] = { -2.350362, 0, 0.042552 }
Zones["White"]["SetAside2"] = { 2.345893, 0, 0.042552 } Zones["Orange"]["SetAside3"] = { -2.350362, 0, 0.605419 }
Zones["White"]["SetAside3"] = { 2.345893, 0, 0.605419 } Zones["Orange"]["UnderSetAside3"] = { -2.500362, 0, 0.80419 }
Zones["White"]["UnderSetAside3"] = { 2.495893, 0, 0.805419 } Zones["Orange"]["SetAside4"] = { -2.7803627, 0, -0.520315 }
Zones["White"]["SetAside4"] = { 2.775893, 0, -0.520315 } Zones["Orange"]["SetAside5"] = { -2.7803627, 0, 0.042552 }
Zones["White"]["SetAside5"] = { 2.775893, 0, 0.042552 } Zones["Orange"]["SetAside6"] = { -2.7803627, 0, 0.605419 }
Zones["White"]["SetAside6"] = { 2.775893, 0, 0.605419 } Zones["Orange"]["UnderSetAside6"] = { -2.9303627, 0, 0.80419 }
Zones["White"]["UnderSetAside6"] = { 2.925893, 0, 0.805419 }
Zones["Orange"] = {} -- Green positions are the same as White and Red the same as Orange
Zones["Orange"]["Investigator"] = commonZones["Investigator"] Zones["Red"] = Zones["Orange"]
Zones["Orange"]["Minicard"] = commonZones["Minicard"] Zones["Green"] = Zones["White"]
Zones["Orange"]["Deck"] = commonZones["Deck"]
Zones["Orange"]["Discard"] = commonZones["Discard"]
Zones["Orange"]["Ally"] = commonZones["Ally"]
Zones["Orange"]["Body"] = commonZones["Body"]
Zones["Orange"]["Hand1"] = commonZones["Hand1"]
Zones["Orange"]["Hand2"] = commonZones["Hand2"]
Zones["Orange"]["Arcane1"] = commonZones["Arcane1"]
Zones["Orange"]["Arcane2"] = commonZones["Arcane2"]
Zones["Orange"]["Tarot"] = commonZones["Tarot"]
Zones["Orange"]["Accessory"] = commonZones["Accessory"]
Zones["Orange"]["BlankTop"] = commonZones["BlankTop"]
Zones["Orange"]["BlankBottom"] = commonZones["BlankBottom"]
Zones["Orange"]["Threat1"] = commonZones["Threat1"]
Zones["Orange"]["Threat2"] = commonZones["Threat2"]
Zones["Orange"]["Threat3"] = commonZones["Threat3"]
Zones["Orange"]["Threat4"] = commonZones["Threat4"]
Zones["Orange"]["SetAside1"] = { -2.350362, 0, -0.520315 }
Zones["Orange"]["SetAside2"] = { -2.350362, 0, 0.042552 }
Zones["Orange"]["SetAside3"] = { -2.350362, 0, 0.605419 }
Zones["Orange"]["UnderSetAside3"] = { -2.500362, 0, 0.80419 }
Zones["Orange"]["SetAside4"] = { -2.7803627, 0, -0.520315 }
Zones["Orange"]["SetAside5"] = { -2.7803627, 0, 0.042552 }
Zones["Orange"]["SetAside6"] = { -2.7803627, 0, 0.605419 }
Zones["Orange"]["UnderSetAside6"] = { -2.9303627, 0, 0.80419 }
-- Green positions are the same as White and Red the same as Orange -- Gets the global position for the given zone on the specified player mat.
Zones["Red"] = Zones["Orange"] ---@param playerColor: Color name of the player mat to get the zone position for (e.g. "Red")
Zones["Green"] = Zones["White"] ---@param zoneName: Name of the zone to get the position for. See Zones object documentation for a list of valid zones.
---@return: Global position table, or nil if an invalid player color or zone is specified
-- Gets the global position for the given zone on the specified player mat. function Zones.getZonePosition(playerColor, zoneName)
---@param playerColor: Color name of the player mat to get the zone position for (e.g. "Red") if (playerColor ~= "Red"
---@param zoneName: Name of the zone to get the position for. See Zones object documentation for a list of valid zones. and playerColor ~= "Orange"
---@return: Global position table, or nil if an invalid player color or zone is specified and playerColor ~= "White"
function Zones.getZonePosition(playerColor, zoneName) and playerColor ~= "Green") then
if (playerColor ~= "Red" return nil
and playerColor ~= "Orange"
and playerColor ~= "White"
and playerColor ~= "Green") then
return nil
end
return getObjectFromGUID(playerMatGuids[playerColor]).positionToWorld(Zones[playerColor][zoneName])
end end
return getObjectFromGUID(playerMatGuids[playerColor]).positionToWorld(Zones[playerColor][zoneName])
-- Return the global rotation for a card on the given player mat, based on its metadata. end
---@param playerColor: Color name of the player mat to get the rotation for (e.g. "Red")
---@param cardMetadata: Table of card metadata. Metadata fields type and permanent are required; all others are optional. -- Return the global rotation for a card on the given player mat, based on its metadata.
---@return: Global rotation vector for the given card. This will include the ---@param playerColor: Color name of the player mat to get the rotation for (e.g. "Red")
-- Y rotation to orient the card on the given player mat as well as a ---@param cardMetadata: Table of card metadata. Metadata fields type and permanent are required; all others are optional.
-- Z rotation to place the card face up or face down. ---@return: Global rotation vector for the given card. This will include the
function Zones.getDefaultCardRotation(playerColor, zone) -- Y rotation to orient the card on the given player mat as well as a
local deckRotation = getObjectFromGUID(playerMatGuids[playerColor]).getRotation() -- Z rotation to place the card face up or face down.
function Zones.getDefaultCardRotation(playerColor, zone)
if zone == "Investigator" then local deckRotation = getObjectFromGUID(playerMatGuids[playerColor]).getRotation()
deckRotation = deckRotation + Vector(0, 270, 0)
elseif zone == "Deck" then if zone == "Investigator" then
deckRotation = deckRotation + Vector(0, 0, 180) deckRotation = deckRotation + Vector(0, 270, 0)
end elseif zone == "Deck" then
deckRotation = deckRotation + Vector(0, 0, 180)
return deckRotation end
end
return deckRotation
return Zones
end end