var noteTitle = { components: [
	{
		c: TransformComponent,
		d: {
			x: -500,
			y: -200,
			zIndex: 10
		}
	},
	{
		c: PixelTextComponent,
		d: {
			text: "$TMPEarly",
			align: TextAlign.left,
			spacing: -4,
			fontDefinition: {
				layer: LayerDefinitions.LAYER_UI,
				sheet: "ui_fontGreasyStroke",
				scale: 7 / 10,
				tint: 0xe0b86c
			}
		}
	},
	{
		c: TweenerComponent,
		d: {
			component: "PixelTextComponent",
			field: "alpha",
			duration: 1,
			values: [0, 1],
			repeat: false
		}
	},
]};

/**
 * THIS IS REFERENCED FROM A TILED CUSTOM FIELD CALLED "entityDefinition".
 * So, to make a hotspot,
 *  - give your Tiled object a field called "entityDefinition" and set it to "hotspotBase"
 *  - set it's type to "hotspot"
 *
 * HotspotComponent properties like name, category, group and facing, and ColliderComponent propertis are set in TiledEntityCreator
 */
var hotspotBase = { components: [
	{
		c: TransformComponent,
	},
	{
		c: ColliderComponent,
		d: {
			collisionGroup: CollisionCategoryDefinitions.CC_HOTSPOTS,
			collidesWith: [],
			senses: [
				CollisionCategoryDefinitions.CC_CHARACTERS,
				CollisionCategoryDefinitions.CC_PLANNING_TARGET
			]
		}
	},
	{
		c: RigidBodyComponent,
		d: {
			isDynamic: false,
			isSensor: true,
			dynamicFriction: 0,
			density: 0,
		}
	},
	{
		c: HotspotComponent
	},
]};

var hotspotCircuitBase = { extend: hotspotBase, components: [
	{
		c: CircuitComponent,
		d: {
			toggleComponents: ["HotspotComponent","ColliderComponent","RigidBodyComponent"],
		}
	},
]};

/**
 * THIS IS REFERENCED FROM A TILED CUSTOM FIELD CALLED "entityDefinition".
 * So, to make an obstacle,
 *  - give your Tiled object a field called "entityDefinition" and set it to "obstacleBase",
 *  - set it's type to "obstacle"
 *  - set it's width and height to desired collider width and height in meters or draw in tile's Tile Collision Editor
 *
 * This is only part of an obstacle, SpriteComponent is created and ColliderComponent is set up in awkwardly in TiledEntityCreator
 */
var obstacleBase = { components: [
	{
		c: TransformComponent,
	},
	{
		c: ColliderComponent,
		d: {
			collisionGroup: CollisionCategoryDefinitions.CC_DYNAMIC_OBSTACLE,
			collidesWith: [
				CollisionCategoryDefinitions.CC_CHARACTER_CORE,
				CollisionCategoryDefinitions.CC_WALLS,
				CollisionCategoryDefinitions.CC_DOORS
			],
			senses: [
				CollisionCategoryDefinitions.CC_AVOIDANCE,
				CollisionCategoryDefinitions.CC_PLANNING_TARGET
			]
		}
	},
	{
		c: RigidBodyComponent,
		d: {
			isDynamic: true,

		}
	},
	{
		c: HealthComponent,
		d: {
			currentHealth: 1,
			maxHealth: 1,
		}
	},
]};

/**
 * THIS IS REFERENCED FROM A TILED CUSTOM FIELD CALLED "entityDefinition".
 * So, to make an obstacle,
 *  - give your Tiled object a field called "entityDefinition" and set it to "lightObstacleBase",
 *  - set it's type to "obstacle"
 *  - set it's width and height to desired collider width and height in meters or draw in tile's Tile Collision Editor
 *
 * This is only part of an obstacle, SpriteComponent is created and ColliderComponent is set up in awkwardly in TiledEntityCreator
 */
var lightObstacleBase = { components: [
	{
		c: TransformComponent,
	},
	{
		c: ColliderComponent,
		d: {
			collisionGroup: CollisionCategoryDefinitions.CC_LIGHT_DYNAMIC_OBSTACLE,
			collidesWith: [
				CollisionCategoryDefinitions.CC_CHARACTERS,
				CollisionCategoryDefinitions.CC_WALLS,
			],
		}
	},
	{
		c: RigidBodyComponent,
		d: {
			isDynamic: true,
			density: 0.001,

		}
	},
]};

var chestHighLightObstacleBase = { components: [
	{
		c: TransformComponent,
	},
	{
		c: ColliderComponent,
		d: {
			collisionGroup: CollisionCategoryDefinitions.CC_DYNAMIC_OBSTACLE,
			collidesWith: [
				CollisionCategoryDefinitions.CC_CHARACTERS,
				CollisionCategoryDefinitions.CC_WALLS,
				CollisionCategoryDefinitions.CC_STATIC_OBSTACLE,
				CollisionCategoryDefinitions.CC_DYNAMIC_OBSTACLE,
			],
		}
	},
	{
		c: RigidBodyComponent,
		d: {
			isDynamic: true,
			density: 0.01,

		}
	},
]};

var ambientAudio_indoors = { components: [
	{
		c: AudioSourceComponent,
		d: {
			autoPlay: "ambientIndoors",
		}
	},
	{
		c: TransformComponent,
	},
]};

var ambientAudio_outdoors = { components: [
	{
		c: AudioSourceComponent,
		d: {
			autoPlay: "ambientOutdoors",
		}
	},
	{
		c: TransformComponent,
	},
]};

var ambientAudio_arcade = { components: [
	{
		c: AudioSourceComponent,
		d: {
			autoPlay: "ambientArcade",
		}
	},
	{
		c: TransformComponent,
	},
]};

var ambientAudio_docks = { components: [
	{
		c: AudioSourceComponent,
		d: {
			autoPlay: "ambientDocks",
		}
	},
	{
		c: TransformComponent,
	},
]};

var ambientAudio_sewer = { components: [
	{
		c: AudioSourceComponent,
		d: {
			autoPlay: "ambientSewer",
		}
	},
	{
		c: TransformComponent,
	},
]};

var shippingContainerADoors = { components: [
	{
		c: SpriteComponent,
		d: {
			layer: LayerDefinitions.LAYER_OBJECTS,
			sheet: "cars",
			name: "containerAdoors",
			defaultAnimationName: "closed",
		}
	},
	{
		c: TransformComponent
	},
]};

var shippingContainerA = { components: [
	{
		c: SpriteComponent,
		d: {
			layer: LayerDefinitions.LAYER_OVERHEAD,
			sheet: "cars",
			name: "containerA",
	//		tint: 0x1b130f,
		}
	},
	{
		c: TransformComponent
	},
	{
		c: ColliderComponent,
		d: {
			collisionGroup: CollisionCategoryDefinitions.CC_WALLS,
			collidesWith: [CollisionCategoryDefinitions.CC_CHARACTERS,
			CollisionCategoryDefinitions.CC_CHARACTER_CORE,
			CollisionCategoryDefinitions.CC_WALLS, CollisionCategoryDefinitions.CC_DOORS, CollisionCategoryDefinitions.CC_STATIC_OBSTACLE, CollisionCategoryDefinitions.CC_DYNAMIC_OBSTACLE, CollisionCategoryDefinitions.CC_AI_PATH_GENERATION_RAY, CollisionCategoryDefinitions.CC_PLANNING_TARGET, CollisionCategoryDefinitions.CC_HOTSPOTS, CollisionCategoryDefinitions.CC_BULLETS, CollisionCategoryDefinitions.CC_VISION, CollisionCategoryDefinitions.CC_LIGHT_DYNAMIC_OBSTACLE],
			senses: [CollisionCategoryDefinitions.CC_PLANNING_TARGET],
			width: 2.1,
			height: 4.7,
			offsetY: 0
		}
	},
	{
		c: RigidBodyComponent,
		d: {
			isDynamic: false
		}
	},
], children: [
	shippingContainerADoors
]};

