diff --git a/objects/OptionPanelSource.830bd0/jaqenZannsNavigationOverlay.a8affa.json b/objects/OptionPanelSource.830bd0/jaqenZannsNavigationOverlay.a8affa.json index e91417d9..1fa2aa26 100644 --- a/objects/OptionPanelSource.830bd0/jaqenZannsNavigationOverlay.a8affa.json +++ b/objects/OptionPanelSource.830bd0/jaqenZannsNavigationOverlay.a8affa.json @@ -14,9 +14,9 @@ "r": 0.70588 }, "ContainedObjects_order": [ - "NavigationOverlay.739ee5", - "Custom_Assetbundle.cecc3e", - "jaqenZannsNavigationOverlayTile.0ffbc5" + "NavigationOverlay.e5803c", + "CameraPlacementHelper.cecc3e", + "jaqenZannsNavigationOverlayTile.9f2481" ], "ContainedObjects_path": "jaqenZannsNavigationOverlay.a8affa", "Description": "", @@ -41,9 +41,9 @@ "Sticky": true, "Tooltip": true, "Transform": { - "posX": 30.32, - "posY": 3.899, - "posZ": -20.956, + "posX": 76.955, + "posY": 36.39, + "posZ": 4.123, "rotX": 0, "rotY": 180, "rotZ": 0, diff --git a/objects/OptionPanelSource.830bd0/jaqenZannsNavigationOverlay.a8affa/Custom_Assetbundle.cecc3e.json b/objects/OptionPanelSource.830bd0/jaqenZannsNavigationOverlay.a8affa/CameraPlacementHelper.cecc3e.json similarity index 85% rename from objects/OptionPanelSource.830bd0/jaqenZannsNavigationOverlay.a8affa/Custom_Assetbundle.cecc3e.json rename to objects/OptionPanelSource.830bd0/jaqenZannsNavigationOverlay.a8affa/CameraPlacementHelper.cecc3e.json index b7601193..88e21fe4 100644 --- a/objects/OptionPanelSource.830bd0/jaqenZannsNavigationOverlay.a8affa/Custom_Assetbundle.cecc3e.json +++ b/objects/OptionPanelSource.830bd0/jaqenZannsNavigationOverlay.a8affa/CameraPlacementHelper.cecc3e.json @@ -28,18 +28,18 @@ "IgnoreFoW": false, "LayoutGroupSortIndex": 0, "Locked": false, - "LuaScriptState": "{\"distance\":15,\"pitch\":75}", - "LuaScript_path": "OptionPanelSource.830bd0/jaqenZannsNavigationOverlay.a8affa/Custom_Assetbundle.cecc3e.ttslua", + "LuaScriptState": "{\"distance\":\"12\",\"pitch\":\"74\"}", + "LuaScript_path": "OptionPanelSource.830bd0/jaqenZannsNavigationOverlay.a8affa/CameraPlacementHelper.cecc3e.ttslua", "MeasureMovement": false, "Name": "Custom_Assetbundle", - "Nickname": "", + "Nickname": "Camera Placement Helper", "Snap": false, "Sticky": true, "Tooltip": true, "Transform": { - "posX": 18.148, - "posY": 3.504, - "posZ": -26.634, + "posX": -12.658, + "posY": 3.538, + "posZ": 28.573, "rotX": 0, "rotY": 270, "rotZ": 0, @@ -49,4 +49,4 @@ }, "Value": 0, "XmlUI": "" -} \ No newline at end of file +} diff --git a/objects/OptionPanelSource.830bd0/jaqenZannsNavigationOverlay.a8affa/Custom_Assetbundle.cecc3e.ttslua b/objects/OptionPanelSource.830bd0/jaqenZannsNavigationOverlay.a8affa/CameraPlacementHelper.cecc3e.ttslua similarity index 96% rename from objects/OptionPanelSource.830bd0/jaqenZannsNavigationOverlay.a8affa/Custom_Assetbundle.cecc3e.ttslua rename to objects/OptionPanelSource.830bd0/jaqenZannsNavigationOverlay.a8affa/CameraPlacementHelper.cecc3e.ttslua index 1d11233c..86536348 100644 --- a/objects/OptionPanelSource.830bd0/jaqenZannsNavigationOverlay.a8affa/Custom_Assetbundle.cecc3e.ttslua +++ b/objects/OptionPanelSource.830bd0/jaqenZannsNavigationOverlay.a8affa/CameraPlacementHelper.cecc3e.ttslua @@ -73,7 +73,7 @@ function click_setCamera(_, color) local AHLCGNavTile = nil for i,v in ipairs(objectList) do - if v.getName() == 'Navigation Overlay Tile' then + if v.getName() == "jaqenZann's Navigation Overlay Tile" then AHLCGNavTile = v break end @@ -81,7 +81,7 @@ function click_setCamera(_, color) -- local AHLCGNavTile = getObjectFromGUID("0ffbc5") if AHLCGNavTile then - AHLCGNavTile.call('updateEditCamera', {pos, pitch, rot.y, distance}) + AHLCGNavTile.call('updateEditCamera', { { pos.x, pos.y, pos.z }, tonumber(pitch), rot.y, tonumber(distance) }) end end diff --git a/objects/OptionPanelSource.830bd0/jaqenZannsNavigationOverlay.a8affa/NavigationOverlay.739ee5.json b/objects/OptionPanelSource.830bd0/jaqenZannsNavigationOverlay.a8affa/NavigationOverlay.e5803c.json similarity index 69% rename from objects/OptionPanelSource.830bd0/jaqenZannsNavigationOverlay.a8affa/NavigationOverlay.739ee5.json rename to objects/OptionPanelSource.830bd0/jaqenZannsNavigationOverlay.a8affa/NavigationOverlay.e5803c.json index b53e4b41..8c2b8b7e 100644 --- a/objects/OptionPanelSource.830bd0/jaqenZannsNavigationOverlay.a8affa/NavigationOverlay.739ee5.json +++ b/objects/OptionPanelSource.830bd0/jaqenZannsNavigationOverlay.a8affa/NavigationOverlay.e5803c.json @@ -13,7 +13,7 @@ "Description": "Controls a movable overlay allowing for quick movement to various parts of the table. There should only be one tile per table.\n\nFull Table: Displays a larger overlay corresponding to the whole table.\n\nPlay Area: Displays a much smaller overlay only covering the play area.", "DragSelectable": true, "GMNotes": "", - "GUID": "739ee5", + "GUID": "e5803c", "Grid": true, "GridProjection": false, "Hands": false, @@ -60,12 +60,12 @@ "Sticky": true, "Tooltip": true, "Transform": { - "posX": 6.08392429, - "posY": 1.53338218, - "posZ": -32.7559, - "rotX": 0.07987893, - "rotY": 89.9998, - "rotZ": 359.983124, + "posX": -69.47138, + "posY": 1.551499, + "posZ": -50.97995, + "rotX": -6.706855e-8, + "rotY": 90.00628, + "rotZ": 3.98763333e-9, "scaleX": 0.7, "scaleY": 1, "scaleZ": 0.7 @@ -105,12 +105,12 @@ "Sticky": true, "Tooltip": true, "Transform": { - "posX": 6.083923, - "posY": 1.53338218, - "posZ": -32.75589, - "rotX": 0.07987937, - "rotY": 89.99992, - "rotZ": 359.983124, + "posX": -69.47138, + "posY": 1.55149889, + "posZ": -50.97995, + "rotX": -4.66551136e-8, + "rotY": 90.00628, + "rotZ": 9.637148e-9, "scaleX": 0.7, "scaleY": 1, "scaleZ": 0.7 @@ -150,12 +150,57 @@ "Sticky": true, "Tooltip": true, "Transform": { - "posX": 6.08392334, - "posY": 1.53338218, - "posZ": -32.7558937, - "rotX": 0.07987977, - "rotY": 89.9998856, - "rotZ": 359.983124, + "posX": -69.47138, + "posY": 1.55149889, + "posZ": -50.97995, + "rotX": -1.21061817e-7, + "rotY": 90.00628, + "rotZ": 9.462388e-8, + "scaleX": 0.7, + "scaleY": 1, + "scaleZ": 0.7 + }, + "Value": 0, + "XmlUI": "" + }, + "5": { + "AltLookAngle": { + "x": 0, + "y": 0, + "z": 0 + }, + "Autoraise": true, + "ColorDiffuse": { + "b": 1, + "g": 1, + "r": 1 + }, + "Description": "Claim Color: This is useful if you are running a game where one person controls 2 colors, and one controls the other two, and you wish to have your player color switch when you click White or Red, but not if you click Green or Orange.\n\nWhen you click Claim Color, the playmat areas of the overlay will turn white. Clicking one will allow you to switch to that color with the overlay. ", + "DragSelectable": true, + "GMNotes": "", + "GUID": "516664", + "Grid": true, + "GridProjection": false, + "Hands": false, + "HideWhenFaceDown": false, + "IgnoreFoW": false, + "LayoutGroupSortIndex": 0, + "Locked": false, + "LuaScript": "", + "LuaScriptState": "", + "MeasureMovement": false, + "Name": "Notecard", + "Nickname": "Navigation Overlay: Claim Colors", + "Snap": true, + "Sticky": true, + "Tooltip": true, + "Transform": { + "posX": -38.4611664, + "posY": 1.59, + "posZ": -1.54776835, + "rotX": 5.3783765e-8, + "rotY": 90.00012, + "rotZ": 8.552772e-8, "scaleX": 0.7, "scaleY": 1, "scaleZ": 0.7 @@ -167,9 +212,9 @@ "Sticky": true, "Tooltip": true, "Transform": { - "posX": 18.447, - "posY": 3.599, - "posZ": -25.855, + "posX": -37.692, + "posY": 3.67, + "posZ": 9.23, "rotX": 0, "rotY": 90, "rotZ": 0, diff --git a/objects/OptionPanelSource.830bd0/jaqenZannsNavigationOverlay.a8affa/jaqenZannsNavigationOverlayTile.0ffbc5.luascriptstate b/objects/OptionPanelSource.830bd0/jaqenZannsNavigationOverlay.a8affa/jaqenZannsNavigationOverlayTile.0ffbc5.luascriptstate deleted file mode 100644 index 628a58dd..00000000 --- a/objects/OptionPanelSource.830bd0/jaqenZannsNavigationOverlay.a8affa/jaqenZannsNavigationOverlayTile.0ffbc5.luascriptstate +++ /dev/null @@ -1 +0,0 @@ -{"cameras":{"Green":[{"distance":17.844,"pitch":62.964,"position":[-1.626,-2.5,-0.064],"yaw":90},{"distance":-1,"pitch":75.823,"position":[-27.822,-2.5,0.424],"yaw":90},{"distance":-1,"pitch":74.238,"position":[-31.592,-2.5,26.392],"yaw":180},{"distance":-1,"pitch":74.238,"position":[-55.026,-2.5,12.052],"yaw":90},{"distance":-1,"pitch":74.238,"position":[-55.026,-2.5,-11.479],"yaw":90},{"distance":-1,"pitch":74.238,"position":[-31.592,-2.5,-26.392],"yaw":0},{"distance":20.146,"pitch":73.556,"position":[-2.94,-2.5,25.16],"yaw":90},{"distance":20,"pitch":76.43,"position":[-58.216,-2.5,-71.288],"yaw":90},{"distance":46.255,"pitch":69.491,"position":[46.368,-2.5,0.328],"yaw":90},{"distance":37.962,"pitch":69.491,"position":[13.875,-2.5,0.328],"yaw":90},{"distance":48.102,"pitch":76.43,"position":[51.94,-2.5,64.476],"yaw":90},{"distance":48.102,"pitch":76.43,"position":[51.302,-2.5,-73.514],"yaw":90},{"distance":30.616,"pitch":76.43,"position":[-27.788,-2.5,74.662],"yaw":90},{"distance":34.188,"pitch":76.43,"position":[-61.09,-2.5,70.762],"yaw":90},{"distance":42.249,"pitch":76.43,"position":[-18.547,-2.5,-73.514],"yaw":90},{"distance":20.146,"pitch":73.556,"position":[-2.144,-2.5,-26.9],"yaw":90},{"distance":12,"pitch":73.556,"position":[-45,-2.5,-0.228],"yaw":90}],"Orange":[{"distance":17.844,"pitch":62.964,"position":[-1.626,-2.5,-0.064],"yaw":90},{"distance":-1,"pitch":75.823,"position":[-27.822,-2.5,0.424],"yaw":90},{"distance":-1,"pitch":74.238,"position":[-31.592,-2.5,26.392],"yaw":180},{"distance":-1,"pitch":74.238,"position":[-55.026,-2.5,12.052],"yaw":90},{"distance":-1,"pitch":74.238,"position":[-55.026,-2.5,-11.479],"yaw":90},{"distance":-1,"pitch":74.238,"position":[-31.592,-2.5,-26.392],"yaw":0},{"distance":20.146,"pitch":73.556,"position":[-2.94,-2.5,25.16],"yaw":90},{"distance":20,"pitch":76.43,"position":[-58.216,-2.5,-71.288],"yaw":90},{"distance":46.255,"pitch":69.491,"position":[46.368,-2.5,0.328],"yaw":90},{"distance":37.962,"pitch":69.491,"position":[13.875,-2.5,0.328],"yaw":90},{"distance":48.102,"pitch":76.43,"position":[51.94,-2.5,64.476],"yaw":90},{"distance":48.102,"pitch":76.43,"position":[51.302,-2.5,-73.514],"yaw":90},{"distance":30.616,"pitch":76.43,"position":[-27.788,-2.5,74.662],"yaw":90},{"distance":34.188,"pitch":76.43,"position":[-61.09,-2.5,70.762],"yaw":90},{"distance":42.249,"pitch":76.43,"position":[-18.547,-2.5,-73.514],"yaw":90},{"distance":20.146,"pitch":73.556,"position":[-2.144,-2.5,-26.9],"yaw":90},{"distance":12,"pitch":73.556,"position":[-45,-2.5,-0.228],"yaw":90}],"Red":[{"distance":17.844,"pitch":62.964,"position":[-1.626,-2.5,-0.064],"yaw":90},{"distance":-1,"pitch":75.823,"position":[-27.822,-2.5,0.424],"yaw":90},{"distance":-1,"pitch":74.238,"position":[-31.592,-2.5,26.392],"yaw":180},{"distance":-1,"pitch":74.238,"position":[-55.026,-2.5,12.052],"yaw":90},{"distance":-1,"pitch":74.238,"position":[-55.026,-2.5,-11.479],"yaw":90},{"distance":-1,"pitch":74.238,"position":[-31.592,-2.5,-26.392],"yaw":0},{"distance":20.146,"pitch":73.556,"position":[-2.94,-2.5,25.16],"yaw":90},{"distance":20,"pitch":76.43,"position":[-58.216,-2.5,-71.288],"yaw":90},{"distance":46.255,"pitch":69.491,"position":[46.368,-2.5,0.328],"yaw":90},{"distance":37.962,"pitch":69.491,"position":[13.875,-2.5,0.328],"yaw":90},{"distance":48.102,"pitch":76.43,"position":[51.94,-2.5,64.476],"yaw":90},{"distance":48.102,"pitch":76.43,"position":[51.302,-2.5,-73.514],"yaw":90},{"distance":30.616,"pitch":76.43,"position":[-27.788,-2.5,74.662],"yaw":90},{"distance":34.188,"pitch":76.43,"position":[-61.09,-2.5,70.762],"yaw":90},{"distance":42.249,"pitch":76.43,"position":[-18.547,-2.5,-73.514],"yaw":90},{"distance":20.146,"pitch":73.556,"position":[-2.144,-2.5,-26.9],"yaw":90},{"distance":12,"pitch":73.556,"position":[-45,-2.5,-0.228],"yaw":90}],"White":[{"distance":17.844,"pitch":62.964,"position":[-1.626,-2.5,-0.064],"yaw":90},{"distance":-1,"pitch":75.823,"position":[-27.822,-2.5,0.424],"yaw":90},{"distance":-1,"pitch":74.238,"position":[-31.592,-2.5,26.392],"yaw":180},{"distance":-1,"pitch":74.238,"position":[-55.026,-2.5,12.052],"yaw":90},{"distance":-1,"pitch":74.238,"position":[-55.026,-2.5,-11.479],"yaw":90},{"distance":-1,"pitch":74.238,"position":[-31.592,-2.5,-26.392],"yaw":0},{"distance":20.146,"pitch":73.556,"position":[-2.94,-2.5,25.16],"yaw":90},{"distance":20,"pitch":76.43,"position":[-58.216,-2.5,-71.288],"yaw":90},{"distance":46.255,"pitch":69.491,"position":[46.368,-2.5,0.328],"yaw":90},{"distance":37.962,"pitch":69.491,"position":[13.875,-2.5,0.328],"yaw":90},{"distance":48.102,"pitch":76.43,"position":[51.94,-2.5,64.476],"yaw":90},{"distance":48.102,"pitch":76.43,"position":[51.302,-2.5,-73.514],"yaw":90},{"distance":30.616,"pitch":76.43,"position":[-27.788,-2.5,74.662],"yaw":90},{"distance":34.188,"pitch":76.43,"position":[-61.09,-2.5,70.762],"yaw":90},{"distance":42.249,"pitch":76.43,"position":[-18.547,-2.5,-73.514],"yaw":90},{"distance":20.146,"pitch":73.556,"position":[-2.144,-2.5,-26.9],"yaw":90},{"distance":12,"pitch":73.556,"position":[-45,-2.5,-0.228],"yaw":90}]},"fullVis":{"Green":false,"Orange":false,"Red":false,"White":false},"playVis":{"Green":false,"Orange":false,"Red":false,"White":false}} diff --git a/objects/OptionPanelSource.830bd0/jaqenZannsNavigationOverlay.a8affa/jaqenZannsNavigationOverlayTile.0ffbc5.ttslua b/objects/OptionPanelSource.830bd0/jaqenZannsNavigationOverlay.a8affa/jaqenZannsNavigationOverlayTile.0ffbc5.ttslua deleted file mode 100644 index ce5e7a18..00000000 --- a/objects/OptionPanelSource.830bd0/jaqenZannsNavigationOverlay.a8affa/jaqenZannsNavigationOverlayTile.0ffbc5.ttslua +++ /dev/null @@ -1,648 +0,0 @@ --- SCE Navigation Panel version 1.00 - -function onLoad(saved_data) - self.createButton({ - label="", - tooltip="Display full overlay", - click_function="displayFull", - function_owner=self, - position={0.0,0.1,-0.57}, - height=70, - width=800, - scale={x=1, y=1, z=1}, - color={1,0,0,0} - }) - self.createButton({ - label="", - tooltip="Display only play area", - click_function="displayPlayArea", - function_owner=self, - position={0.0,0.1,-0.30}, - height=70, - width=800, - scale={x=1, y=1, z=1}, - color={1,0,0,0} - }) - self.createButton({ - label="", - tooltip="Close overlay", - click_function="closeOverlay", - function_owner=self, - position={0.0,0.1,-0.03}, - height=70, - width=800, - scale={x=1, y=1, z=1}, - color={1,0,0,0} - }) - self.createButton({ - label="", - tooltip="Modify a camera position", - click_function="beginSetCamera", - function_owner=self, - position={0.0,0.1,0.37}, - height=70, - width=800, - scale={x=1, y=1, z=1}, - color={1,0,0,0} - }) - self.createButton({ - label="", - tooltip="Reset camera positions to default", - click_function="resetCameras", - function_owner=self, - position={0.0,0.1,0.77}, - height=70, - width=800, - scale={x=1, y=1, z=1}, - color={1,0,0,0} - }) - - defaultCameraParams = { - {position={-1.626, -2.5, -0.064}, pitch=62.964, yaw=90.000, distance=17.844}, -- 1. ActAgenda - {position={-27.822, -2.5, 0.424}, pitch=75.823, yaw=90.000, distance=-1.000}, -- 2. Map --- {position={-31.592, -2.5, 26.392}, pitch=74.238, yaw=180.000, distance=19.858}, -- 3. Green playmat - {position={-31.592, -2.5, 26.392}, pitch=74.238, yaw=180.000, distance=-1.000}, -- 3. Green playmat - {position={-55.026, -2.5, 12.052}, pitch=74.238, yaw=90.000, distance=-1.000}, -- 4. White playmat - {position={-55.026, -2.5, -11.479}, pitch=74.238, yaw=90.000, distance=-1.000}, -- 5. Orange playmat - {position={-31.592, -2.5, -26.392}, pitch=74.238, yaw=0.000, distance=-1.000}, -- 6. Red playmat - {position={-2.940, -2.5, 25.160}, pitch=73.556, yaw=90.000, distance=20.146}, -- 7. Victory / SetAside - {position={-58.216, -2.5, -71.288}, pitch=76.430, yaw=90.000, distance=20.000}, -- 8. Deckbuilder - {position={46.368, -2.5, 0.328}, pitch=69.491, yaw=90.000, distance=46.255}, -- 9. Campaigns - {position={13.875, -2.5, 0.328}, pitch=69.491, yaw=90.000, distance=37.962}, -- 10. Scenarios - {position={51.940, -2.5, 64.476}, pitch=76.430, yaw=90.000, distance=48.102}, -- 11. Level 0 - {position={51.302, -2.5, -73.514}, pitch=76.430, yaw=90.000, distance=48.102}, -- 12. Upgraded - {position={-27.788, -2.5, 74.662}, pitch=76.430, yaw=90.000, distance=30.616}, -- 13. Weaknesses - {position={-61.090, -2.5, 70.762}, pitch=76.430, yaw=90.000, distance=34.188}, -- 14. Rules - {position={-18.547, -2.5, -73.514}, pitch=76.430, yaw=90.000, distance=42.249}, -- 15. Investigators - {position={-2.144, -2.5, -26.900}, pitch=73.556, yaw=90.000, distance=20.146}, -- 16. Log - {position={-45.000, -2.5, -0.228}, pitch=73.556, yaw=90.000, distance=12.000} -- 17. BlessCurse - } - - fullButtonData = { - { id = "1", width = "84", height = "38", offsetX = "1", offsetY = "-9" }, - { id = "2", width = "78", height = "50", offsetX = "1", offsetY = "-59" }, - { id = "3", width = "36", height = "70", offsetX = "-62", offsetY = "-70" }, - { id = "4", width = "70", height = "40", offsetX = "-36", offsetY = "-130" }, - { id = "5", width = "70", height = "40", offsetX = "39", offsetY = "-130" }, - { id = "6", width = "36", height = "70", offsetX = "64", offsetY = "-70" }, - { id = "7", width = "36", height = "36", offsetX = "-63", offsetY = "-9" }, - { id = "8", width = "64", height = "64", offsetX = "153", offsetY = "-128" }, - { id = "9", width = "155", height = "70", offsetX = "2", offsetY = "120" }, - { id = "10", width = "155", height = 70, offsetX = "2", offsetY = "47" }, - { id = "11", width = "120", height = "100", offsetX = "-148", offsetY = "101" }, - { id = "12", width = "120", height = "100", offsetX = "150", offsetY = "101" }, - { id = "13", width = "120", height = "80", offsetX = "-150", offsetY = "-55" }, - { id = "14", width = "120", height = "60", offsetX = "-150", offsetY = "-132" }, - { id = "15", width = "110", height = "100", offsetX = "152", offsetY = "-42" }, - { id = "16", width = "36", height = "36", offsetX = "64", offsetY = "-9" }, - { id = "17", width = "44", height = "25", offsetX = "1", offsetY = "-97" } - } - - playButtonData = { - { id = "1", width = "84", height = "38", offsetX = "0", offsetY = "59" }, - { id = "2", width = "78", height = "50", offsetX = "0", offsetY = "9" }, - { id = "3", width = "36", height = "70", offsetX = "-62", offsetY = "-1" }, - { id = "4", width = "70", height = "40", offsetX = "-37", offsetY = "-61" }, - { id = "5", width = "70", height = "40", offsetX = "39", offsetY = "-61" }, - { id = "6", width = "36", height = "70", offsetX = "63", offsetY = "-2" }, - { id = "7", width = "36", height = "36", offsetX = "-64", offsetY = "59" }, - { id = "16", width = "36", height = "36", offsetX = "63", offsetY = "59" }, - { id = "17", width = "44", height = "25", offsetX = "0", offsetY = "-28" } - } - - playermatData = { - White = { guid = '8b081b', origin = { x=-54.42, y=0, z=20.96 }, scale = { x=36.63, y=5.10, z=14.59 }, orientation = { x=0, y=270, z=0 }, minX = -61.4, maxX = -48.6, minZ = -2.39, maxZ = 24.53, xOffset = 0.07, zOffset = 0.03 }, - Orange = { guid = 'bd0ff4', origin = { x=-54.42, y=0, z=-20.96 }, scale = { x=36.63, y=5.10, z=14.59 }, orientation = { x=0, y=270, z=0 }, minX = -61.4, maxX = -48.6, minZ = -24.53, maxZ = 2.39, xOffset = 0.07, zOffset = 0.02 }, - Green = { guid = '383d8b', origin = { x=-25.00, y=0, z=26.20 }, scale = { x=31.5, y=5.10, z=14.59 }, orientation = { x=0, y=0, z=0 }, minX = -44.43, maxX = -17.44, minZ = 20.17, maxZ = 32.97, xOffset = -0.07, zOffset = 0.00 }, - Red = { guid = '0840d5', origin = { x=-25.00, y=0, z=-26.60 }, scale = { x=31.5, y=5.10, z=14.59 }, orientation = { x=0, y=180, z=0 }, minX = -44.43, maxX = -17.44, minZ = -32.97, maxZ = -20.17, xOffset = 0.07, zOffset = -0.06 } - } - - editing = false - selectedEditButton = -1 - - editPos = {0, 0, 0} - editPitch = 0 - editYaw = 0 - editDistance = 0 - - if saved_data ~= "" then - local loaded_data = JSON.decode(saved_data) - - cameraParams = loaded_data.cameras - fullVisibility = loaded_data.fullVis - playVisibility = loaded_data.playVis - - resetOverlay() - else - cameraParams = { - Green = {}, - White = {}, - Orange = {}, - Red = {} - } - - for iv, v in pairs({'Green', 'White', 'Orange', 'Red'}) do - cameraParams[v] = {} - - for i = 1,17 do - cameraParams[v][i] = {} - - cameraParams[v][i].position = defaultCameraParams[i].position - cameraParams[v][i].pitch = defaultCameraParams[i].pitch - cameraParams[v][i].yaw = defaultCameraParams[i].yaw - cameraParams[v][i].distance = defaultCameraParams[i].distance - end - end - - fullVisibility = { - Green = false, - White = false, - Orange = false, - Red = false - } - - playVisibility = { - Green = false, - White = false, - Orange = false, - Red = false - } - end -end - -function onSave() - return JSON.encode({ - cameras = cameraParams, - fullVis = fullVisibility, - playVis = playVisibility - }) - --- return '' -end - -function displayFull(object, color) - local playerCount = getPlayerCount() - local colors - if playerCount == 1 then - colors = { 'Green', 'White', 'Orange', 'Red' } - else - colors = { color } - end - - for i, v in ipairs(colors) do - fullVisibility[v] = true - playVisibility[v] = false - end - - resetOverlay() -end - -function displayPlayArea(object, color) - local playerCount = getPlayerCount() - local colors - if playerCount == 1 then - colors = { 'Green', 'White', 'Orange', 'Red' } - else - colors = { color } - end - - for i, v in ipairs(colors) do - fullVisibility[v] = false - playVisibility[v] = true - end - - resetOverlay() -end - -function resetCameras(object, color) - local playerCount = getPlayerCount() - local colors - - if playerCount == 1 then - colors = { 'Green', 'White', 'Orange', 'Red' } - else - colors = { color } - end - - for iv, v in ipairs(colors) do - for i = 1,17 do - cameraParams[v][i].position = defaultCameraParams[i].position - cameraParams[v][i].pitch = defaultCameraParams[i].pitch - cameraParams[v][i].yaw = defaultCameraParams[i].yaw - cameraParams[v][i].distance = defaultCameraParams[i].distance - end - end -end - -function closeOverlay(object, color) - fullVisibility[color] = false - playVisibility[color] = false - - resetOverlay() -end - -function resetOverlay() - local guid = self.getGUID() - local color - local panel - - local existingXml = UI.getXml() - local openingXml = '' - - -- try to only remove our panels - for p = 1,2 do - i, j = string.find(existingXml, ' - ]] - - for i, d in ipairs(data) do - if editing then - if selectedEditButton < 0 then - color = "rgba(1,1,1,1)" - elseif tonumber(d.id) == selectedEditButton then - color = "rgba(0,1,0,1)" - else - color = "rgba(1,0,0,1)" - end - else - color = "rgba(0,1,0,0)" - end - - xml = xml .. [[ - ]] - end - - xml = xml .. [[ ]] - end - - if string.len(playColors) > 0 then - data = playButtonData - - xml = xml .. [[ - - ]] - - for i, d in ipairs(data) do - if editing then - if selectedEditButton < 0 then - color = "rgba(1,1,1,1)" - elseif tonumber(d.id) == selectedEditButton then - color = "rgba(0,1,0,1)" - else - color = "rgba(1,0,0,1)" - end - else - color = "rgba(0,1,0,0)" - end - - xml = xml .. [[ - ]] - end - - xml = xml .. [[ ]] - end - - local existingAssets = UI.getCustomAssets() - local largeOverlay = nil - local smallOverlay = nil - - for i,v in pairs(existingAssets) do - for ii,vv in pairs(v) do - if vv == 'OverlayLarge' then - largeOverlay = v - end - if vv == 'OverlaySmall' then - smallOverlay = v - end - end - end - - local largeURL = 'http://cloud-3.steamusercontent.com/ugc/1745699502804112656/A34D1F30E0DA0E283F300AE6D6B63F59FFC97730/' - local smallURL = 'http://cloud-3.steamusercontent.com/ugc/1745699502804112719/CFFC89BF9FB8439204EE19CF94180EC99450CD38/' - - if largeOverlay == nil then - largeOverlay = { name='OverlayLarge', url=largeURL } - table.insert(existingAssets, largeOverlay) - else - largeOverlay.url = largeURL - - end - - if smallOverlay == nil then - smallOverlay = { name='OverlaySmall', url=smallURL } - table.insert(existingAssets, smallOverlay) - else - smallOverlay.url = smallURL - end - - UI.setXml(xml, existingAssets) -end - -function buttonClicked(player, _, idValue) - if editing then - if selectedEditButton < 0 then - selectedEditButton = tonumber(idValue) - else - if tonumber(idValue) == selectedEditButton and editDistance > 0 then - local playerCount = getPlayerCount() - local colors - - if playerCount == 1 then - colors = { 'Green', 'White', 'Orange', 'Red' } - else - colors = { player.color } - end - - for i, v in ipairs(colors) do - cameraParams[v][selectedEditButton].position = editPos - cameraParams[v][selectedEditButton].pitch = editPitch - cameraParams[v][selectedEditButton].yaw = editYaw - cameraParams[v][selectedEditButton].distance = editDistance - end - end - - editing = false - selectedEditButton = -1 - end - - resetOverlay() - else - loadCamera(player, _, idValue) - end -end - -function loadCamera(player, _, idValue) - local index = tonumber(idValue) - local color = player.color - - -- only do map zooming if te camera hasn't been specially set by user - if index == 2 and cameraParams[color][index].distance <= 0.0 then - local mapObjects = Physics.cast({ - origin = { x=-29.2, y=0, z=0.0 }, - direction = { x=0, y=1, z=0 }, - type = 3, - size = { x=36, y=5, z=31.4 }, - orientation = { x=0, y=90, z=0 } - }) - - local minX = 100 - local maxX = -100 - local minZ = 100 - local maxZ = -100 - - for i,v in pairs(mapObjects) do - local obj = v.hit_object - - if obj.type == 'Card' or obj.type == 'Infinite' then - local bounds = obj.getBounds() - - local x1 = bounds['center'][1] - bounds['size'][1]/2 - local x2 = bounds['center'][1] + bounds['size'][1]/2 - local z1 = bounds['center'][3] - bounds['size'][3]/2 - local z2 = bounds['center'][3] + bounds['size'][3]/2 - - if x1 < minX then - minX = x1 - end - if x2 > maxX then - maxX = x2 - end - if z1 < minZ then - minZ = z1 - end - if z2 > maxZ then - maxZ = z2 - end - end - end - - if minX < 100 then - local dx = maxX - minX - local dz = (maxZ - minZ) / (1.6) -- screen ratio * 1.2 (for my macbook pro, no idea how to generalize this) - local centerX = (minX + maxX) / 2 - dx*0.12 -- offset is to move it a bit up, so the cards don't block anything - local centerZ = (minZ + maxZ) / 2 - - local scale = dx - if dz > dx then - scale = dz - end - - -- regression line from the following data points, seems linear - -- rows 1 scale 4.5 d 12 - -- rows 2 scale 11 d 16 - -- rows 3 scale 14.5 d 19.6 - -- rows 4 scale 19.6 d 25 - -- rows 5 scale 23.25 d 28 - -- rows 6 scale 30.8 d 34 - - -- local d = 0.8685 * scale + 7.4505 - - -- modified by testing - -- local d = 0.8685 * scale + 5 - local d = 1.04 * scale + 5 - - player.lookAt({position={centerX, 0, centerZ}, pitch=75.823, yaw=90.000, distance=d}) - else - player.lookAt({position={-33.667, 0, 0.014}, pitch=75.823, yaw=90.000, distance=36}) - end - elseif index >= 3 and index <= 6 then - local matColor = nil - - if index == 3 then - matColor = 'Green' - elseif index == 4 then - matColor = 'White' - elseif index == 5 then - matColor = 'Orange' - elseif index == 6 then - matColor = 'Red' - end - - if matColor ~= nil then - local playerCount = getPlayerCount() - - if playerCount <= 1 then - player.changeColor(matColor) - end - end - - if cameraParams[color][index].distance <= 0.0 then - local matObjects = Physics.cast({ - origin = playermatData[matColor].origin, - direction = { x=0, y=1, z=0 }, - type = 3, - size = playermatData[matColor].scale, - orientation = playermatData[matColor].orientation, --- debug=true - }) - - local minX = playermatData[matColor].minX - local maxX = playermatData[matColor].maxX - local minZ = playermatData[matColor].minZ - local maxZ = playermatData[matColor].maxZ - - for i,v in pairs(matObjects) do - local obj = v.hit_object - - if obj.type == 'Card' or obj.type == 'Infinite' then - local bounds = obj.getBounds() - - local x1 = bounds['center'][1] - bounds['size'][1]/2 - local x2 = bounds['center'][1] + bounds['size'][1]/2 - local z1 = bounds['center'][3] - bounds['size'][3]/2 - local z2 = bounds['center'][3] + bounds['size'][3]/2 - - if x1 < minX then - minX = x1 - end - if x2 > maxX then - maxX = x2 - end - if z1 < minZ then - minZ = z1 - end - if z2 > maxZ then - maxZ = z2 - end - end - end - - local dx - local dz - local centerX - local centerZ - local scale - local yaw - local d - - -- White/Orange - if index > 3 and index < 6 then - dx = maxX - minX - dz = (maxZ - minZ) / (1.6) -- screen ratio * 1.2 (for my macbook pro, no idea how to generalize this) - - centerX = (minX + maxX) / 2 - dx*playermatData[matColor].xOffset -- offset is to move it a bit up, so the cards don't block anything - centerZ = (minZ + maxZ) / 2 + dz*playermatData[matColor].zOffset -- offset is to move it right a bit, so the toolbar doesn't block anything - yaw = 90 - - scale = dx - if dz > dx then - scale = dz - end - - d = 0.64 * scale + 7 - else -- Green/Red - dx = (maxX - minX) / (1.6) -- screen ratio * 1.2 (for my macbook pro, no idea how to generalize this) - dz = maxZ - minZ - - centerX = (minX + maxX) / 2 + dx*playermatData[matColor].zOffset -- offset is to move it right a bit, so the toolbar doesn't block anything - centerZ = (minZ + maxZ) / 2 - dz*playermatData[matColor].xOffset -- offset is to move it a bit up, so the cards don't block anything - yaw = playermatData[matColor].orientation.y + 180 - - scale = dz - if dx > dz then - scale = dx - end - - d = 0.64 * scale + 7 - end - - -- 15.46 -> 17.081 - -- 18.88 -> 19.33 - -- 24.34 -> 22.6 - - -- need to wait if the player color changed - Wait.frames(function() player.lookAt({position={centerX, 0, centerZ}, pitch=75.823, yaw=yaw, distance=d}) end, 2) - else - Wait.frames(function() player.lookAt(cameraParams[color][index]) end, 2) - end - else - player.lookAt(cameraParams[color][index]) - end -end - -function beginSetCamera(object, color) - editing = true - - resetOverlay() -end - -function updateEditCamera(params) - editPos = params[1] - editPitch = params[2] - editYaw = params[3] - editDistance = params[4] -end - -function getPlayerCount() - local playerCount = 0 - - local playerList = getSeatedPlayers() - - for i, v in ipairs(playerList) do - if v == 'Green' or v == 'White' or v == 'Orange' or v == 'Red' then - playerCount = playerCount + 1 - end - end - - return playerCount -end diff --git a/objects/OptionPanelSource.830bd0/jaqenZannsNavigationOverlay.a8affa/jaqenZannsNavigationOverlayTile.0ffbc5.json b/objects/OptionPanelSource.830bd0/jaqenZannsNavigationOverlay.a8affa/jaqenZannsNavigationOverlayTile.9f2481.json similarity index 68% rename from objects/OptionPanelSource.830bd0/jaqenZannsNavigationOverlay.a8affa/jaqenZannsNavigationOverlayTile.0ffbc5.json rename to objects/OptionPanelSource.830bd0/jaqenZannsNavigationOverlay.a8affa/jaqenZannsNavigationOverlayTile.9f2481.json index bc2aea6c..e6816fe0 100644 --- a/objects/OptionPanelSource.830bd0/jaqenZannsNavigationOverlay.a8affa/jaqenZannsNavigationOverlayTile.0ffbc5.json +++ b/objects/OptionPanelSource.830bd0/jaqenZannsNavigationOverlay.a8affa/jaqenZannsNavigationOverlayTile.9f2481.json @@ -18,14 +18,14 @@ "Type": 0 }, "ImageScalar": 1, - "ImageSecondaryURL": "http://cloud-3.steamusercontent.com/ugc/1745699644170918010/4E5FCD0140AE8960A1E1272A1979E575EE12C3F3/", - "ImageURL": "http://cloud-3.steamusercontent.com/ugc/1745699644170918010/4E5FCD0140AE8960A1E1272A1979E575EE12C3F3/", + "ImageSecondaryURL": "http://cloud-3.steamusercontent.com/ugc/2021591230456185506/15AF790F0622B57C1F629DB3A8C38F2A99D0EB1B/", + "ImageURL": "http://cloud-3.steamusercontent.com/ugc/2021591230456185506/15AF790F0622B57C1F629DB3A8C38F2A99D0EB1B/", "WidthScale": 0 }, "Description": "", "DragSelectable": true, "GMNotes": "", - "GUID": "0ffbc5", + "GUID": "9f2481", "Grid": false, "GridProjection": false, "Hands": false, @@ -33,8 +33,8 @@ "IgnoreFoW": false, "LayoutGroupSortIndex": 0, "Locked": false, - "LuaScriptState_path": "OptionPanelSource.830bd0/jaqenZannsNavigationOverlay.a8affa/jaqenZannsNavigationOverlayTile.0ffbc5.luascriptstate", - "LuaScript_path": "OptionPanelSource.830bd0/jaqenZannsNavigationOverlay.a8affa/jaqenZannsNavigationOverlayTile.0ffbc5.ttslua", + "LuaScriptState_path": "OptionPanelSource.830bd0/jaqenZannsNavigationOverlay.a8affa/jaqenZannsNavigationOverlayTile.9f2481.luascriptstate", + "LuaScript_path": "OptionPanelSource.830bd0/jaqenZannsNavigationOverlay.a8affa/jaqenZannsNavigationOverlayTile.9f2481.ttslua", "MeasureMovement": false, "Name": "Custom_Tile", "Nickname": "jaqenZann's Navigation Overlay Tile", @@ -42,15 +42,15 @@ "Sticky": true, "Tooltip": true, "Transform": { - "posX": 25.962, - "posY": 3.519, - "posZ": -18.624, - "rotX": 1, + "posX": -12.93, + "posY": 3.562, + "posZ": 28.568, + "rotX": 0, "rotY": 270, - "rotZ": 0, - "scaleX": 0.8, + "rotZ": 1, + "scaleX": 3, "scaleY": 1, - "scaleZ": 0.8 + "scaleZ": 3 }, "Value": 0, "XmlUI": "" diff --git a/objects/OptionPanelSource.830bd0/jaqenZannsNavigationOverlay.a8affa/jaqenZannsNavigationOverlayTile.9f2481.luascriptstate b/objects/OptionPanelSource.830bd0/jaqenZannsNavigationOverlay.a8affa/jaqenZannsNavigationOverlayTile.9f2481.luascriptstate new file mode 100644 index 00000000..923cb1c5 --- /dev/null +++ b/objects/OptionPanelSource.830bd0/jaqenZannsNavigationOverlay.a8affa/jaqenZannsNavigationOverlayTile.9f2481.luascriptstate @@ -0,0 +1 @@ +{"cameras":[[{"distance":17.844,"pitch":74,"position":[-1.626,-2.5,0],"yaw":90},{"distance":-1,"pitch":74,"position":[-27.822,-2.5,0.424],"yaw":90},{"distance":-1,"pitch":74,"position":[-31.592,-2.5,26.392],"yaw":180},{"distance":-1,"pitch":74,"position":[-55.026,-2.5,12.052],"yaw":90},{"distance":-1,"pitch":74,"position":[-55.026,-2.5,-11.479],"yaw":90},{"distance":-1,"pitch":74,"position":[-31.592,-2.5,-26.392],"yaw":0},{"distance":16,"pitch":74,"position":[-3.029,1.652,24.296],"yaw":90},{"distance":16,"pitch":74,"position":[-2.936,1.552,-26.757],"yaw":90},{"distance":10,"pitch":74,"position":[-11.833,1.491,-0.145],"yaw":90},{"distance":10,"pitch":74,"position":[-48.352,1.552,-0.055],"yaw":90},{"distance":35,"pitch":74,"position":[12.56,1.912,0.458],"yaw":90},{"distance":22,"pitch":74,"position":[57.835,1.552,75.385],"yaw":90},{"distance":10,"pitch":74,"position":[60.377,1.552,55.941],"yaw":90},{"distance":35,"pitch":74,"position":[27.482,1.48,71.057],"yaw":90},{"distance":22,"pitch":74,"position":[-19.481,1.552,70.88],"yaw":90},{"distance":42,"pitch":74,"position":[-52.918,1.478,70.899],"yaw":90},{"distance":60,"pitch":60,"position":[24.551,2.222,-71.284],"yaw":90},{"distance":27,"pitch":74,"position":[-59.077,1.462,-85.472],"yaw":90}],[{"distance":17.844,"pitch":74,"position":[-1.626,-2.5,0],"yaw":90},{"distance":-1,"pitch":74,"position":[-27.822,-2.5,0.424],"yaw":90},{"distance":-1,"pitch":74,"position":[-31.592,-2.5,26.392],"yaw":180},{"distance":-1,"pitch":74,"position":[-55.026,-2.5,12.052],"yaw":90},{"distance":-1,"pitch":74,"position":[-55.026,-2.5,-11.479],"yaw":90},{"distance":-1,"pitch":74,"position":[-31.592,-2.5,-26.392],"yaw":0},{"distance":16,"pitch":74,"position":[-3.029,1.652,24.296],"yaw":90},{"distance":16,"pitch":74,"position":[-2.936,1.552,-26.757],"yaw":90},{"distance":10,"pitch":74,"position":[-11.833,1.491,-0.145],"yaw":90},{"distance":10,"pitch":74,"position":[-48.352,1.552,-0.055],"yaw":90},{"distance":35,"pitch":74,"position":[12.56,1.912,0.458],"yaw":90},{"distance":22,"pitch":74,"position":[57.835,1.552,75.385],"yaw":90},{"distance":10,"pitch":74,"position":[60.377,1.552,55.941],"yaw":90},{"distance":35,"pitch":74,"position":[27.482,1.48,71.057],"yaw":90},{"distance":22,"pitch":74,"position":[-19.481,1.552,70.88],"yaw":90},{"distance":42,"pitch":74,"position":[-52.918,1.478,70.899],"yaw":90},{"distance":60,"pitch":60,"position":[24.551,2.222,-71.284],"yaw":90},{"distance":27,"pitch":74,"position":[-59.077,1.462,-85.472],"yaw":90}],[{"distance":17.844,"pitch":74,"position":[-1.626,-2.5,0],"yaw":90},{"distance":-1,"pitch":74,"position":[-27.822,-2.5,0.424],"yaw":90},{"distance":-1,"pitch":74,"position":[-31.592,-2.5,26.392],"yaw":180},{"distance":-1,"pitch":74,"position":[-55.026,-2.5,12.052],"yaw":90},{"distance":-1,"pitch":74,"position":[-55.026,-2.5,-11.479],"yaw":90},{"distance":-1,"pitch":74,"position":[-31.592,-2.5,-26.392],"yaw":0},{"distance":16,"pitch":74,"position":[-3.029,1.652,24.296],"yaw":90},{"distance":16,"pitch":74,"position":[-2.936,1.552,-26.757],"yaw":90},{"distance":10,"pitch":74,"position":[-11.833,1.491,-0.145],"yaw":90},{"distance":10,"pitch":74,"position":[-48.352,1.552,-0.055],"yaw":90},{"distance":35,"pitch":74,"position":[12.56,1.912,0.458],"yaw":90},{"distance":22,"pitch":74,"position":[57.835,1.552,75.385],"yaw":90},{"distance":10,"pitch":74,"position":[60.377,1.552,55.941],"yaw":90},{"distance":35,"pitch":74,"position":[27.482,1.48,71.057],"yaw":90},{"distance":22,"pitch":74,"position":[-19.481,1.552,70.88],"yaw":90},{"distance":42,"pitch":74,"position":[-52.918,1.478,70.899],"yaw":90},{"distance":60,"pitch":60,"position":[24.551,2.222,-71.284],"yaw":90},{"distance":27,"pitch":74,"position":[-59.077,1.462,-85.472],"yaw":90}],[{"distance":17.844,"pitch":74,"position":[-1.626,-2.5,0],"yaw":90},{"distance":-1,"pitch":74,"position":[-27.822,-2.5,0.424],"yaw":90},{"distance":-1,"pitch":74,"position":[-31.592,-2.5,26.392],"yaw":180},{"distance":-1,"pitch":74,"position":[-55.026,-2.5,12.052],"yaw":90},{"distance":-1,"pitch":74,"position":[-55.026,-2.5,-11.479],"yaw":90},{"distance":-1,"pitch":74,"position":[-31.592,-2.5,-26.392],"yaw":0},{"distance":16,"pitch":74,"position":[-3.029,1.652,24.296],"yaw":90},{"distance":16,"pitch":74,"position":[-2.936,1.552,-26.757],"yaw":90},{"distance":10,"pitch":74,"position":[-11.833,1.491,-0.145],"yaw":90},{"distance":10,"pitch":74,"position":[-48.352,1.552,-0.055],"yaw":90},{"distance":35,"pitch":74,"position":[12.56,1.912,0.458],"yaw":90},{"distance":22,"pitch":74,"position":[57.835,1.552,75.385],"yaw":90},{"distance":10,"pitch":74,"position":[60.377,1.552,55.941],"yaw":90},{"distance":35,"pitch":74,"position":[27.482,1.48,71.057],"yaw":90},{"distance":22,"pitch":74,"position":[-19.481,1.552,70.88],"yaw":90},{"distance":42,"pitch":74,"position":[-52.918,1.478,70.899],"yaw":90},{"distance":60,"pitch":60,"position":[24.551,2.222,-71.284],"yaw":90},{"distance":27,"pitch":74,"position":[-59.077,1.462,-85.472],"yaw":90}]],"claims":[[true,true,true,false],[true,true,true,false],[true,true,true,false],[false,false,false,true]],"fullVis":[false,false,false,false],"playVis":[false,false,false,false]} diff --git a/objects/OptionPanelSource.830bd0/jaqenZannsNavigationOverlay.a8affa/jaqenZannsNavigationOverlayTile.9f2481.ttslua b/objects/OptionPanelSource.830bd0/jaqenZannsNavigationOverlay.a8affa/jaqenZannsNavigationOverlayTile.9f2481.ttslua new file mode 100644 index 00000000..f52a08a2 --- /dev/null +++ b/objects/OptionPanelSource.830bd0/jaqenZannsNavigationOverlay.a8affa/jaqenZannsNavigationOverlayTile.9f2481.ttslua @@ -0,0 +1,905 @@ +local buttonCount = 20 +local cameraCount = 18 + +function onLoad(saved_data) + self.createButton({ + label = "", + tooltip = "Display full overlay", + click_function = "displayFull", + function_owner = self, + position = { 0.0, 0.1, -0.63 }, + height = 70, + width = 700, + scale = { x = 1, y = 1, z = 1 }, + color = { 1, 0, 0, 0 } + }) + self.createButton({ + label = "", + tooltip = "Display only play area", + click_function = "displayPlayArea", + function_owner = self, + position = { 0.0, 0.1, -0.39 }, + height = 70, + width = 700, + scale = { x = 1, y = 1, z = 1 }, + color = { 1, 0, 0, 0 } + }) + self.createButton({ + label = "", + tooltip = "Close overlay", + click_function = "closeOverlay", + function_owner = self, + position = { 0.0, 0.1, -0.16 }, + height = 70, + width = 700, + scale = { x = 1, y = 1, z = 1 }, + color = { 1, 0, 0, 0 } + }) + self.createButton({ + label = "", + tooltip = "Modify a camera position", + click_function = "beginSetCamera", + function_owner = self, + position = { 0.0, 0.1, 0.19 }, + height = 70, + width = 700, + scale = { x = 1, y = 1, z = 1 }, + color = { 1, 0, 0, 0 } + }) + self.createButton({ + label = "", + tooltip = "Claim a color (you will switch to this color when clicking in the overlay)", + click_function = "beginClaimColor", + function_owner = self, + position = { -0.22, 0.1, 0.42 }, + height = 70, + width = 475, + scale = { x = 1, y = 1, z = 1 }, + color = { 1, 0, 0, 0 } + }) + self.createButton({ + label = "", + tooltip = "Reset all color claims", + click_function = "resetClaimColors", + function_owner = self, + position = { 0.48, 0.1, 0.42 }, + height = 70, + width = 230, + scale = { x = 1, y = 1, z = 1 }, + color = { 1, 0, 0, 0 } + }) + self.createButton({ + label = "", + tooltip = "Reset camera positions to default", + click_function = "resetCameras", + function_owner = self, + position = { 0.0, 0.1, 0.78 }, + height = 70, + width = 700, + scale = { x = 1, y = 1, z = 1 }, + color = { 1, 0, 0, 0 } + }) + + defaultCameraParams = { + { position = { -1.626, -2.5, 0 }, pitch = 74, yaw = 90, distance = 17.844 }, -- 1. ActAgenda + { position = { -27.822, -2.5, 0.424 }, pitch = 74, yaw = 90, distance = -1 }, -- 2. Map + { position = { -31.592, -2.5, 26.392 }, pitch = 74, yaw = 180, distance = -1 }, -- 3. Green playmat + { position = { -55.026, -2.5, 12.052 }, pitch = 74, yaw = 90, distance = -1 }, -- 4. White playmat + { position = { -55.026, -2.5, -11.479 }, pitch = 74, yaw = 90, distance = -1 }, -- 5. Orange playmat + { position = { -31.592, -2.5, -26.392 }, pitch = 74, yaw = 0, distance = -1 }, -- 6. Red playmat + { position = { -3.029, 1.652, 24.296 }, pitch = 74, yaw = 90, distance = 16 }, -- 7. Victory / SetAside + { position = { -2.936, 1.552, -26.757 }, pitch = 74, yaw = 90, distance = 16 }, -- 8. Guide + { position = { -11.833, 1.491, -0.145 }, pitch = 74, yaw = 90, distance = 10 }, -- 9. Player count + { position = { -48.352, 1.552, -0.055 }, pitch = 74, yaw = 90, distance = 10 }, -- 10. Bless/Curse + { position = { 12.560, 1.912, 0.458 }, pitch = 74, yaw = 90, distance = 35 }, -- 11. Scenarios + { position = { 57.835, 1.552, 75.385 }, pitch = 74, yaw = 90, distance = 22 }, -- 12. Player card panel + { position = { 60.377, 1.552, 55.941 }, pitch = 74, yaw = 90, distance = 10 }, -- 13. Card search panel + { position = { 27.482, 1.480, 71.057 }, pitch = 74, yaw = 90, distance = 35 }, -- 14. Player card area + { position = { -19.481, 1.552, 70.880 }, pitch = 74, yaw = 90, distance = 22 }, -- 15. Deck builder + { position = { -52.918, 1.478, 70.899 }, pitch = 74, yaw = 90, distance = 42 }, -- 16. Rules area + { position = { 24.551, 2.222, -71.284 }, pitch = 60, yaw = 90, distance = 60 }, -- 17. Cycle area + { position = { -59.077, 1.462, -85.472 }, pitch = 74, yaw = 90, distance = 27 } -- 18. Additions + } + + fullButtonData = { + { id = "1", width = "84", height = "33", offsetX = "1", offsetY = "2" }, -- Act/Agenda + { id = "2", width = "78", height = "69", offsetX = "1", offsetY = "-62" }, -- Map + { id = "3", width = "36", height = "70", offsetX = "-62", offsetY = "-66" }, -- Green + { id = "4", width = "70", height = "36", offsetX = "-36", offsetY = "-126" }, -- White + { id = "5", width = "70", height = "36", offsetX = "39", offsetY = "-126" }, -- Orange + { id = "6", width = "36", height = "70", offsetX = "64", offsetY = "-66" }, -- Red + { id = "7", width = "38", height = "38", offsetX = "-64", offsetY = "-3" }, -- Victory + { id = "8", width = "40", height = "40", offsetX = "66", offsetY = "-3" }, -- Guide + { id = "9", width = "56", height = "16", offsetX = "1", offsetY = "-20" }, -- Player count + { id = "10", width = "36", height = "16", offsetX = "1", offsetY = "-102" }, -- Bless/Curse + { id = "11", width = "168", height = "56", offsetX = "1", offsetY = "47" }, -- Scenarios + { id = "12", width = "52", height = "53", offsetX = "-154", offsetY = "134" }, -- Player card panel + { id = "13", width = "22", height = "22", offsetX = "-116", offsetY = "132" }, -- Search card panel + { id = "14", width = "120", height = "75", offsetX = "-152", offsetY = "70" }, -- Player card display + { id = "15", width = "40", height = "54", offsetX = "-150", offsetY = "-38" }, -- Deck builder + { id = "16", width = "104", height = "84", offsetX = "-154", offsetY = "-114" }, -- Rules area + { id = "17", width = "100", height = "170", offsetX = "152", offsetY = "72" }, -- Cycle area + { id = "18", width = "56", height = "60", offsetX = "182", offsetY = "-124" }, -- Additions + { id = "19", width = "20", height = "20", offsetX = "-8", offsetY = "150" }, -- Shrink + { id = "20", width = "20", height = "20", offsetX = "12", offsetY = "150" } -- Close + } + + playButtonData = { + { id = "1", width = "80", height = "33", offsetX = "0", offsetY = "55" }, + { id = "2", width = "78", height = "70", offsetX = "0", offsetY = "-8" }, + { id = "3", width = "35", height = "66", offsetX = "-65", offsetY = "-10" }, + { id = "4", width = "68", height = "32", offsetX = "-36", offsetY = "-71" }, + { id = "5", width = "68", height = "32", offsetX = "36", offsetY = "-71" }, + { id = "6", width = "35", height = "66", offsetX = "65", offsetY = "-10" }, + { id = "7", width = "38", height = "38", offsetX = "-66", offsetY = "52" }, + { id = "8", width = "38", height = "38", offsetX = "66", offsetY = "52" }, + { id = "9", width = "50", height = "12", offsetX = "0", offsetY = "33" }, + { id = "10", width = "32", height = "12", offsetX = "0", offsetY = "-48" }, + { id = "19", width = "20", height = "20", offsetX = "-10", offsetY = "80" }, + { id = "20", width = "20", height = "20", offsetX = "10", offsetY = "80" } + } + + playermatData = { + { + guid = '383d8b', + origin = { x = -25.00, y = 0, z = 26.20 }, + scale = { x = 31.5, y = 5.10, z = 14.59 }, + orientation = { x = 0, y = 0, z = 0 }, + minX = -44.43, + maxX = -17.44, + minZ = 20.17, + maxZ = 32.97, + xOffset = -0.07, + zOffset = 0.00, + claims = { true, false, false, false } + }, + { + guid = '8b081b', + origin = { x = -54.42, y = 0, z = 20.96 }, + scale = { x = 36.63, y = 5.10, z = 14.59 }, + orientation = { x = 0, y = 270, z = 0 }, + minX = -61.4, + maxX = -48.6, + minZ = -2.39, + maxZ = 24.53, + xOffset = 0.07, + zOffset = 0.03, + claims = { false, true, false, false } + }, + { + guid = 'bd0ff4', + origin = { x = -54.42, y = 0, z = -20.96 }, + scale = { x = 36.63, y = 5.10, z = 14.59 }, + orientation = { x = 0, y = 270, z = 0 }, + minX = -61.4, + maxX = -48.6, + minZ = -24.53, + maxZ = 2.39, + xOffset = 0.07, + zOffset = 0.02, + claims = { false, false, true, false } + }, + { + guid = '0840d5', + origin = { x = -25.00, y = 0, z = -26.60 }, + scale = { x = 31.5, y = 5.10, z = 14.59 }, + orientation = { x = 0, y = 180, z = 0 }, + minX = -44.43, + maxX = -17.44, + minZ = -32.97, + maxZ = -20.17, + xOffset = 0.07, + zOffset = -0.06, + claims = { false, false, false, true } + } + } + + editing = false + claiming = false + selectedEditButton = -1 + + editPos = { 0, 0, 0 } + editPitch = 0 + editYaw = 0 + editDistance = 0 + + if saved_data ~= "" then + local loaded_data = JSON.decode(saved_data) + + cameraParams = loaded_data.cameras + fullVisibility = loaded_data.fullVis + playVisibility = loaded_data.playVis + local allclaims = loaded_data.claims + + for i = 1, 4 do + playermatData[i].claims = allclaims[i] + end + + resetOverlay() + else + cameraParams = { {}, {}, {}, {} } + + for cam = 1, 4 do + cameraParams[cam] = {} + + for i = 1, cameraCount do + cameraParams[cam][i] = {} + cameraParams[cam][i].position = defaultCameraParams[i].position + cameraParams[cam][i].pitch = defaultCameraParams[i].pitch + cameraParams[cam][i].yaw = defaultCameraParams[i].yaw + cameraParams[cam][i].distance = defaultCameraParams[i].distance + end + end + + fullVisibility = { false, false, false, false } + playVisibility = { false, false, false, false } + end +end + +function onSave() + local allclaims = {} + + for i = 1, 4 do + table.insert(allclaims, playermatData[i].claims) + end + + return JSON.encode({ + cameras = cameraParams, + fullVis = fullVisibility, + playVis = playVisibility, + claims = allclaims + }) +end + +function displayFull(object, color) + local playerCount = getPlayerCount() + local colors + + if playerCount == 0 then + return + elseif playerCount == 1 then + colors = { 1, 2, 3, 4 } + else + colors = { getIndexForPlayerColor(color) } + end + + for i, v in ipairs(colors) do + if v > 0 then + fullVisibility[v] = true + playVisibility[v] = false + end + end + + resetOverlay() +end + +function displayPlayArea(object, color) + local playerCount = getPlayerCount() + local colors + + if playerCount == 0 then + return + elseif playerCount == 1 then + colors = { 1, 2, 3, 4 } + else + colors = { getIndexForPlayerColor(color) } + end + + for i, v in ipairs(colors) do + if v > 0 then + fullVisibility[v] = false + playVisibility[v] = true + end + end + + resetOverlay() +end + +function resetCameras(object, color) + local playerCount = getPlayerCount() + local colors + + if playerCount == 0 then + return + elseif playerCount == 1 then + colors = { 1, 2, 3, 4 } + else + colors = { getIndexForPlayerColor(color) } + end + + for iv, v in ipairs(colors) do + if v > 0 then + for i = 1, cameraCount do + cameraParams[v][i].position = defaultCameraParams[i].position + cameraParams[v][i].pitch = defaultCameraParams[i].pitch + cameraParams[v][i].yaw = defaultCameraParams[i].yaw + cameraParams[v][i].distance = defaultCameraParams[i].distance + end + end + end +end + +function closeOverlay(object, color) + local playerCount = getPlayerCount() + local colors + + editing = false + claiming = false + + if playerCount == 0 then + return + elseif playerCount == 1 then + colors = { 1, 2, 3, 4 } + else + colors = { getIndexForPlayerColor(color) } + end + + for iv, v in ipairs(colors) do + if v > 0 then + fullVisibility[v] = false + playVisibility[v] = false + end + end + + resetOverlay() +end + +function resizeOverlay(object, color) + local playerCount = getPlayerCount() + local colors + + if playerCount == 0 then + return + elseif playerCount == 1 then + colors = { 1, 2, 3, 4 } + else + colors = { getIndexForPlayerColor(color) } + end + + for iv, v in ipairs(colors) do + if v > 0 then + local full = fullVisibility[v] + fullVisibility[v] = not full + playVisibility[v] = full + end + end + + resetOverlay() +end + +function resetOverlay() + local guid = self.getGUID() + local color + local panel + local existingXml = UI.getXml() + local openingXml = '' + + -- try to only remove our panels + for p = 1, 2 do + i, j = string.find(existingXml, ' + ]] + + for i, d in ipairs(data) do + local buttonID = tonumber(d.id) + + if editing and buttonID < 19 then + if selectedEditButton < 0 then + color = "rgba(1,1,1,1)" + elseif buttonID == selectedEditButton then + color = "rgba(0,1,0,1)" + else + color = "rgba(1,0,0,1)" + end + elseif claiming and buttonID < 19 then + if buttonID >= 3 and buttonID <= 6 then + color = "rgba(1,1,1,1)" + else + color = "rgba(1,0,0,1)" + end + else + color = "rgba(0,1,0,0)" + end + + xml = xml .. [[ + ]] + end + + xml = xml .. [[ ]] + end + + if string.len(playColors) > 0 then + data = playButtonData + + xml = xml .. [[ + + ]] + + for i, d in ipairs(data) do + local buttonID = tonumber(d.id) + + if editing and buttonID < 19 then + if selectedEditButton < 0 then + color = "rgba(1,1,1,1)" + elseif buttonID == selectedEditButton then + color = "rgba(0,1,0,1)" + else + color = "rgba(1,0,0,1)" + end + elseif claiming and buttonID < 19 then + if buttonID >= 3 and buttonID <= 6 then + color = "rgba(1,1,1,1)" + else + color = "rgba(1,0,0,1)" + end + else + color = "rgba(0,1,0,0)" + end + + xml = xml .. [[ + ]] + end + + xml = xml .. [[ ]] + end + + local existingAssets = UI.getCustomAssets() + local largeOverlay = nil + local smallOverlay = nil + + for i, v in pairs(existingAssets) do + for ii, vv in pairs(v) do + if vv == 'OverlayLarge' then + largeOverlay = v + end + if vv == 'OverlaySmall' then + smallOverlay = v + end + end + end + + local largeURL = 'http://cloud-3.steamusercontent.com/ugc/2021591230441678995/7B413A821136969D8723687A2AD66773B3F8FEED/' + local smallURL = 'http://cloud-3.steamusercontent.com/ugc/2021591230447630077/18C86248B9BDAF1DE01B67791439A39EE4F97B60/' + + if largeOverlay == nil then + largeOverlay = { name = 'OverlayLarge', url = largeURL } + table.insert(existingAssets, largeOverlay) + else + largeOverlay.url = largeURL + end + + if smallOverlay == nil then + smallOverlay = { name = 'OverlaySmall', url = smallURL } + table.insert(existingAssets, smallOverlay) + else + smallOverlay.url = smallURL + end + + UI.setXml(xml, existingAssets) +end + +function buttonClicked(player, _, idValue) + local buttonID = tonumber(idValue) + + if buttonID >= 19 then + if buttonID == 19 then + resizeOverlay(nil, player.color) + elseif buttonID == 20 then + closeOverlay(nil, player.color) + end + return + end + + if editing then + if selectedEditButton < 0 then + selectedEditButton = buttonID + else + if buttonID == selectedEditButton and editDistance > 0 then + local playerCount = getPlayerCount() + local colors + + if playerCount == 1 then + colors = { 1, 2, 3, 4 } + else + colors = { getIndexForPlayerColor(player.color) } + end + + for i, v in ipairs(colors) do + cameraParams[v][selectedEditButton].position = editPos + cameraParams[v][selectedEditButton].pitch = editPitch + cameraParams[v][selectedEditButton].yaw = editYaw + cameraParams[v][selectedEditButton].distance = editDistance + end + end + + editing = false + selectedEditButton = -1 + end + + resetOverlay() + elseif claiming then + if buttonID >= 3 and buttonID <= 6 then + local colorID = buttonID - 2 + local playerIndex = getIndexForPlayerColor(player.color) + + -- if we haven't claimed it, break all earlier claims + if playermatData[playerIndex].claims[colorID] == false then + for i = 1, 4 do + if i ~= colorID then + playermatData[i].claims[colorID] = false + playermatData[colorID].claims[i] = false + end + end + end + + for i = 1, 4 do + if playermatData[playerIndex].claims[i] then + playermatData[i].claims[colorID] = true + playermatData[colorID].claims[i] = true + end + end + + fullVisibility[colorID] = fullVisibility[playerIndex] + playVisibility[colorID] = playVisibility[playerIndex] + end + + claiming = false + resetOverlay() + else + loadCamera(player, _, idValue) + end +end + +function loadCamera(player, _, idValue) + local index = tonumber(idValue) + local playerColor = player.color + local playerIndex = getIndexForPlayerColor(playerColor) + + -- only do map zooming if the camera hasn't been specially set by user + if index == 2 and cameraParams[playerIndex][index].distance <= 0.0 then + local mapObjects = Physics.cast({ + origin = { x = -29.2, y = 0, z = 0.0 }, + direction = { x = 0, y = 1, z = 0 }, + type = 3, + size = { x = 36, y = 5, z = 31.4 }, + orientation = { x = 0, y = 90, z = 0 } + }) + + local minX = 100 + local maxX = -100 + local minZ = 100 + local maxZ = -100 + + for i, v in pairs(mapObjects) do + local obj = v.hit_object + + if obj.type == 'Card' or obj.type == 'Infinite' then + local bounds = obj.getBounds() + local x1 = bounds['center'][1] - bounds['size'][1] / 2 + local x2 = bounds['center'][1] + bounds['size'][1] / 2 + local z1 = bounds['center'][3] - bounds['size'][3] / 2 + local z2 = bounds['center'][3] + bounds['size'][3] / 2 + + if x1 < minX then + minX = x1 + end + if x2 > maxX then + maxX = x2 + end + if z1 < minZ then + minZ = z1 + end + if z2 > maxZ then + maxZ = z2 + end + end + end + + if minX < 100 then + local dx = maxX - minX + local dz = (maxZ - minZ) / (1.6) -- screen ratio * 1.2 (for my macbook pro, no idea how to generalize this) + local centerX = (minX + maxX) / + 2 -- - dx*0.12 -- offset is to move it a bit up, so the cards don't block anything + local centerZ = (minZ + maxZ) / 2 + + local scale = dx + if dz > dx then + scale = dz + end + + -- regression line from the following data points, seems linear + -- rows 1 scale 4.5 d 12 + -- rows 2 scale 11 d 16 + -- rows 3 scale 14.5 d 19.6 + -- rows 4 scale 19.6 d 25 + -- rows 5 scale 23.25 d 28 + -- rows 6 scale 30.8 d 34 + + -- local d = 0.8685 * scale + 7.4505 + + -- modified by testing + -- local d = 0.8685 * scale + 5 + -- local d = 1.04 * scale + 5 + local d = 0.96 * scale + 5 + + player.lookAt({ position = { centerX, 0, centerZ }, pitch = 74, yaw = 90, distance = d }) + else + player.lookAt({ position = { -30.667, 0, 0 }, pitch = 74, yaw = 90, distance = 32 }) + end + elseif index >= 3 and index <= 6 then + local newMatIndex = index - 2 -- mat index 1 - 4 + local newMatColor = getPlayerColorForIndex(newMatIndex) + + if newMatColor ~= nil then + local playerCount = getPlayerCount() + + if playerCount <= 1 or playermatData[playerIndex].claims[newMatIndex] then + player.changeColor(newMatColor) + end + end + + if cameraParams[newMatIndex][index].distance <= 0.0 then + local matObjects = Physics.cast({ + origin = playermatData[newMatIndex].origin, + direction = { x = 0, y = 1, z = 0 }, + type = 3, + size = playermatData[newMatIndex].scale, + orientation = playermatData[newMatIndex].orientation + }) + + local minX = playermatData[newMatIndex].minX + local maxX = playermatData[newMatIndex].maxX + local minZ = playermatData[newMatIndex].minZ + local maxZ = playermatData[newMatIndex].maxZ + + for i, v in pairs(matObjects) do + local obj = v.hit_object + + if obj.type == 'Card' or obj.type == 'Infinite' then + local bounds = obj.getBounds() + + local x1 = bounds['center'][1] - bounds['size'][1] / 2 + local x2 = bounds['center'][1] + bounds['size'][1] / 2 + local z1 = bounds['center'][3] - bounds['size'][3] / 2 + local z2 = bounds['center'][3] + bounds['size'][3] / 2 + + if x1 < minX then + minX = x1 + end + if x2 > maxX then + maxX = x2 + end + if z1 < minZ then + minZ = z1 + end + if z2 > maxZ then + maxZ = z2 + end + end + end + + local dx + local dz + local centerX + local centerZ + local scale + local yaw + local d + + -- White/Orange + if index > 3 and index < 6 then + dx = maxX - minX + dz = (maxZ - minZ) / 1.6 -- screen ratio * 1.2 (for my macbook pro, no idea how to generalize this) + + -- offset is to move it a bit up, so the cards don't block anything + centerX = (minX + maxX) / 2 - dx * playermatData[newMatIndex].xOffset + + -- offset is to move it right a bit, so the toolbar doesn't block anything + centerZ = (minZ + maxZ) / 2 + dz * playermatData[newMatIndex].zOffset + yaw = 90 + + scale = dx + if dz > dx then + scale = dz + end + + d = 0.64 * scale + 7 + else -- Green/Red + dx = (maxX - minX) / 1.6 -- screen ratio * 1.2 (for my macbook pro, no idea how to generalize this) + dz = maxZ - minZ + + centerX = (minX + maxX) / 2 + dx * playermatData[newMatIndex].zOffset + centerZ = (minZ + maxZ) / 2 - dz * playermatData[newMatIndex].xOffset + yaw = playermatData[newMatIndex].orientation.y + 180 + + scale = dz + if dx > dz then + scale = dx + end + + d = 0.64 * scale + 7 + end + + -- 15.46 -> 17.081 + -- 18.88 -> 19.33 + -- 24.34 -> 22.6 + + -- need to wait if the player color changed + Wait.frames(function() + player.lookAt({ position = { centerX, 0, centerZ }, pitch = 75.823, yaw = yaw, distance = d }) + end, 2) + else + Wait.frames(function() + player.lookAt(cameraParams[newMatIndex][index]) + end, 2) + end + else + player.lookAt(cameraParams[playerIndex][index]) + end +end + +function beginSetCamera(object, color) + if getPlayerCount() == 0 then + return + elseif getIndexForPlayerColor(color) < 0 then + return + end + + editing = true + resetOverlay() +end + +function updateEditCamera(params) + editPos = params[1] + editPitch = params[2] + editYaw = params[3] + editDistance = params[4] +end + +function beginClaimColor(object, color) + if getPlayerCount() == 0 then + return + elseif getIndexForPlayerColor(color) < 0 then + return + end + + claiming = true + resetOverlay() +end + +function resetClaimColors(object, color) + if getPlayerCount() == 0 then + return + elseif getIndexForPlayerColor(color) < 0 then + return + end + + for c1 = 1, 4 do + for c2 = 1, 4 do + if c1 == c2 then + playermatData[c1].claims[c2] = true + else + playermatData[c1].claims[c2] = false + end + end + end +end + +function getPlayerCount() + local playerCount = 0 + local playerColors = {} + + for i = 1, 4 do + local guid = playermatData[i].guid + local mat = getObjectFromGUID(guid) + local color = mat.getVar('playerColor') + playerColors[i] = color + end + + local playerList = getSeatedPlayers() + + for i, v in ipairs(playerList) do + for ii, vv in ipairs(playerColors) do + if v == vv then + playerCount = playerCount + 1 + end + end + end + + return playerCount +end + +function getPlayerColorForIndex(index) + if index < 0 or index > 4 then + return nil + end + + local guid = playermatData[index]['guid'] + + if guid ~= nil then + local mat = getObjectFromGUID(guid) + return mat.getVar("playerColor") + end + + return nil +end + +function getIndexForPlayerColor(color) + for i = 1, 4 do + local mat = getObjectFromGUID(playermatData[i].guid) + if mat ~= nil then + if mat.getVar('playerColor') == color then + return i + end + end + end + + return -1 +end