type Vec2
{
	f32 x
	f32 y
}

type Vec3
{
	f32 x
	f32 y
	f32 z
}

type Vec4
{
	f32 x
	f32 y
	f32 z
	f32 w
}

type Mat3
{
	f32 M Arr(9) Default("{
	1.0f, 0.0f, 0.0f,
	0.0f, 1.0f, 0.0f,
	0.0f, 0.0f, 1.0f
	}")
}

type Mat4
{
	f32 M Arr(16) Default("{
	1.0f, 0.0f, 0.0f, 0.0f,
	0.0f, 1.0f, 0.0f, 0.0f,
	0.0f, 0.0f, 1.0f, 0.0f,
	0.0f, 0.0f, 0.0f, 1.0f
	}")
}

type Transform
{
	Mat4 M
	Mat4 MI
	Vec3 Position
	Mat4 Rotation
	Vec3 Scale Default("{1.0f, 1.0f, 1.0f}")
}

type AssetHandle
{
	u32 Idx Default("UINT32_MAX")
}

type ModelHandle
{
	u16 ModelIdx Default("UINT16_MAX")
	AssetHandle Asset
}

type TextureHandle
{
	u16 TextureIdx Default("UINT16_MAX")
	AssetHandle Asset
}

type PuzPos
{
	i8 X
	i8 Y
}

enum PuzzleElementType(u8)
{
	None           GameName("Empty")              ShortName("  ")
	WaterIn        GameName("Water Source")       ShortName("~+")
	WaterGoal      GameName("Water Goal")         ShortName("~!")
	WaterChannel   GameName("Water Channel")      ShortName("~")
	ElectricIn     GameName("Electricity Source") ShortName("e+")
	ElectricGoal   GameName("Electricity Goal")   ShortName("e!")
	Blocked        GameName("Blocked")            ShortName("B")
	Bridge         GameName("Bridge")             ShortName("#")
}

type StaticPuzzleCard
{
	PuzzleElementType Elements     Arr(4)
	ModelHandle       ModelHandle
	TextureHandle     ModelTextureHandle
	TextureHandle     BoardTextureHandle
}

type StaticPuzzleCardHandle
{
	u16 Idx Default("UINT16_MAX")
}

type PuzzleVisualSettings
{
	Vec4 TileBaseColor
	Vec4 TileDotColor
	Vec3 Test
	Vec4 DisabledCardTint
}

type StaticPuzzleData
{
	StaticPuzzleCard Cards Arr(64)
	PuzzleVisualSettings Visuals
}

type PuzzleCardStack
{
	StaticPuzzleCardHandle RefCard
	u8                     MaxAvailableCount
	u8                     UsedCount
}

type PlacedPuzzleCard
{
	StaticPuzzleCardHandle RefCard
	PuzPos                 Position
	u8                     Rotation
	b                      IsLocked
}

type PuzzleData
{
	u16               ID
	str               PuzzleName          Arr(64)
	u8                WidthTiles
	u8                HeightTiles
	u32               AvailableCardCount
	PuzzleCardStack   AvailableCards      Arr(16)
	PlacedPuzzleCard  PlacedCards         Arr(256)
	PuzzleElementType BackgroundTiles     Arr(1024)
	u32               GoalPositionCount
	PuzPos            GoalPositions       Arr(16)
}

enum EMaterial
{
	Default
	UI
}

type SavedEntityRenderData
{
	Vec4 BaseColor
	Vec4 HighlightColor
	Transform TF
	EMaterial Material
	TextureHandle Texture
	ModelHandle Model
	b Visible
}