var shippingContainerEnterable = { components: [
	{
		c: SpriteComponent,
		d: {
			layer: LayerDefinitions.LAYER_OVERHEAD,
			sheet: "cars",
			name: "containerA",
			alpha: 1,
	//		tint: 0x1b130f,
		}
	},
	{
		c: TransformComponent
	},
	{
		c: ColliderComponent,
		d: {
			collisionGroup: CollisionCategoryDefinitions.CC_WALLS,
			collidesWith: [
		//	CollisionCategoryDefinitions.CC_CHARACTERS,
		//	CollisionCategoryDefinitions.CC_CHARACTER_CORE,
			CollisionCategoryDefinitions.CC_WALLS,
			CollisionCategoryDefinitions.CC_DOORS,
		//	CollisionCategoryDefinitions.CC_STATIC_OBSTACLE,
		//	CollisionCategoryDefinitions.CC_DYNAMIC_OBSTACLE,
		//	CollisionCategoryDefinitions.CC_AI_PATH_GENERATION_RAY,
		//	CollisionCategoryDefinitions.CC_PLANNING_TARGET,
		//	CollisionCategoryDefinitions.CC_HOTSPOTS,
		//	CollisionCategoryDefinitions.CC_BULLETS,
			CollisionCategoryDefinitions.CC_VISION,
		//	CollisionCategoryDefinitions.CC_LIGHT_DYNAMIC_OBSTACLE
			],
			senses: [CollisionCategoryDefinitions.CC_PLANNING_TARGET],
			width: 2.1,
			height: 4.7,
			offsetY: 0
		}
	},
	{
		c: RigidBodyComponent,
		d: {
			isDynamic: false
		}
	},
	{
		c: TweenerComponent,
		d: {
			enabled: true,
			component: "SpriteComponent",
			field: "alpha",
			duration: 0.1,
			values: [1.0, 0.4],
			repeat: false
		}
	},
	{
		c: CircuitComponent,
		d: {
			toggleComponents: ["TweenerComponent"],
			isPowerSource: true,
		}
	},
], children: [
	{ components: [
		{
			c: TransformComponent,
			d: {
				x: 1.05,
				y: 0,
			},
		},
		{
			c: ColliderComponent,
			d: {
				collisionGroup: CollisionCategoryDefinitions.CC_WALLS,
				collidesWith: [
				CollisionCategoryDefinitions.CC_CHARACTERS,
				CollisionCategoryDefinitions.CC_CHARACTER_CORE,
				CollisionCategoryDefinitions.CC_WALLS,
				CollisionCategoryDefinitions.CC_DOORS,
				CollisionCategoryDefinitions.CC_STATIC_OBSTACLE,
				CollisionCategoryDefinitions.CC_DYNAMIC_OBSTACLE,
				CollisionCategoryDefinitions.CC_AI_PATH_GENERATION_RAY,
				CollisionCategoryDefinitions.CC_PLANNING_TARGET,
				CollisionCategoryDefinitions.CC_HOTSPOTS,
				CollisionCategoryDefinitions.CC_BULLETS,
				CollisionCategoryDefinitions.CC_VISION,
				CollisionCategoryDefinitions.CC_LIGHT_DYNAMIC_OBSTACLE
				],
				senses: [CollisionCategoryDefinitions.CC_PLANNING_TARGET],
				width: 0.1,
				height: 4.7,
				offsetY: 0
			}
		},
		{
			c: RigidBodyComponent,
			d: {
				isDynamic: false
			}
		},
	]},
	{ components: [
		{
			c: TransformComponent,
			d: {
				x: -1.05,
				y: 0,
			},
		},
		{
			c: ColliderComponent,
			d: {
				collisionGroup: CollisionCategoryDefinitions.CC_WALLS,
				collidesWith: [
				CollisionCategoryDefinitions.CC_CHARACTERS,
				CollisionCategoryDefinitions.CC_CHARACTER_CORE,
				CollisionCategoryDefinitions.CC_WALLS,
				CollisionCategoryDefinitions.CC_DOORS,
				CollisionCategoryDefinitions.CC_STATIC_OBSTACLE,
				CollisionCategoryDefinitions.CC_DYNAMIC_OBSTACLE,
				CollisionCategoryDefinitions.CC_AI_PATH_GENERATION_RAY,
				CollisionCategoryDefinitions.CC_PLANNING_TARGET,
				CollisionCategoryDefinitions.CC_HOTSPOTS,
				CollisionCategoryDefinitions.CC_BULLETS,
				CollisionCategoryDefinitions.CC_VISION,
				CollisionCategoryDefinitions.CC_LIGHT_DYNAMIC_OBSTACLE
				],
				senses: [CollisionCategoryDefinitions.CC_PLANNING_TARGET],
				width: 0.1,
				height: 4.7,
				offsetY: 0
			}
		},
		{
			c: RigidBodyComponent,
			d: {
				isDynamic: false
			}
		},
	]},
	{ components: [
		{
			c: TransformComponent,
			d: {
				x: 0,
				y: -2.35,
			},
		},
		{
			c: ColliderComponent,
			d: {
				collisionGroup: CollisionCategoryDefinitions.CC_WALLS,
				collidesWith: [
				CollisionCategoryDefinitions.CC_CHARACTERS,
				CollisionCategoryDefinitions.CC_CHARACTER_CORE,
				CollisionCategoryDefinitions.CC_WALLS,
				CollisionCategoryDefinitions.CC_DOORS,
				CollisionCategoryDefinitions.CC_STATIC_OBSTACLE,
				CollisionCategoryDefinitions.CC_DYNAMIC_OBSTACLE,
				CollisionCategoryDefinitions.CC_AI_PATH_GENERATION_RAY,
				CollisionCategoryDefinitions.CC_PLANNING_TARGET,
				CollisionCategoryDefinitions.CC_HOTSPOTS,
				CollisionCategoryDefinitions.CC_BULLETS,
				CollisionCategoryDefinitions.CC_VISION,
				CollisionCategoryDefinitions.CC_LIGHT_DYNAMIC_OBSTACLE
				],
				senses: [CollisionCategoryDefinitions.CC_PLANNING_TARGET],
				width: 2.1,
				height: 0.1,
				offsetY: 0
			}
		},
		{
			c: RigidBodyComponent,
			d: {
				isDynamic: false
			}
		},
	]},
	{ components: [
		{
			c: TransformComponent,
			d: {
				x: 0,
				y: 0,
			},
		},
		{
			c: SpriteComponent,
			d: {
				layer: LayerDefinitions.LAYER_OBJECTS,
				sheet: "cars",
				name: "containerAdoors",
				defaultAnimationName: "openL",
			}
		},
	]},
	{ components: [
		{
			c: TransformComponent,
			d: {
				x: 0,
				y: 0,
			},
		},
		{
			c: SpriteComponent,
			d: {
				layer: LayerDefinitions.LAYER_OBJECTS,
				sheet: "cars",
				name: "containerAdoors",
				defaultAnimationName: "openR",
			}
		},
	]},
]};

var paperObstacleBase = { components: [
	{
		c: TransformComponent,
	},
	{
		c: ColliderComponent,
		d: {
			collisionGroup: CollisionCategoryDefinitions.CC_LIGHT_DYNAMIC_OBSTACLE,
			collidesWith: [
				CollisionCategoryDefinitions.CC_CHARACTERS,
				CollisionCategoryDefinitions.CC_WALLS,
				CollisionCategoryDefinitions.CC_BULLETS
			],
		}
	},
	{
		c: RigidBodyComponent,
		d: {
			isDynamic: true,
			density: 0.001,

		}
	},
	{
		c: HealthComponent,
		d: {
			maxHealth: 0.1,
			currentHealth: 0.1,
			spawnOnDamage: {
				base: ["bulletHitPaper"],
			},
		}
	},
]};

var wall = { components: [
	{
		c: ColliderComponent,
		d: {
			collisionGroup: CollisionCategoryDefinitions.CC_WALLS,
			collidesWith: [
				CollisionCategoryDefinitions.CC_CHARACTER_CORE,
				CollisionCategoryDefinitions.CC_BULLETS,
				CollisionCategoryDefinitions.CC_WALLS,
				CollisionCategoryDefinitions.CC_STATIC_OBSTACLE,
				//CollisionCategoryDefinitions.CC_DOORS,
				CollisionCategoryDefinitions.CC_DYNAMIC_OBSTACLE,
				CollisionCategoryDefinitions.CC_AI_PATH_GENERATION_RAY,
				CollisionCategoryDefinitions.CC_PLANNING_TARGET,
				CollisionCategoryDefinitions.CC_OBJECTS,
				CollisionCategoryDefinitions.CC_LIGHT_DYNAMIC_OBSTACLE,
				CollisionCategoryDefinitions.CC_VISION,
			],
		}
	},
	{
		c: HealthComponent,
		d: {
			currentHealth: 5000,
			maxHealth: 5000,
			minDamage: 3,
			spawnDamageOnCausersPosition: true,
			spawnOnDamage: {
				base: [],
				bullet: ["fxMiss"],
			},
		}
	},
	{
		c: RigidBodyComponent,
		d: {
			isDynamic: false
		}
	},
]};

var wallBlock = { extend: wall, components: [
	{
		c: ColliderComponent,
		d: {
			width: 1,
			height: 1
		}
	},
]};

var lowBlock = { extend: wall, components: [
	{
		c: ColliderComponent,
		d: {
			collisionGroup: CollisionCategoryDefinitions.CC_STATIC_OBSTACLE,
			collidesWith: [
				CollisionCategoryDefinitions.CC_CHARACTER_CORE,
				CollisionCategoryDefinitions.CC_WALLS,
				CollisionCategoryDefinitions.CC_DOORS,
				CollisionCategoryDefinitions.CC_STATIC_OBSTACLE,
				CollisionCategoryDefinitions.CC_DYNAMIC_OBSTACLE,
				CollisionCategoryDefinitions.CC_AI_PATH_GENERATION_RAY,
				CollisionCategoryDefinitions.CC_PLANNING_TARGET
			],
		}
	},
]};

