-- Bundled by luabundle {"version":"1.6.0"}
local __bundle_require, __bundle_loaded, __bundle_register, __bundle_modules = (function(superRequire)
	local loadingPlaceholder = {[{}] = true}

	local register
	local modules = {}

	local require
	local loaded = {}

	register = function(name, body)
		if not modules[name] then
			modules[name] = body
		end
	end

	require = function(name)
		local loadedModule = loaded[name]

		if loadedModule then
			if loadedModule == loadingPlaceholder then
				return nil
			end
		else
			if not modules[name] then
				if not superRequire then
					local identifier = type(name) == 'string' and '\"' .. name .. '\"' or tostring(name)
					error('Tried to require ' .. identifier .. ', but no such module has been registered')
				else
					return superRequire(name)
				end
			end

			loaded[name] = loadingPlaceholder
			loadedModule = modules[name](require, loaded, register, modules)
			loaded[name] = loadedModule
		end

		return loadedModule
	end

	return require, loaded, register, modules
end)(nil)
__bundle_register("__root", function(require, _LOADED, __bundle_register, __bundle_modules)
require("util/TokenSpawner")
end)
__bundle_register("util/TokenSpawner", function(require, _LOADED, __bundle_register, __bundle_modules)
---
--- Generated by EmmyLua(https://github.com/EmmyLua)
--- Created by Whimsical.
--- DateTime: 2021-01-14 1:10 a.m.
---
local TILE_TYPE_CIRCLE = 2

local HEIGHT_ADJUSTMENT = 1.0

local VALID_INDEX = {false, false, false, true, true, true, true, true, true}

local INDEX_DAMAGE = 4
local INDEX_PATH = 5
local INDEX_HORROR = 6
local INDEX_CLUE = 8
local INDEX_DOOM = 7
local INDEX_RESOURCE = 9

local TOKEN_CLUE = "http://cloud-3.steamusercontent.com/ugc/1758068501357164917/1D06F1DC4D6888B6F57124BD2AFE20D0B0DA15A8/"
local TOKEN_DOOM = "https://i.imgur.com/EoL7yaZ.png"
local TOKEN_RESOURCE = "http://cloud-3.steamusercontent.com/ugc/1758068501357192910/11DDDC7EF621320962FDCF3AE3211D5EDC3D1573/"

local CLOOM_SCALE = Vector(0.25, 1, 0.25)
local RESOURCE_SCALE = Vector(0.17, 0.17, 0.17)
local PATH_SCALE = Vector(1,1,1)

local DAMAGE_JSON = "{\"GUID\":\"142b55\",\"Name\":\"Custom_Token\",\"Transform\":{\"posX\":-38.6177826,\"posY\":1.688475,\"posZ\":10.7887154,\"rotX\":359.9204,\"rotY\":270.009583,\"rotZ\":0.0172974449,\"scaleX\":0.25,\"scaleY\":1,\"scaleZ\":0.25},\"Nickname\":\"Damage\",\"Description\":\"\",\"GMNotes\":\"\",\"ColorDiffuse\":{\"r\":1,\"g\":1,\"b\":1},\"LayoutGroupSortIndex\":0,\"Locked\":false,\"Grid\":false,\"Snap\":false,\"IgnoreFoW\":false,\"MeasureMovement\":false,\"DragSelectable\":true,\"Autoraise\":true,\"Sticky\":true,\"Tooltip\":true,\"GridProjection\":false,\"HideWhenFaceDown\":false,\"Hands\":false,\"CustomImage\":{\"ImageURL\":\"http://cloud-3.steamusercontent.com/ugc/1758068501357115146/903D11AAE7BD5C254C8DC136E9202EE516289DEA/\",\"ImageSecondaryURL\":\"\",\"ImageScalar\":1,\"WidthScale\":0,\"CustomToken\":{\"Thickness\":0.1,\"MergeDistancePixels\":5,\"StandUp\":false,\"Stackable\":false}},\"LuaScript\":\"\",\"LuaScriptState\":\"\",\"XmlUI\":\"\",\"States\":{\"2\":{\"GUID\":\"c6ddbe\",\"Name\":\"Custom_Token\",\"Transform\":{\"posX\":-28.3444748,\"posY\":1.112169,\"posZ\":19.0119534,\"rotX\":0.000318417122,\"rotY\":270.007721,\"rotZ\":359.99176,\"scaleX\":0.25,\"scaleY\":1,\"scaleZ\":0.25},\"Nickname\":\"Damage\",\"Description\":\"\",\"GMNotes\":\"\",\"ColorDiffuse\":{\"r\":1,\"g\":1,\"b\":1},\"LayoutGroupSortIndex\":0,\"Locked\":false,\"Grid\":false,\"Snap\":false,\"IgnoreFoW\":false,\"MeasureMovement\":false,\"DragSelectable\":true,\"Autoraise\":true,\"Sticky\":true,\"Tooltip\":true,\"GridProjection\":false,\"HideWhenFaceDown\":false,\"Hands\":false,\"CustomImage\":{\"ImageURL\":\"http://cloud-3.steamusercontent.com/ugc/1758068501357113699/2929CC7461A8A6C464203FF768A7A5A22650E337/\",\"ImageSecondaryURL\":\"\",\"ImageScalar\":1,\"WidthScale\":0,\"CustomToken\":{\"Thickness\":0.1,\"MergeDistancePixels\":5,\"StandUp\":false,\"Stackable\":false}},\"LuaScript\":\"\",\"LuaScriptState\":\"\",\"XmlUI\":\"\"},\"3\":{\"GUID\":\"a0f2a0\",\"Name\":\"Custom_Token\",\"Transform\":{\"posX\":-28.3444748,\"posY\":1.11216891,\"posZ\":19.0119534,\"rotX\":0.0003119017,\"rotY\":270.007874,\"rotZ\":359.99173,\"scaleX\":0.25,\"scaleY\":1,\"scaleZ\":0.25},\"Nickname\":\"Damage\",\"Description\":\"\",\"GMNotes\":\"\",\"ColorDiffuse\":{\"r\":1,\"g\":1,\"b\":1},\"LayoutGroupSortIndex\":0,\"Locked\":false,\"Grid\":false,\"Snap\":false,\"IgnoreFoW\":false,\"MeasureMovement\":false,\"DragSelectable\":true,\"Autoraise\":true,\"Sticky\":true,\"Tooltip\":true,\"GridProjection\":false,\"HideWhenFaceDown\":false,\"Hands\":false,\"CustomImage\":{\"ImageURL\":\"http://cloud-3.steamusercontent.com/ugc/1758068501357113055/8A45F27B2838FED09DEFE492C9C40DD82781613A/\",\"ImageSecondaryURL\":\"\",\"ImageScalar\":1,\"WidthScale\":0,\"CustomToken\":{\"Thickness\":0.1,\"MergeDistancePixels\":5,\"StandUp\":false,\"Stackable\":false}},\"LuaScript\":\"\",\"LuaScriptState\":\"\",\"XmlUI\":\"\"},\"4\":{\"GUID\":\"24c940\",\"Name\":\"Custom_Token\",\"Transform\":{\"posX\":-28.3444748,\"posY\":1.11216891,\"posZ\":19.0119534,\"rotX\":0.0003254045,\"rotY\":270.008026,\"rotZ\":359.99173,\"scaleX\":0.25,\"scaleY\":1,\"scaleZ\":0.25},\"Nickname\":\"Damage\",\"Description\":\"\",\"GMNotes\":\"\",\"ColorDiffuse\":{\"r\":1,\"g\":1,\"b\":1},\"LayoutGroupSortIndex\":0,\"Locked\":false,\"Grid\":false,\"Snap\":false,\"IgnoreFoW\":false,\"MeasureMovement\":false,\"DragSelectable\":true,\"Autoraise\":true,\"Sticky\":true,\"Tooltip\":true,\"GridProjection\":false,\"HideWhenFaceDown\":false,\"Hands\":false,\"CustomImage\":{\"ImageURL\":\"http://cloud-3.steamusercontent.com/ugc/1758068501357112812/BCCAAB919EBE76E2B770417B0B06A699E9F4C8D0/\",\"ImageSecondaryURL\":\"\",\"ImageScalar\":1,\"WidthScale\":0,\"CustomToken\":{\"Thickness\":0.1,\"MergeDistancePixels\":5,\"StandUp\":false,\"Stackable\":false}},\"LuaScript\":\"\",\"LuaScriptState\":\"\",\"XmlUI\":\"\"},\"5\":{\"GUID\":\"ec79a1\",\"Name\":\"Custom_Token\",\"Transform\":{\"posX\":-28.3444748,\"posY\":1.11216879,\"posZ\":19.0119534,\"rotX\":0.000309352879,\"rotY\":270.008,\"rotZ\":359.99173,\"scaleX\":0.25,\"scaleY\":1,\"scaleZ\":0.25},\"Nickname\":\"Damage\",\"Description\":\"\",\"GMNotes\":\"\",\"ColorDiffuse\":{\"r\":1,\"g\":1,\"b\":1},\"LayoutGroupSortIndex\":0,\"Locked\":false,\"Grid\":false,\"Snap\":false,\"IgnoreFoW\":false,\"MeasureMovement\":false,\"DragSelectable\":true,\"Autoraise\":true,\"Sticky\":true,\"Tooltip\":true,\"GridProjection\":false,\"HideWhenFaceDown\":false,\"Hands\":false,\"CustomImage\":{\"ImageURL\":\"http://cloud-3.steamusercontent.com/ugc/1758068501357112513/3D68F6F7D7A1B81C2E89AFBC948FD9C4395908F1/\",\"ImageSecondaryURL\":\"\",\"ImageScalar\":1,\"WidthScale\":0,\"CustomToken\":{\"Thickness\":0.1,\"MergeDistancePixels\":5,\"StandUp\":false,\"Stackable\":false}},\"LuaScript\":\"\",\"LuaScriptState\":\"\",\"XmlUI\":\"\"},\"6\":{\"GUID\":\"afe500\",\"Name\":\"Custom_Token\",\"Transform\":{\"posX\":-28.3444729,\"posY\":1.11216879,\"posZ\":19.0119514,\"rotX\":0.00031043886,\"rotY\":270.008423,\"rotZ\":359.99176,\"scaleX\":0.25,\"scaleY\":1,\"scaleZ\":0.25},\"Nickname\":\"Damage\",\"Description\":\"\",\"GMNotes\":\"\",\"ColorDiffuse\":{\"r\":1,\"g\":1,\"b\":1},\"LayoutGroupSortIndex\":0,\"Locked\":false,\"Grid\":false,\"Snap\":false,\"IgnoreFoW\":false,\"MeasureMovement\":false,\"DragSelectable\":true,\"Autoraise\":true,\"Sticky\":true,\"Tooltip\":true,\"GridProjection\":false,\"HideWhenFaceDown\":false,\"Hands\":false,\"CustomImage\":{\"ImageURL\":\"http://cloud-3.steamusercontent.com/ugc/1758068501357112217/E941CBCED5D8D42431FD29A53CE74ECF0FBB4BFB/\",\"ImageSecondaryURL\":\"\",\"ImageScalar\":1,\"WidthScale\":0,\"CustomToken\":{\"Thickness\":0.1,\"MergeDistancePixels\":5,\"StandUp\":false,\"Stackable\":false}},\"LuaScript\":\"\",\"LuaScriptState\":\"\",\"XmlUI\":\"\"},\"7\":{\"GUID\":\"c7cbd1\",\"Name\":\"Custom_Token\",\"Transform\":{\"posX\":-28.3444729,\"posY\":1.11216891,\"posZ\":19.0119514,\"rotX\":0.000295429461,\"rotY\":270.00824,\"rotZ\":359.99176,\"scaleX\":0.25,\"scaleY\":1,\"scaleZ\":0.25},\"Nickname\":\"Damage\",\"Description\":\"\",\"GMNotes\":\"\",\"ColorDiffuse\":{\"r\":1,\"g\":1,\"b\":1},\"LayoutGroupSortIndex\":0,\"Locked\":false,\"Grid\":false,\"Snap\":false,\"IgnoreFoW\":false,\"MeasureMovement\":false,\"DragSelectable\":true,\"Autoraise\":true,\"Sticky\":true,\"Tooltip\":true,\"GridProjection\":false,\"HideWhenFaceDown\":false,\"Hands\":false,\"CustomImage\":{\"ImageURL\":\"http://cloud-3.steamusercontent.com/ugc/1758068501357110928/44F5CF8F9BC4D54D47D450A807560D8A1F2A1769/\",\"ImageSecondaryURL\":\"\",\"ImageScalar\":1,\"WidthScale\":0,\"CustomToken\":{\"Thickness\":0.1,\"MergeDistancePixels\":5,\"StandUp\":false,\"Stackable\":false}},\"LuaScript\":\"\",\"LuaScriptState\":\"\",\"XmlUI\":\"\"},\"8\":{\"GUID\":\"67b357\",\"Name\":\"Custom_Token\",\"Transform\":{\"posX\":-28.3444729,\"posY\":1.11216891,\"posZ\":19.01195,\"rotX\":0.000306701084,\"rotY\":270.0082,\"rotZ\":359.99173,\"scaleX\":0.25,\"scaleY\":1,\"scaleZ\":0.25},\"Nickname\":\"Damage\",\"Description\":\"\",\"GMNotes\":\"\",\"ColorDiffuse\":{\"r\":1,\"g\":1,\"b\":1},\"LayoutGroupSortIndex\":0,\"Locked\":false,\"Grid\":false,\"Snap\":false,\"IgnoreFoW\":false,\"MeasureMovement\":false,\"DragSelectable\":true,\"Autoraise\":true,\"Sticky\":true,\"Tooltip\":true,\"GridProjection\":false,\"HideWhenFaceDown\":false,\"Hands\":false,\"CustomImage\":{\"ImageURL\":\"http://cloud-3.steamusercontent.com/ugc/1758068501357110576/7222C0B6E628D08F828F1FA686EB65E0B83B3B54/\",\"ImageSecondaryURL\":\"\",\"ImageScalar\":1,\"WidthScale\":0,\"CustomToken\":{\"Thickness\":0.1,\"MergeDistancePixels\":5,\"StandUp\":false,\"Stackable\":false}},\"LuaScript\":\"\",\"LuaScriptState\":\"\",\"XmlUI\":\"\"},\"9\":{\"GUID\":\"582a00\",\"Name\":\"Custom_Token\",\"Transform\":{\"posX\":-28.2681675,\"posY\":1.21000624,\"posZ\":14.044548,\"rotX\":-0.0000358944635,\"rotY\":270.006958,\"rotZ\":-0.00000148946117,\"scaleX\":0.25,\"scaleY\":1,\"scaleZ\":0.25},\"Nickname\":\"Damage\",\"Description\":\"\",\"GMNotes\":\"\",\"ColorDiffuse\":{\"r\":1,\"g\":1,\"b\":1},\"LayoutGroupSortIndex\":0,\"Locked\":false,\"Grid\":false,\"Snap\":false,\"IgnoreFoW\":false,\"MeasureMovement\":false,\"DragSelectable\":true,\"Autoraise\":true,\"Sticky\":true,\"Tooltip\":true,\"GridProjection\":false,\"HideWhenFaceDown\":false,\"Hands\":false,\"CustomImage\":{\"ImageURL\":\"http://cloud-3.steamusercontent.com/ugc/1758068501357114084/33093C666B9F4530D64B0117605494D5D17B38CC/\",\"ImageSecondaryURL\":\"\",\"ImageScalar\":1,\"WidthScale\":0,\"CustomToken\":{\"Thickness\":0.1,\"MergeDistancePixels\":5,\"StandUp\":false,\"Stackable\":false}},\"LuaScript\":\"\",\"LuaScriptState\":\"\",\"XmlUI\":\"\"}}}"
local HORROR_JSON = "{\"GUID\":\"36be72\",\"Name\":\"Custom_Token\",\"Transform\":{\"posX\":-44.08369,\"posY\":1.69583237,\"posZ\":9.886347,\"rotX\":359.9201,\"rotY\":270.008972,\"rotZ\":0.0168560985,\"scaleX\":0.25,\"scaleY\":1,\"scaleZ\":0.25},\"Nickname\":\"Horror\",\"Description\":\"\",\"GMNotes\":\"\",\"ColorDiffuse\":{\"r\":1,\"g\":1,\"b\":1},\"LayoutGroupSortIndex\":0,\"Locked\":false,\"Grid\":false,\"Snap\":false,\"IgnoreFoW\":false,\"MeasureMovement\":false,\"DragSelectable\":true,\"Autoraise\":true,\"Sticky\":true,\"Tooltip\":true,\"GridProjection\":false,\"HideWhenFaceDown\":false,\"Hands\":false,\"CustomImage\":{\"ImageURL\":\"http://cloud-3.steamusercontent.com/ugc/1758068501357163535/6D9E0756503664D65BDB384656AC6D4BD713F5FC/\",\"ImageSecondaryURL\":\"\",\"ImageScalar\":1,\"WidthScale\":0,\"CustomToken\":{\"Thickness\":0.1,\"MergeDistancePixels\":5,\"StandUp\":false,\"Stackable\":false}},\"LuaScript\":\"\",\"LuaScriptState\":\"\",\"XmlUI\":\"\",\"States\":{\"2\":{\"GUID\":\"5c2361\",\"Name\":\"Custom_Token\",\"Transform\":{\"posX\":-27.7533741,\"posY\":1.210006,\"posZ\":15.9442654,\"rotX\":-0.0000202706469,\"rotY\":270.015259,\"rotZ\":0.0000220759175,\"scaleX\":0.25,\"scaleY\":1,\"scaleZ\":0.25},\"Nickname\":\"Horror\",\"Description\":\"\",\"GMNotes\":\"\",\"ColorDiffuse\":{\"r\":1,\"g\":1,\"b\":1},\"LayoutGroupSortIndex\":0,\"Locked\":false,\"Grid\":false,\"Snap\":false,\"IgnoreFoW\":false,\"MeasureMovement\":false,\"DragSelectable\":true,\"Autoraise\":true,\"Sticky\":true,\"Tooltip\":true,\"GridProjection\":false,\"HideWhenFaceDown\":false,\"Hands\":false,\"CustomImage\":{\"ImageURL\":\"http://cloud-3.steamusercontent.com/ugc/1758068501357163230/ED46F8BBAEDB4D3C96C654D48C56110D35F3F54F/\",\"ImageSecondaryURL\":\"\",\"ImageScalar\":1,\"WidthScale\":0,\"CustomToken\":{\"Thickness\":0.1,\"MergeDistancePixels\":5,\"StandUp\":false,\"Stackable\":false}},\"LuaScript\":\"\",\"LuaScriptState\":\"\",\"XmlUI\":\"\"},\"3\":{\"GUID\":\"3a3415\",\"Name\":\"Custom_Token\",\"Transform\":{\"posX\":-27.7533741,\"posY\":1.210006,\"posZ\":15.9442368,\"rotX\":-0.0000104253941,\"rotY\":270.015137,\"rotZ\":0.0000102804506,\"scaleX\":0.25,\"scaleY\":1,\"scaleZ\":0.25},\"Nickname\":\"Horror\",\"Description\":\"\",\"GMNotes\":\"\",\"ColorDiffuse\":{\"r\":1,\"g\":1,\"b\":1},\"LayoutGroupSortIndex\":0,\"Locked\":false,\"Grid\":false,\"Snap\":false,\"IgnoreFoW\":false,\"MeasureMovement\":false,\"DragSelectable\":true,\"Autoraise\":true,\"Sticky\":true,\"Tooltip\":true,\"GridProjection\":false,\"HideWhenFaceDown\":false,\"Hands\":false,\"CustomImage\":{\"ImageURL\":\"http://cloud-3.steamusercontent.com/ugc/1758068501357162977/E5D453CC14394519E004B4F8703FC425A7AE3D6C/\",\"ImageSecondaryURL\":\"\",\"ImageScalar\":1,\"WidthScale\":0,\"CustomToken\":{\"Thickness\":0.1,\"MergeDistancePixels\":5,\"StandUp\":false,\"Stackable\":false}},\"LuaScript\":\"\",\"LuaScriptState\":\"\",\"XmlUI\":\"\"},\"4\":{\"GUID\":\"4a91a8\",\"Name\":\"Custom_Token\",\"Transform\":{\"posX\":-27.7533741,\"posY\":1.21000612,\"posZ\":15.9442348,\"rotX\":0.00000189065361,\"rotY\":270.01532,\"rotZ\":0.0000159575811,\"scaleX\":0.25,\"scaleY\":1,\"scaleZ\":0.25},\"Nickname\":\"Horror\",\"Description\":\"\",\"GMNotes\":\"\",\"ColorDiffuse\":{\"r\":1,\"g\":1,\"b\":1},\"LayoutGroupSortIndex\":0,\"Locked\":false,\"Grid\":false,\"Snap\":false,\"IgnoreFoW\":false,\"MeasureMovement\":false,\"DragSelectable\":true,\"Autoraise\":true,\"Sticky\":true,\"Tooltip\":true,\"GridProjection\":false,\"HideWhenFaceDown\":false,\"Hands\":false,\"CustomImage\":{\"ImageURL\":\"http://cloud-3.steamusercontent.com/ugc/1758068501357164483/5E22FEAE253AE65BDE3FA09E4EE7133569F7E194/\",\"ImageSecondaryURL\":\"\",\"ImageScalar\":1,\"WidthScale\":0,\"CustomToken\":{\"Thickness\":0.1,\"MergeDistancePixels\":5,\"StandUp\":false,\"Stackable\":false}},\"LuaScript\":\"\",\"LuaScriptState\":\"\",\"XmlUI\":\"\"},\"5\":{\"GUID\":\"887aae\",\"Name\":\"Custom_Token\",\"Transform\":{\"posX\":-27.7533741,\"posY\":1.21000612,\"posZ\":15.9442024,\"rotX\":-0.00003432232,\"rotY\":270.016,\"rotZ\":-0.00000373151761,\"scaleX\":0.25,\"scaleY\":1,\"scaleZ\":0.25},\"Nickname\":\"Horror\",\"Description\":\"\",\"GMNotes\":\"\",\"ColorDiffuse\":{\"r\":1,\"g\":1,\"b\":1},\"LayoutGroupSortIndex\":0,\"Locked\":false,\"Grid\":false,\"Snap\":false,\"IgnoreFoW\":false,\"MeasureMovement\":false,\"DragSelectable\":true,\"Autoraise\":true,\"Sticky\":true,\"Tooltip\":true,\"GridProjection\":false,\"HideWhenFaceDown\":false,\"Hands\":false,\"CustomImage\":{\"ImageURL\":\"http://cloud-3.steamusercontent.com/ugc/1758068501357164251/34DC7172A2B433047DA853796DB52AECE019F99F/\",\"ImageSecondaryURL\":\"\",\"ImageScalar\":1,\"WidthScale\":0,\"CustomToken\":{\"Thickness\":0.1,\"MergeDistancePixels\":5,\"StandUp\":false,\"Stackable\":false}},\"LuaScript\":\"\",\"LuaScriptState\":\"\",\"XmlUI\":\"\"},\"6\":{\"GUID\":\"baa831\",\"Name\":\"Custom_Token\",\"Transform\":{\"posX\":-27.7533741,\"posY\":1.21000624,\"posZ\":15.94415,\"rotX\":-0.0000249414188,\"rotY\":270.0157,\"rotZ\":0.00000292043842,\"scaleX\":0.25,\"scaleY\":1,\"scaleZ\":0.25},\"Nickname\":\"Horror\",\"Description\":\"\",\"GMNotes\":\"\",\"ColorDiffuse\":{\"r\":1,\"g\":1,\"b\":1},\"LayoutGroupSortIndex\":0,\"Locked\":false,\"Grid\":false,\"Snap\":false,\"IgnoreFoW\":false,\"MeasureMovement\":false,\"DragSelectable\":true,\"Autoraise\":true,\"Sticky\":true,\"Tooltip\":true,\"GridProjection\":false,\"HideWhenFaceDown\":false,\"Hands\":false,\"CustomImage\":{\"ImageURL\":\"http://cloud-3.steamusercontent.com/ugc/1758068501357164030/0A12FD352F28A560EA7E7952D8CA618A5245F1E0/\",\"ImageSecondaryURL\":\"\",\"ImageScalar\":1,\"WidthScale\":0,\"CustomToken\":{\"Thickness\":0.1,\"MergeDistancePixels\":5,\"StandUp\":false,\"Stackable\":false}},\"LuaScript\":\"\",\"LuaScriptState\":\"\",\"XmlUI\":\"\"},\"7\":{\"GUID\":\"da94da\",\"Name\":\"Custom_Token\",\"Transform\":{\"posX\":-27.7533741,\"posY\":1.21000612,\"posZ\":15.944108,\"rotX\":-0.0000233948358,\"rotY\":270.015656,\"rotZ\":0.00000218774017,\"scaleX\":0.25,\"scaleY\":1,\"scaleZ\":0.25},\"Nickname\":\"Horror\",\"Description\":\"\",\"GMNotes\":\"\",\"ColorDiffuse\":{\"r\":1,\"g\":1,\"b\":1},\"LayoutGroupSortIndex\":0,\"Locked\":false,\"Grid\":false,\"Snap\":false,\"IgnoreFoW\":false,\"MeasureMovement\":false,\"DragSelectable\":true,\"Autoraise\":true,\"Sticky\":true,\"Tooltip\":true,\"GridProjection\":false,\"HideWhenFaceDown\":false,\"Hands\":false,\"CustomImage\":{\"ImageURL\":\"http://cloud-3.steamusercontent.com/ugc/1758068501357114485/8B2B8A9F61CC2D8C1F10977ABDB4BA2423AD143F/\",\"ImageSecondaryURL\":\"\",\"ImageScalar\":1,\"WidthScale\":0,\"CustomToken\":{\"Thickness\":0.1,\"MergeDistancePixels\":5,\"StandUp\":false,\"Stackable\":false}},\"LuaScript\":\"\",\"LuaScriptState\":\"\",\"XmlUI\":\"\"},\"8\":{\"GUID\":\"2e1687\",\"Name\":\"Custom_Token\",\"Transform\":{\"posX\":-27.753376,\"posY\":1.210006,\"posZ\":15.9440966,\"rotX\":-1.57902083e-8,\"rotY\":270.016541,\"rotZ\":-0.0000219759459,\"scaleX\":0.25,\"scaleY\":1,\"scaleZ\":0.25},\"Nickname\":\"Horror\",\"Description\":\"\",\"GMNotes\":\"\",\"ColorDiffuse\":{\"r\":1,\"g\":1,\"b\":1},\"LayoutGroupSortIndex\":0,\"Locked\":false,\"Grid\":false,\"Snap\":false,\"IgnoreFoW\":false,\"MeasureMovement\":false,\"DragSelectable\":true,\"Autoraise\":true,\"Sticky\":true,\"Tooltip\":true,\"GridProjection\":false,\"HideWhenFaceDown\":false,\"Hands\":false,\"CustomImage\":{\"ImageURL\":\"http://cloud-3.steamusercontent.com/ugc/1758068501357163806/F397C22A8DDB8F22E08E42E6449C3B5D8CFDB313/\",\"ImageSecondaryURL\":\"\",\"ImageScalar\":1,\"WidthScale\":0,\"CustomToken\":{\"Thickness\":0.1,\"MergeDistancePixels\":5,\"StandUp\":false,\"Stackable\":false}},\"LuaScript\":\"\",\"LuaScriptState\":\"\",\"XmlUI\":\"\"},\"9\":{\"GUID\":\"a6f1e0\",\"Name\":\"Custom_Token\",\"Transform\":{\"posX\":-27.753376,\"posY\":1.21000612,\"posZ\":15.9440622,\"rotX\":-0.0000209277514,\"rotY\":270.016724,\"rotZ\":0.00004970206,\"scaleX\":0.25,\"scaleY\":1,\"scaleZ\":0.25},\"Nickname\":\"Horror\",\"Description\":\"\",\"GMNotes\":\"\",\"ColorDiffuse\":{\"r\":1,\"g\":1,\"b\":1},\"LayoutGroupSortIndex\":0,\"Locked\":false,\"Grid\":false,\"Snap\":false,\"IgnoreFoW\":false,\"MeasureMovement\":false,\"DragSelectable\":true,\"Autoraise\":true,\"Sticky\":true,\"Tooltip\":true,\"GridProjection\":false,\"HideWhenFaceDown\":false,\"Hands\":false,\"CustomImage\":{\"ImageURL\":\"http://cloud-3.steamusercontent.com/ugc/1758068501357110165/AD791E6817304851C0ABD7AE97AA60326AC14538/\",\"ImageSecondaryURL\":\"\",\"ImageScalar\":1,\"WidthScale\":0,\"CustomToken\":{\"Thickness\":0.1,\"MergeDistancePixels\":5,\"StandUp\":false,\"Stackable\":false}},\"LuaScript\":\"\",\"LuaScriptState\":\"\",\"XmlUI\":\"\"}}}"
local PATH_JSON = "{\"GUID\": \"7234af\",\"Name\": \"Custom_Tile\",\"Transform\": {\"posX\": -50.92423,\"posY\": 1.63760316,\"posZ\": 11.0779743,\"rotX\": 359.9201,\"rotY\": 270.00946,\"rotZ\": 0.0168931335,\"scaleX\": 1.0,\"scaleY\": 1.0,\"scaleZ\": 1.0},\"Nickname\": \"\",\"Description\": \"\",\"GMNotes\": \"\",\"ColorDiffuse\": {\"r\": 0.6045295,\"g\": 0.6045295,\"b\": 0.6045295},\"LayoutGroupSortIndex\": 0,\"Locked\": false,\"Grid\": true,\"Snap\": true,\"IgnoreFoW\": false,\"MeasureMovement\": false,\"DragSelectable\": true,\"Autoraise\": true,\"Sticky\": true,\"Tooltip\": true,\"GridProjection\": false,\"HideWhenFaceDown\": false,\"Hands\": false,\"CustomImage\": {\"ImageURL\": \"https://i.imgur.com/vppt2my.png\",\"ImageSecondaryURL\": \"https://i.imgur.com/vppt2my.png\",\"ImageScalar\": 1.0,\"WidthScale\": 0.0,\"CustomTile\": {\"Type\": 3,\"Thickness\": 0.1,\"Stackable\": false,\"Stretch\": true}},\"LuaScript\": \"\",\"LuaScriptState\": \"\",\"XmlUI\": \"\",\"States\": {\"2\": {\"GUID\": \"44b0c5\",\"Name\": \"Custom_Tile\",\"Transform\": {\"posX\": -39.7933121,\"posY\": 1.63758957,\"posZ\": 2.038383,\"rotX\": 359.9201,\"rotY\": 269.9961,\"rotZ\": 0.0168742146,\"scaleX\": 1.0,\"scaleY\": 1.0,\"scaleZ\": 1.0},\"Nickname\": \"\",\"Description\": \"\",\"GMNotes\": \"\",\"ColorDiffuse\": {\"r\": 0.6045295,\"g\": 0.6045295,\"b\": 0.6045295},\"LayoutGroupSortIndex\": 0,\"Locked\": false,\"Grid\": true,\"Snap\": true,\"IgnoreFoW\": false,\"MeasureMovement\": false,\"DragSelectable\": true,\"Autoraise\": true,\"Sticky\": true,\"Tooltip\": true,\"GridProjection\": false,\"HideWhenFaceDown\": false,\"Hands\": false,\"CustomImage\": {\"ImageURL\": \"https://i.imgur.com/HyfE8m8.png\",\"ImageSecondaryURL\": \"https://i.imgur.com/HyfE8m8.png\",\"ImageScalar\": 1.0,\"WidthScale\": 0.0,\"CustomTile\": {\"Type\": 3,\"Thickness\": 0.1,\"Stackable\": false,\"Stretch\": true}},\"LuaScript\": \"\",\"LuaScriptState\": \"\",\"XmlUI\": \"\"},\"3\": {\"GUID\": \"5b38c6\",\"Name\": \"Custom_Tile\",\"Transform\": {\"posX\": -38.8217163,\"posY\": 1.99356019,\"posZ\": 0.4159239,\"rotX\": 359.9201,\"rotY\": 272.9828,\"rotZ\": 0.01687373,\"scaleX\": 0.8,\"scaleY\": 1.0,\"scaleZ\": 0.8},\"Nickname\": \"\",\"Description\": \"\",\"GMNotes\": \"\",\"ColorDiffuse\": {\"r\": 0.6045295,\"g\": 0.6045295,\"b\": 0.6045295},\"LayoutGroupSortIndex\": 0,\"Locked\": false,\"Grid\": true,\"Snap\": true,\"IgnoreFoW\": false,\"MeasureMovement\": false,\"DragSelectable\": true,\"Autoraise\": true,\"Sticky\": true,\"Tooltip\": true,\"GridProjection\": false,\"HideWhenFaceDown\": false,\"Hands\": false,\"CustomImage\": {\"ImageURL\": \"https://i.imgur.com/dHKBLoD.png\",\"ImageSecondaryURL\": \"https://i.imgur.com/HyfE8m8.png\",\"ImageScalar\": 1.0,\"WidthScale\": 0.0,\"CustomTile\": {\"Type\": 3,\"Thickness\": 0.1,\"Stackable\": false,\"Stretch\": true}},\"LuaScript\": \"\",\"LuaScriptState\": \"\",\"XmlUI\": \"\"}}}"

local OBJECT_JSON = {}
OBJECT_JSON[INDEX_DAMAGE] = DAMAGE_JSON
OBJECT_JSON[INDEX_HORROR] = HORROR_JSON
OBJECT_JSON[INDEX_PATH] = PATH_JSON


---@param index number
---@param player_color string
function onScriptingButtonDown(index, player_color)
    if not VALID_INDEX[index] then return end
    local isResource = index==INDEX_RESOURCE
    ---@type Player
    local player = Player[player_color]
    local rotation = player:getPointerRotation()
    local position = player:getPointerPosition()
    position.y = position.y + HEIGHT_ADJUSTMENT

    ---@type SpawnObjectParams
    local parameters = {
        snap_to_grid = false,
        position = position,
        rotation = Vector(0, rotation, index==INDEX_DOOM and 180 or 0),
        scale = isResource and RESOURCE_SCALE or (index==INDEX_PATH and PATH_SCALE or CLOOM_SCALE),
        type = isResource and "Custom_Token" or "Custom_Tile",
        sound = false,
        ---@param thing TTSObject
        callback_function = function (thing)
            thing.use_snap_points = false
        end
    }

    if index<=INDEX_HORROR then
        ---@type SpawnObjectParamsJSON
        parameters = parameters
        parameters.json = OBJECT_JSON[index]
        spawnObjectJSON(parameters)
    else
        local object = spawnObject(parameters)
        if index==INDEX_RESOURCE then makeResource(object) else makeCloom(object) end
    end
end

---@param object TTSObject
function makeCloom(object)
    object:setCustomObject {
        type = TILE_TYPE_CIRCLE,
        image = TOKEN_CLUE,
        image_bottom = TOKEN_DOOM,
        stackable = true,
        thickness = 0.1
    }
end

---@param object TTSObject
function makeResource(object)
    object:setCustomObject {
        image = TOKEN_RESOURCE,
        thickness = 0.3,
        merge_distance = 5,
        stackable = true
    }
end
end)
return __bundle_require("__root")