var noBlock = { extend: wall, components: [
	{
		c: ColliderComponent,
		d: {
			collisionGroup: CollisionCategoryDefinitions.CC_STATIC_OBSTACLE,
			collidesWith: [
		//		CollisionCategoryDefinitions.CC_CHARACTER_CORE,
		//		CollisionCategoryDefinitions.CC_WALLS,
		//		CollisionCategoryDefinitions.CC_DOORS,
		//		CollisionCategoryDefinitions.CC_STATIC_OBSTACLE,
				CollisionCategoryDefinitions.CC_DYNAMIC_OBSTACLE,
		//		CollisionCategoryDefinitions.CC_AI_PATH_GENERATION_RAY,
		//		CollisionCategoryDefinitions.CC_PLANNING_TARGET
			],
		}
	},
]};


var flamingBarrel = { components: [
/*
	{
		c: SpriteComponent,
		d: {
			layer: LayerDefinitions.LAYER_OVERHEAD,
			sheet: "fxFlamingBarrel",
			name: "fxFlamingBarrel",
			defaultAnimationName: "default",
			loop: true,
			fps: 30,
		}
	},
*/
	{
		c: TransformComponent,
		d: {
		}
	},
	{
		c: HealthComponent,
		d: {
			currentHealth: 100,
			maxHealth: 100,
		}
	},
/*	{
		c: ActionableComponent,
		d: {
			actionDefinitions: [ActionDefinitions.attack, ActionDefinitions.shoot],
		}
	},
*/
	{
		c: ColliderComponent,
		d: {
			radius: 0.24 * 1,
			collisionGroup: CollisionCategoryDefinitions.CC_DYNAMIC_OBSTACLE,
			collidesWith: [CollisionCategoryDefinitions.CC_CHARACTERS, CollisionCategoryDefinitions.CC_WALLS, CollisionCategoryDefinitions.CC_DOORS, CollisionCategoryDefinitions.CC_BULLETS, CollisionCategoryDefinitions.CC_STATIC_OBSTACLE, CollisionCategoryDefinitions.CC_DYNAMIC_OBSTACLE, CollisionCategoryDefinitions.CC_LIGHT_DYNAMIC_OBSTACLE],
			senses: [CollisionCategoryDefinitions.CC_AVOIDANCE, CollisionCategoryDefinitions.CC_MOUSE, CollisionCategoryDefinitions.CC_HOTSPOTS, CollisionCategoryDefinitions.CC_PLANNING_TARGET, CollisionCategoryDefinitions.CC_DOORS]
		}
	},
	{
		c: FieldOfViewMarkerComponent,
	},
	{
		c: RigidBodyComponent,
		d: {
			isDynamic: true,
			density: 10,

		}
	},
], children: [
	fireGlow
]};


var windowBase = { extend: wall, components: [
	{
		c: HealthComponent,
		d: {
			currentHealth: 1,
			maxHealth: 1,
			minDamage: 0,
			spawnOnDamage: {
				base: [],
			},
			spawnOnZeroHealth: {
				base: ["fxHitWindowADirectional"],
			},
			spawnAsBody: {
				base: ["fxHitWindowA"],
			},
		}
	},
	{
		c: ActionableComponent,
		d: {
			actionDefinitions: [ActionDefinitions.attack, ActionDefinitions.shoot, ActionDefinitions.drill],
		}
	},
	//  wall collider
	{
		c: ColliderComponent,
		d: {
			collisionGroup: CollisionCategoryDefinitions.CC_WALLS,
			collidesWith: [CollisionCategoryDefinitions.CC_CHARACTER_CORE, CollisionCategoryDefinitions.CC_BULLETS, CollisionCategoryDefinitions.CC_WALLS, CollisionCategoryDefinitions.CC_STATIC_OBSTACLE/*, CollisionCategoryDefinitions.CC_DOORS*/, CollisionCategoryDefinitions.CC_DYNAMIC_OBSTACLE, CollisionCategoryDefinitions.CC_AI_PATH_GENERATION_RAY, CollisionCategoryDefinitions.CC_PLANNING_TARGET, CollisionCategoryDefinitions.CC_OBJECTS, CollisionCategoryDefinitions.CC_LIGHT_DYNAMIC_OBSTACLE],
			senses: [CollisionCategoryDefinitions.CC_AVOIDANCE, CollisionCategoryDefinitions.CC_MOUSE, CollisionCategoryDefinitions.CC_HOTSPOTS, CollisionCategoryDefinitions.CC_PLANNING_TARGET, CollisionCategoryDefinitions.CC_DOORS]
		}
	},

	{
		c: FieldOfViewMarkerComponent,
	},
	{
		c: RigidBodyComponent,
		d: {
			isDynamic: false,
			density: 10,

		}
	},
]};

var looseVentilationCover = { extend: lightObstacleBase, components: [
	{
		c: SuspicionIncreaserComponent,
		d:{
			increaseAmount: 0.15,
		}
	},
	{
		c: TransformComponent,
		d: {
		}
	},
	{
		c: AudioSourceComponent,
		d: {
			autoPlay: "bulletHitCar",
		}
	},
	{
		c: SpriteComponent,
		d: {
			layer: LayerDefinitions.LAYER_FLOOR_OBJECTS,
			sheet: "tiles2",
			name: "ventilationCover",
			defaultAnimationName: "loose",
		}
	},
	{
		c: ColliderComponent,
		d: {
			radius: 0.15,
		}
	},
]};

var looseVentilationCoverSpawner = { components: [
	{
		c: TransformComponent,
		d: {
		}
	},
	{
		c: SpawnerComponent,
		d: {
			entityDefinitions: ["looseVentilationCover"],
			spawnDirections: [0, 90],
			total: 1,
			initialImpulse: 0.005,
			spawnsPerRound: 1,
			spawnOrder: SpawnOrder.RANDOM
		}
	},
]};

var ventilationCover = { extend: wall, components: [
	{
		c: HealthComponent,
		d: {
			currentHealth: 3,
			maxHealth: 3,
			minDamage: 0,
			spawnOnDamage: {
				base: ["fxHitElectric"],
			},
			spawnOnZeroHealth: {
				base: ["looseVentilationCoverSpawner"],
			},
			spawnAsBody: {
				base: ["brokenVentilationCover"],
			},
		}
	},
	{
		c: ActionableComponent,
		d: {
			actionDefinitions: [ActionDefinitions.attack, ActionDefinitions.shoot, ActionDefinitions.drill],
		}
	},
	//  wall collider
	{
		c: ColliderComponent,
		d: {
			collisionGroup: CollisionCategoryDefinitions.CC_WALLS,
			collidesWith: [CollisionCategoryDefinitions.CC_CHARACTER_CORE, CollisionCategoryDefinitions.CC_BULLETS, CollisionCategoryDefinitions.CC_WALLS, CollisionCategoryDefinitions.CC_STATIC_OBSTACLE/*, CollisionCategoryDefinitions.CC_DOORS*/, CollisionCategoryDefinitions.CC_DYNAMIC_OBSTACLE, CollisionCategoryDefinitions.CC_AI_PATH_GENERATION_RAY, CollisionCategoryDefinitions.CC_PLANNING_TARGET, CollisionCategoryDefinitions.CC_OBJECTS, CollisionCategoryDefinitions.CC_LIGHT_DYNAMIC_OBSTACLE],
			senses: [CollisionCategoryDefinitions.CC_AVOIDANCE, CollisionCategoryDefinitions.CC_MOUSE, CollisionCategoryDefinitions.CC_HOTSPOTS, CollisionCategoryDefinitions.CC_PLANNING_TARGET, CollisionCategoryDefinitions.CC_DOORS]
		}
	},

	{
		c: FieldOfViewMarkerComponent,
	},
	{
		c: RigidBodyComponent,
		d: {
			isDynamic: false,
			density: 10,

		}
	},
	{
		c: HealthBarComponent,
		d: {
			onlyDrawIfNotFull: true,
		}
	},
]};

var brokenVentilationCover = { components: [
	{
		c: SpriteComponent,
		d: {
			layer: LayerDefinitions.LAYER_FLOOR,
			sheet: "tiles2",
			name: "ventilationCover",
			defaultAnimationName: "broken",
		}
	},
	{
		c: SuspicionIncreaserComponent,
		d:{
			increaseAmount: 0.15,
		}
	},
	{
		c: TransformComponent,
		d: {
		}
	},
	{
		c: AIWaypointComponent,
		d: {
			cost: 5,
			dynamicCost: ActionDefinitions.doNotAllowForNonUserCommanded
		}
	},
	{
		c: AudioSourceComponent,
		d: {
			autoPlay: "bulletHitCar",
		}
	},
]};

var ventilationObstacle = { extend: ventilationCover, components: [
	{
		c: HealthComponent,
		d: {
			currentHealth: 3,
			maxHealth: 3,
			minDamage: 0,
			spawnAsBody: {
				base: ["fxHitElectric"],
			},
		}
	},
]};

var wallBars = { extend: wall, components: [
	{
		c: ColliderComponent,
		d: {
			collisionGroup: CollisionCategoryDefinitions.CC_WALLS,
			collidesWith: [CollisionCategoryDefinitions.CC_CHARACTER_CORE, CollisionCategoryDefinitions.CC_WALLS, CollisionCategoryDefinitions.CC_STATIC_OBSTACLE/*, CollisionCategoryDefinitions.CC_DOORS*/, CollisionCategoryDefinitions.CC_DYNAMIC_OBSTACLE, CollisionCategoryDefinitions.CC_AI_PATH_GENERATION_RAY, CollisionCategoryDefinitions.CC_PLANNING_TARGET, CollisionCategoryDefinitions.CC_OBJECTS, CollisionCategoryDefinitions.CC_LIGHT_DYNAMIC_OBSTACLE],
			senses: [CollisionCategoryDefinitions.CC_AVOIDANCE, CollisionCategoryDefinitions.CC_MOUSE, CollisionCategoryDefinitions.CC_HOTSPOTS, CollisionCategoryDefinitions.CC_PLANNING_TARGET, CollisionCategoryDefinitions.CC_DOORS]
		}
	},
]};

var weakWall = { extend: wall, components: [
	{
		c: HealthComponent,
		d: {
			currentHealth: 10,
			maxHealth: 10,
			minDamage: 2,
			spawnOnZeroHealth: {
				base: ["explosionShrapnelTrail"],
			},
			spawnAsBody: {
				base: ["fxBreakWall"],
			},
		}
	},
	{
		c: FieldOfViewMarkerComponent,
	},
	{
		c: RigidBodyComponent,
		d: {
			isDynamic: false,
			density: 10,

		}
	},
]};

var lampPost = { extend: wall, components: [
	{
		c: ColliderComponent,
		d: {
			collisionGroup: CollisionCategoryDefinitions.CC_STATIC_OBSTACLE,
			collidesWith: [CollisionCategoryDefinitions.CC_CHARACTERS, CollisionCategoryDefinitions.CC_WALLS, CollisionCategoryDefinitions.CC_DOORS, CollisionCategoryDefinitions.CC_STATIC_OBSTACLE, CollisionCategoryDefinitions.CC_DYNAMIC_OBSTACLE, CollisionCategoryDefinitions.CC_AI_PATH_GENERATION_RAY, CollisionCategoryDefinitions.CC_PLANNING_TARGET],
			width: 1 / 3,
			height: 1 / 3,
			offsetY: 1 / 5
		}
	},
]};

var lockedDoorIcon = { components: [
	{
		c: TransformComponent,
		d: {
			scaleX: 0.5,
			scaleY: 0.5,
		}
	},
	{
		c: SpriteComponent,
		d: {
			layer: LayerDefinitions.LAYER_IN_GAME_UI,
			sheet: "ingame-ui",
			name: "ui-base-bg-circle",
			alpha: 0.85,
			tint: 0x8d8985,
		}
	},
], children: [
	{ components: [
		{
			c: TransformComponent,
			d: {
				//scaleX: 0.5,
				//scaleY: 0.5,
			}
		},
		{
			c: SpriteComponent,
			d: {
				layer: LayerDefinitions.LAYER_IN_GAME_UI,
				sheet: "ingame-ui",
				name: "ui-base-icon-lock-closed",
			}
		},
	]}
]};

/**
 * THIS IS REFERENCED FROM A TILED CUSTOM FIELD CALLED "entityDefinition".
 * So, to make a door,
 *  - give your Tiled tile a field called "entityDefinition" and set it to "door"
 */
var door = { components: [
	{
		c: AudioSourceComponent,
	},
	{
		c: ColliderComponent,
	},
	{
		c: RigidBodyComponent,
		d: {
			isDynamic: true,
			density: 0.01
		}
	},
	{
		c: HealthComponent,
		d: {
			maxHealth: 15,
			currentHealth: 15,
			spawnOnDamage: {
				base: ["fxHitCar"],
			},
			spawnAsBody: {
				base: ["fxWoodenDoorA"],
			},
		}
	},
	{
		c: ActionableComponent,
		d: {
			actionDefinitions: [ActionDefinitions.unlock, ActionDefinitions.lock, ActionDefinitions.pickLock, ActionDefinitions.close],
		}
	},
	{
		c: EntranceComponent,
		d: {
			locked: false,
			keyName: "grayKey",
			lockPickTime: 5,
			unlockTime: 0.25,
			lockTime: 0.25,
			jamTime: 5,
			iconTint: 0xEEEEEE,
			lockedDoorIconDefinition: lockedDoorIcon,
			unlockSoundClipName: "unlock",
			pickLockSoundClipName: "unlock",
			lockSoundClipName: "lock",
			outerDoorCollisionGroup: CollisionCategoryDefinitions.CC_DOORS,
			innerDoorCollisionGroup: CollisionCategoryDefinitions.CC_DOORS,
			innerDoorCollidesWith: [
				CollisionCategoryDefinitions.CC_CHARACTERS,
				CollisionCategoryDefinitions.CC_WALLS,
				CollisionCategoryDefinitions.CC_AI_PATH_GENERATION_RAY
			],
			outerDoorCollidesWith: [
				CollisionCategoryDefinitions.CC_BULLETS,
				CollisionCategoryDefinitions.CC_STATIC_OBSTACLE,
				CollisionCategoryDefinitions.CC_DYNAMIC_OBSTACLE,
				CollisionCategoryDefinitions.CC_LIGHT_DYNAMIC_OBSTACLE,
				CollisionCategoryDefinitions.CC_AI_PATH_GENERATION_RAY,
				CollisionCategoryDefinitions.CC_VISION
			],
			outerDoorSenses: [
				CollisionCategoryDefinitions.CC_PLANNING_TARGET
			],
			innerDoorSenses: [],
		}
	},
]};

var lockedDoor = { extend: door, components: [
	{
		c: EntranceComponent,
		d: {
			locked: true,
		}
	},
]};


var redDoor = { extend: lockedDoor, components: [
	{
		c: HealthComponent,
		d: {
			maxHealth: 20,
			currentHealth: 20,
		}
	},
	{
		c: EntranceComponent,
		d: {
			keyName: "redKey",
			iconTint: 0xE22922,
		}
	},
]};

var orangeDoor = { extend: redDoor, components: [
	{
		c: EntranceComponent,
		d: {
			keyName: "orangeKey",
			iconTint: 0xECCDA8,
		}
	},
]};

var blueDoor = { extend: redDoor, components: [
	{
		c: EntranceComponent,
		d: {
			keyName: "blueKey",
			iconTint: 0x8d93fc,
		}
	},
]};

var brokenVaultDoorHinge = { components: [
//swinging door hinges
	{
		c: TransformComponent
	},
	{
		c: RigidBodyComponent,
		d: {
			isDynamic: true,
			density: 0.1
		}
	},
	{
		c: SpriteComponent,
		d: {
			layer: LayerDefinitions.LAYER_FLOOR_OBJECTS,
			sheet: "doors",
			name: "doorVaultBroken",
			defaultAnimationName: "hinges",
			loop: true,
		}
	},
]};

var brokenVaultDoor = { components: [
	{
		c: TransformComponent
	},
	{
		c: SpriteComponent,
		d: {
			layer: LayerDefinitions.LAYER_FLOOR_OBJECTS,
			sheet: "doors",
			name: "doorVaultBroken",
			defaultAnimationName: "floor",
			loop: true,
		}
	},
	{
		c: ColliderComponent,
		d: {
			width:0.7,
			height:1,
			collisionGroup: CollisionCategoryDefinitions.CC_DYNAMIC_OBSTACLE,
			collidesWith: [
//				CollisionCategoryDefinitions.CC_CHARACTERS,
				CollisionCategoryDefinitions.CC_WALLS,
				CollisionCategoryDefinitions.CC_STATIC_OBSTACLE,
				CollisionCategoryDefinitions.CC_DYNAMIC_OBSTACLE,
			],
		}
	},
	{
		c: RigidBodyComponent,
		d: {
			isDynamic: true,
			density: 0.1,

		}
	},
//nice spark effect?
//Light-ish object, door on floor
]};

var vaultDoor = { extend: redDoor, components: [
	{
		c: RigidBodyComponent,
		d: {
			isDynamic: true,
			density: 0.1
		}
	},
	{
		c: EntranceComponent,
		d: {
			locked: true,
			keyName: "vaultKey",
			lockPickTime: 20,
			unlockTime: 5,
			lockTime: 2,
			jamTime: 5,
		}
	},
	{
		c: HealthComponent,
		d: {
			maxHealth: 5,
			currentHealth: 5,
			minDamage: 5,
			spawnOnDamage: {
				base: ["fxMiss"],
			},
			spawnOnZeroHealth: {
				base: ["fxHitCar"],
			},
			spawnAsBody: {
				base: ["brokenVaultDoor"],
			},
		}
	},
]};

var knoxDoorA = { extend: redDoor, components: [
	{
		c: RigidBodyComponent,
		d: {
			isDynamic: true,
			density: 0.1
		}
	},
	{
		c: EntranceComponent,
		d: {
			locked: true,
			keyName: "knoxKeyA",
			lockPickTime: 20,
			unlockTime: 5,
			lockTime: 2,
			jamTime: 5,
			unlockSoundClipName: "unlockKnox",
			pickLockSoundClipName: "unlockKnox",
			lockSoundClipName: "unlockKnox",
		}
	},
	{
		c: HealthComponent,
		d: {
			maxHealth: 5000,
			currentHealth: 5000,
			minDamage: 5,
			spawnOnDamage: {
				base: ["fxMiss"],
			},
			spawnOnZeroHealth: {
				base: ["fxHitCar"],
			},
			spawnAsBody: {
				base: ["brokenVaultDoor"],
			},
		}
	},
]};

var knoxDoorB = { extend: redDoor, components: [
	{
		c: RigidBodyComponent,
		d: {
			isDynamic: true,
			density: 0.1
		}
	},
	{
		c: EntranceComponent,
		d: {
			locked: true,
			keyName: "knoxKeyB",
			lockPickTime: 20,
			unlockTime: 5,
			lockTime: 2,
			jamTime: 5,
			unlockSoundClipName: "unlockKnox",
			pickLockSoundClipName: "unlockKnox",
			lockSoundClipName: "unlockKnox",
		}
	},
	{
		c: HealthComponent,
		d: {
			maxHealth: 5000,
			currentHealth: 5000,
			minDamage: 5,
			spawnOnDamage: {
				base: ["fxMiss"],
			},
			spawnOnZeroHealth: {
				base: ["fxHitCar"],
			},
			spawnAsBody: {
				base: ["brokenVaultDoor"],
			},
		}
	},
]};

var powerMain = { components: [
	{
		c: HealthComponent,
		d: {
			maxHealth: 1,
			currentHealth: 1,
		}
	},
	{
		c: AIComponent,
		d: {
			reactions: [
				{
					name: "activateAlarm",
					triggers: [
						{
							name: "died"
						}
					],
					steps: [
						{
							name: "spawnEntityDefinition",
							params: {
								definitions: ["car"]
							}
						},
					]
				}
			]
		}
	}
]};

var indicatorIconBase = { components: [
	{
		c: TransformComponent,
		d: {
			x: 0, //0/128,
			y: 0, //0/128,
			ignoreParentRotation: false
		},
	},
	{
		c: SpriteComponent,
		d: {
			layer: LayerDefinitions.LAYER_IN_GAME_UI,
			sheet: "ingame-ui",
			name: "ui-action-steal",
			visible: false,
		}
	},
	{
		c: RigidBodyComponent,
		d: {
			layer: LayerDefinitions.LAYER_IN_GAME_UI,
			allowRotation: false,
			isKinematic: false,
			isSensor: true,
			dynamicFriction: 0,
			density: 0.000000000001,
		}
	},
	{
		c: ColliderComponent,
		d: {
			collisionGroup: CollisionCategoryDefinitions.CC_UI,
			senses: [CollisionCategoryDefinitions.CC_MOUSE],
			radius: 0.25,
		}
	},

]};

var indicatorAboveBase = { components: [
	{
		c: TransformComponent,
		d: {
			x: -3/128,
			y: 35/128,
			ignoreParentRotation: true
		},
	},
	{
		c: PixelTextComponent,
		d: {
			text: "",
			spacing: -2,
			spaceWidth: 3,
			align: TextAlign.center,
			fontDefinition: {
				layer: LayerDefinitions.LAYER_IN_GAME_UI,
				sheet: "fontGreasyStroke",
				scale: 0.3,
				visible: false,
			}
		}
	},
]};

var indicatorBelowBase = { components: [
	{
		c: TransformComponent,
		d: {
			x: 0/128,
			y: -35/128,
			ignoreParentRotation: true
		},
	},
	{
		c: PixelTextComponent,
		d: {
			text: "",
			spacing: -2,
			spaceWidth: 6,
			align: TextAlign.center,
			fontDefinition: {
				layer: LayerDefinitions.LAYER_IN_GAME_UI,
				sheet: "fontGreasyStroke",
				scale: 0.25,
				visible: false,
			}
		}
	}
]};

var lootIndicatorBase = { components: [
	{
		c: TransformComponent
	},
]};

var panicScream = { components: [
	{
		c: TransformComponent
	},
	{
		c: AudioSourceComponent,
		d: {
			autoPlay: "panic",
		}
	},
	{
		c: TimerDestroyerComponent,
		d: {
			lifetime: 1
		}
	},
]};

var holdupScream = { components: [
	{
		c: TransformComponent
	},
	{
		c: AudioSourceComponent,
		d: {
			autoPlay: "panic",
		}
	},
	{
		c: TimerDestroyerComponent,
		d: {
			lifetime: 0.7
		}
	},
]};

var holdupShout = { components: [
	{
		c: TransformComponent
	},
	{
		c: AudioSourceComponent,
		d: {
			autoPlay: "handsInTheAir",
		}
	},
	{
		c: TimerDestroyerComponent,
		d: {
			lifetime: 0.7
		}
	},
]};

var holdupShoutAgain = { components: [
	{
		c: TransformComponent
	},
	{
		c: AudioSourceComponent,
		d: {
			autoPlay: "stopHostage",
		}
	},
	{
		c: TimerDestroyerComponent,
		d: {
			lifetime: 0.7
		}
	},
]};

var fogOfWarVisualTargetBase = { components: [
	{
		c: SpriteComponent,
		d: {
			layer: LayerDefinitions.LAYER_IN_GAME_UI,
			sheet: "ingame-ui",
			name: "out-of-fov-arrow-green",
			alpha: 0.0,
		}
	},
	{
		c: TimerDestroyerComponent,
		d: {
			lifetime: 3
		}
	},
	{
		c: TweenerComponent,
		d: {
			component: "SpriteComponent",
			field: "alpha",
			duration: 1,
			values: [0.0, 1.0, 0.0]
		}
	}
]};

var fogOfWarLowVisualThreatTarget = { extend: fogOfWarVisualTargetBase, components: [
	{
		c: SpriteComponent,
		d: {
			name: "out-of-fov-arrow-green"
		}
	},
]};

var fogOfWarMediumVisualThreatTarget = { extend: fogOfWarVisualTargetBase, components: [
	{
		c: SpriteComponent,
		d: {
			name: "out-of-fov-arrow-yellow"
		}
	},
]};

var fogOfWarHighVisualThreatTarget = { extend: fogOfWarVisualTargetBase, components: [
	{
		c: SpriteComponent,
		d: {
			name: "out-of-fov-arrow-red"
		}
	},
]};

var fogOfWarAuralTargetBase = { components: [
	{
		c: SpriteComponent,
		d: {
			layer: LayerDefinitions.LAYER_IN_GAME_UI,
			sheet: "ingame-ui",
			name: "fov-hearing-green"
		}
	},
	{
		c: TimerDestroyerComponent,
		d: {
			lifetime: 0.5
		}
	},
	{
		c: TweenerComponent,
		d: {
			component: "TransformComponent",
			field: "simpleLocalScale",
			duration: 0.5,
			values: [0.1, 1.0],
		}
	}
]};

var fogOfWarLowAuralThreatTarget = { extend: fogOfWarAuralTargetBase, components: [
	{
		c: SpriteComponent,
		d: {
			name: "fov-hearing-green"
		}
	},
]};

var fogOfWarMediumAuralThreatTarget = { extend: fogOfWarAuralTargetBase, components: [
	{
		c: SpriteComponent,
		d: {
			tint: 0xdbc427,
		}
	},
]};

var fogOfWarHighAuralThreatTarget = { extend: fogOfWarAuralTargetBase, components: [
	{
		c: SpriteComponent,
		d: {
			tint: 0xff2400,
		}
	},
]};

var slowRandomSpawner = { components: [
	{
		c: TransformComponent
	},
	{
		c: SpawnerComponent,
		d: {
			total: -1,
			minInterval: 20,
			maxInterval: 120
		}
	}
]};

var toilet = { extend: hotspotBase, components: [
	{
		c: HotspotComponent,
		d: {
			category: "toilet",
			facing: 270
		}
	},
	{
		c: ColliderComponent,
		d: {
			radius: 0.1
		}
	},
	{
		c: ActionableComponent,
		d: {
			actionDefinitions: [ActionDefinitions.poop],
		}
	},
]};

var publicPhone = { components: [
	{
		c: TransformComponent,
	},
	{
		c: ActionableComponent,
		d: {
			actionDefinitions: [ActionDefinitions.callPolice],
		}
	}],
	children: [
		{ extend: hotspotBase, components: [
			{
				c: TransformComponent,
				d: {
					x: 0.0,
					y: -0.4
				}
			},
			{
				c: ColliderComponent,
				d: {
					radius: 0.1
				}
			},
			{
				c: HotspotComponent,
				d: {
					category: "phone",
					group: "public",
					facing: 0
				}
			},
		]
	}
]};

var phonePrivate = { components: [
	{
		c: TransformComponent,
	},
	{
		c: ActionableComponent,
		d: {
			actionDefinitions: [ActionDefinitions.callPolice],
		}
	},
	],
	children: [
		{ extend: hotspotBase, components: [
			{
				c: TransformComponent,
				d: {
					x: 0.6,
					y: 0.25
				}
			},
			{
				c: ColliderComponent,
				d: {
					radius: 0.3
				}
			},
			{
				c: HotspotComponent,
				d: {
					category: "phone",
					group: "private",
					facing: 210
				}
			},
		]
	}
]};

var phoneBooth = { extend: wall, components: [
	{
		c: TransformComponent,
	},
],children:[
	{ extend: hotspotBase, components: [
		{
			c: TransformComponent,
			d: {
				x: 0.0,
				y: -0.0
			}
		},
		{
			c: ColliderComponent,
			d: {
				radius: 0.1
			}
		},
		{
			c: HotspotComponent,
			d: {
			//	category: "toilet",
			}
		},
	]},
	{ extend: hotspotBase, components: [
		{
			c: TransformComponent,
			d: {
				x: 0.0,
				y: -0.7,
			}
		},
		{
			c: ColliderComponent,
			d: {
				radius: 0.1
			}
		},
		{
			c: HotspotComponent,
			d: {
			//	category: "toilet",
			}
		},
	]},
	{ components: [
		{
			c: TransformComponent,
			d: {
			}
		},
		{
			c: RigidBodyComponent,
			d: {
				isDynamic: false
			}
		},
		{
			c: ColliderComponent,
			d: {
				collisionGroup: CollisionCategoryDefinitions.CC_WALLS,
				collidesWith: [
				//	CollisionCategoryDefinitions.CC_PLANNING_TARGET,
			    //	CollisionCategoryDefinitions.CC_HOTSPOTS,
				//	CollisionCategoryDefinitions.CC_BULLETS,
					CollisionCategoryDefinitions.CC_VISION,
				//	CollisionCategoryDefinitions.CC_LIGHT_DYNAMIC_OBSTACLE
				],
				senses: [CollisionCategoryDefinitions.CC_PLANNING_TARGET],
				width: 0.9,
				height: 0.1,
				offsetY: -0.5,
			}
		},
	]}
]};

var targetMovable = { components: [
	{
		c: HealthComponent,
		d: {
			currentHealth: 100,
			maxHealth: 100,
		}
	},
	{
		c: ActionableComponent,
		d: {
			actionDefinitions: [ActionDefinitions.attack, ActionDefinitions.shoot, ActionDefinitions.drill],
		}
	},
	{
		c: ColliderComponent,
		d: {
			radius: 0.24 * 1,
			collisionGroup: CollisionCategoryDefinitions.CC_DYNAMIC_OBSTACLE,
			collidesWith: [CollisionCategoryDefinitions.CC_CHARACTERS, CollisionCategoryDefinitions.CC_WALLS, CollisionCategoryDefinitions.CC_DOORS, CollisionCategoryDefinitions.CC_BULLETS, CollisionCategoryDefinitions.CC_STATIC_OBSTACLE, CollisionCategoryDefinitions.CC_DYNAMIC_OBSTACLE, CollisionCategoryDefinitions.CC_LIGHT_DYNAMIC_OBSTACLE],
			senses: [CollisionCategoryDefinitions.CC_AVOIDANCE, CollisionCategoryDefinitions.CC_MOUSE, CollisionCategoryDefinitions.CC_HOTSPOTS, CollisionCategoryDefinitions.CC_PLANNING_TARGET, CollisionCategoryDefinitions.CC_DOORS]
		}
	},
	{
		c: FieldOfViewMarkerComponent,
	},
	{
		c: RigidBodyComponent,
		d: {
			isDynamic: true,
			density: 10,

		}
	},
]};

var woodenBox = { extend: targetMovable, components: [
	{
		c: HealthComponent,
		d: {
			currentHealth: 3,
			maxHealth: 3,
			spawnOnDamage: {
				base: ["fxBulletHitWood"],
		//		fist: ["fxWoodenCrateA"],
			},
			spawnAsBody: {
				base: ["fxWoodenCrateA"],
			},
		}
	},
	{
		c: ActionableComponent,
		d: {
			actionDefinitions: [ActionDefinitions.attack, ActionDefinitions.shoot, ActionDefinitions.drill],
		}
	},
	{
		c: ColliderComponent,
		d: {
			radius: 0.24 * 1,
			collisionGroup: CollisionCategoryDefinitions.CC_DYNAMIC_OBSTACLE,
			collidesWith: [CollisionCategoryDefinitions.CC_CHARACTERS, CollisionCategoryDefinitions.CC_WALLS, CollisionCategoryDefinitions.CC_DOORS, CollisionCategoryDefinitions.CC_BULLETS, CollisionCategoryDefinitions.CC_STATIC_OBSTACLE, CollisionCategoryDefinitions.CC_DYNAMIC_OBSTACLE, CollisionCategoryDefinitions.CC_LIGHT_DYNAMIC_OBSTACLE],
			senses: [CollisionCategoryDefinitions.CC_AVOIDANCE, CollisionCategoryDefinitions.CC_MOUSE, CollisionCategoryDefinitions.CC_HOTSPOTS, CollisionCategoryDefinitions.CC_PLANNING_TARGET, CollisionCategoryDefinitions.CC_DOORS]
		}
	},
	{
		c: FieldOfViewMarkerComponent,
	},
	{
		c: RigidBodyComponent,
		d: {
			isDynamic: true,
			density: 10,

		}
	}
]};

var storeLootBoxShine = { components: [
	{
		c: TransformComponent,
		d: {
		}
	},
	{
		c: SpriteComponent,
		d: {
			layer: LayerDefinitions.LAYER_OBJECTS,
			sheet: "inventory",
			name: "woodenCrate",
			defaultAnimationName: "deliveryShine",
		}
	},
	{
		c: TweenerComponent,
		d: {
			component: "SpriteComponent",
			field: "alpha",
			duration: 1,
			values: [0, 0.7, 0],
			repeat: true
		}
	},
]};

var storeLootBox = { extend: woodenBox, components: [
	{
		c: HealthComponent,
		d: {
			currentHealth: 1,
			maxHealth: 1,
		}
	},
	{
		c: TransformComponent,
		d: {
			x: 9,
			y: -11,
		}
	},
	{
		c: InventoryComponent,
		d: {
			maxSize: 100,
		}
	},
	{
		c: SpriteComponent,
		d: {
			layer: LayerDefinitions.LAYER_OBJECTS,
			sheet: "inventory",
			name: "woodenCrate",
			defaultAnimationName: "delivery",
		}
	},
], children: [
	storeLootBoxShine
]};

var tutorialBox = { components: [
	{
		c: HealthComponent,
		d: {
			currentHealth: 0.5,
			maxHealth: 0.5,
			spawnOnDamage: {
				base: ["fxBulletHitWood"],
			},
			spawnAsBody: {
				base: ["fxWoodenCrateA"],
			},
		}
	},
	{
		c: ActionableComponent,
		d: {
			actionDefinitions: [ActionDefinitions.attack, ActionDefinitions.shoot, ActionDefinitions.drill],
		}
	},
	{
		c: ColliderComponent,
		d: {
			radius: 0.24 * 1,
			collisionGroup: CollisionCategoryDefinitions.CC_STATIC_OBSTACLE,
			collidesWith: [
			CollisionCategoryDefinitions.CC_CHARACTER_CORE,
			CollisionCategoryDefinitions.CC_CHARACTERS,
			CollisionCategoryDefinitions.CC_WALLS,
			CollisionCategoryDefinitions.CC_DOORS,
			CollisionCategoryDefinitions.CC_BULLETS,
			CollisionCategoryDefinitions.CC_STATIC_OBSTACLE,
			CollisionCategoryDefinitions.CC_DYNAMIC_OBSTACLE,
			CollisionCategoryDefinitions.CC_AI_PATH_GENERATION_RAY,
			CollisionCategoryDefinitions.CC_PLANNING_TARGET
			CollisionCategoryDefinitions.CC_LIGHT_DYNAMIC_OBSTACLE
			],
			senses: [CollisionCategoryDefinitions.CC_AVOIDANCE, CollisionCategoryDefinitions.CC_MOUSE, CollisionCategoryDefinitions.CC_HOTSPOTS, CollisionCategoryDefinitions.CC_PLANNING_TARGET, CollisionCategoryDefinitions.CC_DOORS]
		}
	},
	{
		c: FieldOfViewMarkerComponent,
	},
	{
		c: RigidBodyComponent,
		d: {
			isDynamic: true,
			density: 15,

		}
	},
]};

var targetImmovable = { components: [
	{
		c: HealthComponent,
		d: {
			currentHealth: 100,
			maxHealth: 100,
		}
	},
	{
		c: ActionableComponent,
		d: {
			actionDefinitions: [ActionDefinitions.attack, ActionDefinitions.shoot, ActionDefinitions.drill],
		}
	},
	{
		c: ColliderComponent,
		d: {
			radius: 0.24 * 1,
			collisionGroup: CollisionCategoryDefinitions.CC_DYNAMIC_OBSTACLE,
			collidesWith: [CollisionCategoryDefinitions.CC_CHARACTERS, CollisionCategoryDefinitions.CC_WALLS, CollisionCategoryDefinitions.CC_DOORS, CollisionCategoryDefinitions.CC_BULLETS, CollisionCategoryDefinitions.CC_STATIC_OBSTACLE, CollisionCategoryDefinitions.CC_DYNAMIC_OBSTACLE, CollisionCategoryDefinitions.CC_LIGHT_DYNAMIC_OBSTACLE],
			senses: [CollisionCategoryDefinitions.CC_AVOIDANCE, CollisionCategoryDefinitions.CC_MOUSE, CollisionCategoryDefinitions.CC_HOTSPOTS, CollisionCategoryDefinitions.CC_PLANNING_TARGET, CollisionCategoryDefinitions.CC_DOORS]
		}
	},
	{
		c: FieldOfViewMarkerComponent,
	},
	{
		c: RigidBodyComponent,
		d: {
			isDynamic: false,
			density: 10,

		}
	},
]};

var targetPractice = { components: [
	{
		c: HealthComponent,
		d: {
			currentHealth: 30,
			maxHealth: 30,
			spawnOnDamage: {
				base: ["fxBulletHitWood"],
			},

		}
	},
	{
		c: ActionableComponent,
		d: {
			actionDefinitions: [ActionDefinitions.attack, ActionDefinitions.shoot, ActionDefinitions.drill],
		}
	},
	{
		c: ColliderComponent,
		d: {
			radius: 0.24 * 1,
			collisionGroup: CollisionCategoryDefinitions.CC_DYNAMIC_OBSTACLE,
			collidesWith: [CollisionCategoryDefinitions.CC_CHARACTERS, CollisionCategoryDefinitions.CC_WALLS, CollisionCategoryDefinitions.CC_DOORS, CollisionCategoryDefinitions.CC_BULLETS, CollisionCategoryDefinitions.CC_STATIC_OBSTACLE, CollisionCategoryDefinitions.CC_DYNAMIC_OBSTACLE, CollisionCategoryDefinitions.CC_LIGHT_DYNAMIC_OBSTACLE],
			senses: [CollisionCategoryDefinitions.CC_AVOIDANCE, CollisionCategoryDefinitions.CC_MOUSE, CollisionCategoryDefinitions.CC_HOTSPOTS, CollisionCategoryDefinitions.CC_PLANNING_TARGET, CollisionCategoryDefinitions.CC_DOORS]
		}
	},
	{
		c: FieldOfViewMarkerComponent,
	},
	{
		c: RigidBodyComponent,
		d: {
			isDynamic: false,
			density: 10,

		}
	},
]};

var menuTap = { components: [
	{
		c: TransformComponent,
	},
	{
		c: AudioSourceComponent,
		d: {
			autoPlay: "menuTap",
		}
	},
	{
		c: TimerDestroyerComponent,
		d: {
			lifetime: 1.0
		}
	},
]};

var circuitSwitch = { components: [
	/*
	{
		c: SpriteComponent
	},
	*/
	{
		c: TransformComponent
	},
	{
		c: CircuitComponent,
		d: {
			isSwitch: true,
			isSwitchOn: false,
			onSpawnDefinition: "electricSwitchOnEffect",
			offSpawnDefinition: "electricSwitchOffEffect",
			// If there is a sprite component defined, put used animations here
			// maybe use red flasing when on, otherwise off
			//onSpriteAnimationName: "off",
			//offSpriteAnimationName: "on",
		}
	},
	{
		c: ColliderComponent,
		d: {
			collisionGroup: CollisionCategoryDefinitions.CC_UI,
			senses: [CollisionCategoryDefinitions.CC_MOUSE],
			height: 0.25,
			width: 0.6,
		}
	},
	{
		c: RigidBodyComponent,
		d: {
			isDynamic: false
		}
	},
	{
		c: ActionableComponent,
		d: {
			actionDefinitions: [ActionDefinitions.toggleCircuit],
		}
	},
	{
		c: IndicatorComponent,
		d: {
			iconDefinition: indicatorIconBase,
			aboveTextDefinition: indicatorAboveBase,
			belowTextDefinition: indicatorBelowBase,
			overwriteAbove: "$switch",
		}
	},
], children: [
	{ extend: hotspotBase, components: [
		{
			c: TransformComponent,
			d: {
				x: 0.0,
				y: -0.4,
			}
		},
		{
			c: ColliderComponent,
			d: {
				radius: 0.1
			}
		},
		{
			c: HotspotComponent,
			d: {
				category: "circuit",
				group: "public",
				facing: 0
			}
		},
	]}
]};

var hiddenRoomBlackout = { components: [
	{
		c: TransformComponent,
		d: {
			x: 0,
			y: 0,
			scaleX: 1,
			scaleY: 1,
			zIndex: 100
		}
	},
	{
		c: SpriteComponent,
		d: {
			layer: LayerDefinitions.LAYER_OVERHEAD,
			sheet: "tiles",
			name: "black",
			defaultAnimationName: "default",
			loop: true,
		}
	},
	{
		c: TweenerComponent,
		d: {
			enabled: true,
			component: "SpriteComponent",
			field: "alpha",
			duration: 0.1,
			values: [1.0, 0.0],
			repeat: false
		}
	},
	{
		c: CircuitComponent,
		d: {
			toggleComponents: ["TweenerComponent"],
			isPowerSource: true,
		}
	},
]};

// By default only senses characters
var areaCircuitSwitch = { components: [
	{
		c: TransformComponent
	},
	{
		c: CircuitComponent,
		d: {
			isSwitch: true,
			isSwitchOn: false,
			isPowerSource: true,
			isAreaSwitch: true,
			onSpawnDefinition: "menuTap",
			offSpawnDefinition: "menuTap",
			// If there is a sprite component defined, put used animations here
			// maybe use red flasing when on, otherwise off
			//onSpriteAnimationName: "off",
			//offSpriteAnimationName: "on",
		}
	},
	{
		c: ColliderComponent,
		d: {
			collisionGroup: CollisionCategoryDefinitions.CC_HOTSPOTS,
			senses: [CollisionCategoryDefinitions.CC_CHARACTERS],
		}
	},
	{
		c: RigidBodyComponent,
		d: {
			isDynamic: false
		}
	},
]};

// Only senses goons
var areaCircuitSwitchForGoons = { extend: areaCircuitSwitch, components: [
	{
		c: CircuitComponent,
		d: {
			areaSwitchTriggerConditions: [
				{ component: "TeamComponent", field: "name", value: "goons" },
			],
		}
	},
]};

// Only senses goons, only goes on once
var areaCircuitOneTimeSwitchForGoons = { extend: areaCircuitSwitch, components: [
	{
		c: CircuitComponent,
		d: {
			areaSwitchTriggerConditions: [
				{ component: "TeamComponent", field: "name", value: "goons" },
			],
			toggleComponents: ["CircuitComponent", "TimerDestroyerComponent"],
		}
	},
	{
		c: TimerDestroyerComponent,
		d: {
			lifetime: 0.01
		}
	},
]};

// Only the cursor will collide with this
var areaCircuitSwitchForMouse = { extend: areaCircuitSwitch, components: [
	{
		c: ColliderComponent,
		d: {
			collisionGroup: CollisionCategoryDefinitions.CC_UI,
			senses: [CollisionCategoryDefinitions.CC_MOUSE],
		}
	},
]};

var circuitSwitchLight = { extend: circuitSwitch, components: [
	{
		c: SpriteComponent,
		d: {
			layer: LayerDefinitions.LAYER_OBJECTS,
			sheet: "circuit",
			name: "circuitSwitchLight",
			defaultAnimationName: "off",
		}
	},
	{
		c: CircuitComponent,
		d: {
			isSwitch: true,
			isSwitchOn: false,
			onSpawnDefinition: "electricSwitchOnEffect",
			offSpawnDefinition: "electricSwitchOffEffect",
			// If there is a sprite component defined, put used animations here
			// maybe use red flasing when on, otherwise off
			onSpriteAnimationName: "on",
			offSpriteAnimationName: "off",
		}
	},
]};

var circuitSwitchCamera = { extend: circuitSwitch, components: [
	{
		c: SpriteComponent,
		d: {
			layer: LayerDefinitions.LAYER_OBJECTS,
			sheet: "circuit",
			name: "circuitSwitchCamera",
			defaultAnimationName: "on",
		}
	},
	{
		c: CircuitComponent,
		d: {
			isSwitch: true,
			isSwitchOn: true,
			onSpawnDefinition: "electricSwitchOnEffect",
			offSpawnDefinition: "electricSwitchOffEffect",
			// If there is a sprite component defined, put used animations here
			// maybe use red flasing when on, otherwise off
			onSpriteAnimationName: "on",
			offSpriteAnimationName: "off",
		}
	},
]};

var circuitPowerDestroyed = { components: [
	{
		c: SuspicionIncreaserComponent,
		d:{
			increaseAmount: 0.5,
		}
	},
	{
		c: SpriteComponent,
		d: {
			layer: LayerDefinitions.LAYER_OBJECTS,
			sheet: "tiles",
			name: "circuitPower",
			defaultAnimationName: "destroyed",
			loop: false,
		}
	},
	{
		c: TransformComponent
	},
]};

var circuitPower = { components: [
	{
		c: TransformComponent
	},
	{
		c: CircuitComponent,
		d: {
			isPowerSource: true,
		}
	},
	{
		c: HealthComponent,
		d: {
			currentHealth: 1,
			maxHealth: 1,
			spawnOnDamage: {
				base: ["fxHitElectric"],
			},
			spawnAsBody: {
				base: ["circuitPowerDestroyed"],
			},
		}
	},
	{
		c: ActionableComponent,
		d: {
			actionDefinitions: [ActionDefinitions.attack, ActionDefinitions.shoot, ActionDefinitions.drill],
		}
	},
	{
		c: ColliderComponent,
		d: {
			radius: 0.24 * 1,
			collisionGroup: CollisionCategoryDefinitions.CC_CHARACTERS,
			collidesWith: [CollisionCategoryDefinitions.CC_CHARACTERS, CollisionCategoryDefinitions.CC_WALLS, CollisionCategoryDefinitions.CC_DOORS, CollisionCategoryDefinitions.CC_BULLETS, CollisionCategoryDefinitions.CC_STATIC_OBSTACLE, CollisionCategoryDefinitions.CC_DYNAMIC_OBSTACLE, CollisionCategoryDefinitions.CC_LIGHT_DYNAMIC_OBSTACLE],
			senses: [CollisionCategoryDefinitions.CC_AVOIDANCE, CollisionCategoryDefinitions.CC_MOUSE, CollisionCategoryDefinitions.CC_HOTSPOTS, CollisionCategoryDefinitions.CC_PLANNING_TARGET, CollisionCategoryDefinitions.CC_DOORS]
		}
	},
	{
		c: FieldOfViewMarkerComponent,
	},
	{
		c: RigidBodyComponent,
		d: {
			isDynamic: true,
			density: 100,

		}
	},
	{
		c: IndicatorComponent,
		d: {
			iconDefinition: indicatorIconBase,
			aboveTextDefinition: indicatorAboveBase,
			belowTextDefinition: indicatorBelowBase,
			overwriteAbove: "$circuitBox",
		}
	},
]};

var sceneChangeTrigger = { extend: areaCircuitSwitch, components: [
	{
		c: SceneLoadComponent,
		d: {
			enabled: false,
		}
	},
	{
		c: CircuitComponent,
		d: {
			isSwitch: true,
			isSwitchOn: false,
			isPowerSource: true,
			isAreaSwitch: true,
			toggleComponents: ["SceneLoadComponent"],
			// SPAWN CRAZY
			//onSpawnDefinition: "electricSwitchOnEffect",
			//offSpawnDefinition: "electricSwitchOffEffect",
		}
	},
]};

var memoShine = { components: [
	{
		c: TransformComponent,
		d: {
			//y: 3,
		}
	},
	{
		c: SpriteComponent,
		d: {
			layer: LayerDefinitions.LAYER_FLOOR,
			sheet: "inventory",
			name: "itemPickableNoteGeneric",
			defaultAnimationName: "shine",
		}
	},
	{
		c: TweenerComponent,
		d: {
			component: "SpriteComponent",
			field: "alpha",
			duration: 1,
			values: [0, 0.7, 0],
			repeat: true
		}
	},
]};

var memo = { components: [
	{
		c: TransformComponent,
		d: {
		}
	},
	{
		c: ColliderComponent,
		d: {
			collisionGroup: CollisionCategoryDefinitions.CC_STATIC_OBSTACLE,
			collidesWith: [
				CollisionCategoryDefinitions.CC_CHARACTERS,
				CollisionCategoryDefinitions.CC_WALLS,
				CollisionCategoryDefinitions.CC_DOORS,
				CollisionCategoryDefinitions.CC_STATIC_OBSTACLE,
				CollisionCategoryDefinitions.CC_DYNAMIC_OBSTACLE,
				CollisionCategoryDefinitions.CC_BULLETS],
			senses: [CollisionCategoryDefinitions.CC_PLANNING_TARGET],
			width: 1,
			height: 0.65
		}
	},
	{
		c: SpriteComponent,
		d: {
			layer: LayerDefinitions.LAYER_FLOOR,
			sheet: "inventory",
			name: "itemPickableNoteGeneric",
			defaultAnimationName: "default",
		}
	},
	{
		c: RigidBodyComponent,
		d: {
			isDynamic: false,
		//	density: 1,
		}
	},
	{
		c: FieldOfViewMarkerComponent,
	},
], children: [
	memoShine
]};

var squareBushShadow = { components: [
	{
		c: TransformComponent,
		d: {
			scaleX: 1,
			scaleY: 1,
			x: 20 / 128,
			y: 20 / 128,
		}
	},
	{
		c: SpriteComponent,
		d: {
			layer: LayerDefinitions.LAYER_FLOOR,
			sheet: "tileset_garden",
			name: "0",
			tint: 0x000000,
		//	alpha: 0.5,
		}
	},
]};

var squareBush = { extend: lowBlock, components: [
	{
		c: TransformComponent,
		d: {
			scaleX: 1,
			scaleY: 1,
		}
	},
], children: [
	squareBushShadow
]};

var hideoutStore = { name: "hideoutStore", components: [
	{
		c: ColliderComponent,
		d: {
			collisionGroup: CollisionCategoryDefinitions.CC_UI,
			senses: [CollisionCategoryDefinitions.CC_MOUSE],
		}
	},
	{
		c: TransformComponent,
		d: {
			zIndex: 1,
		}

	},
	{
		c: ClickableComponent,
	},
	{
		c: RigidBodyComponent,
		d: {
			isDynamic: false,
		}
	},
]};

var hideoutHire = { name: "hideoutHire", components: [
	{
		c: ColliderComponent,
		d: {
			collisionGroup: CollisionCategoryDefinitions.CC_UI,
			senses: [CollisionCategoryDefinitions.CC_MOUSE],
		}
	},
	{
		c: TransformComponent,
		d: {
			zIndex: 1,
		}
	},
	{
		c: ClickableComponent,
	},
	{
		c: RigidBodyComponent,
		d: {
			isDynamic: false,
		}
	},
]};

var arcadeCabinetGunScreen = { components: [
	{
		c: TransformComponent,
		d: {
		}
	},
	{
		c: SpriteComponent,
		d: {
			layer: LayerDefinitions.LAYER_FLOOR_OBJECTS,
			sheet: "tiles2",
			name: "screenLight",
			defaultAnimationName: "gun",
		}
	},
	{
		c: TweenerComponent,
		d: {
			component: "SpriteComponent",
			field: "alpha",
			duration: 0.2,
			values: [0, 1, 0.2, 0.5, 0],
			repeat: true,
			randomStartTime: true,
		}
	},
]};

var arcadeCabinetGun = { extend: lowBlock, components: [
	{
		c: TransformComponent,
		d: {
		}
	},
], children: [
	arcadeCabinetGunScreen,
]};

var arcadeCabinetDongScreen = { extend: arcadeCabinetGunScreen, components: [
	{
		c: SpriteComponent,
		d: {
			defaultAnimationName: "dong",
		}
	},
	{
		c: TweenerComponent,
		d: {
			duration: 0.25,
			values: [0, 1, 0.2, 0.5, 0, 0.1, 0],
		}
	},
]};

var arcadeCabinetDong = { extend: lowBlock, components: [
	{
		c: TransformComponent,
		d: {
		}
	},
], children: [
	arcadeCabinetDongScreen,
]};

var arcadeCabinetMegablasterScreen = { extend: arcadeCabinetGunScreen, components: [
	{
		c: SpriteComponent,
		d: {
			defaultAnimationName: "megablaster",
		}
	},
	{
		c: TweenerComponent,
		d: {
			duration: 0.2,
			values: [0, 1, 0.2, 0.5, 0, 0.1, 0, 0.1, 0, 0.2, 0],
		}
	},
]};

var arcadeCabinetMegablaster = { extend: lowBlock, components: [
	{
		c: TransformComponent,
		d: {
		}
	},
], children: [
	arcadeCabinetMegablasterScreen,
]};

var arcadeCabinetArmoredScreen = { extend: arcadeCabinetGunScreen, components: [
	{
		c: SpriteComponent,
		d: {
			defaultAnimationName: "armored",
		}
	},
	{
		c: TweenerComponent,
		d: {
			duration: 0.35,
			values: [0, 1, 0.2, 0.5, 0, 0.1, 0],
		}
	},
]};

var arcadeCabinetArmored = { extend: lowBlock, components: [
	{
		c: TransformComponent,
		d: {
		}
	},
], children: [
	arcadeCabinetArmoredScreen,
]};

var floorLightSpot = { components: [
	{
		c: TransformComponent,
		d: {
			scaleX: 1,
			scaleY: 1,
		}
	},
	{
		c: SpriteComponent,
		d: {
			layer: LayerDefinitions.LAYER_LIGHTING,
			sheet: "lights",
			name: "lightTestMedium",
			tint: 0xb55323
		}
	},
]};

var floorLightOffice = { extend: chestHighLightObstacleBase, components: [
	{
		c: TransformComponent,
	},
], children: [
	floorLightSpot,
]};
