{
	code: "raccoon",
	class: "EntityAgent",
	tags: ["animal", "huntable", "adult", "habitat-land"],
	weight: 15,
	variantgroups:  [ 
		{ code: "type", states: ["common"]},
		{ code: "age", states: ["adult"] },
		{ code: "gender", states: ["male", "female"] },
	] ,
	hitboxSize: { x: 0.75, y: 0.5 },
	deadHitboxSize: { x: 0.75, y: 0.4 },
	eyeHeight: 0.7,
	drops: [],
	attributes: {
		creatureDiet: {
			foodCategories: ["Fruit"],
			weightedFoodTags: [
				{ weight: 0.9, code: "fruit" },
				{ weight: 1, code: "egg" },
				{ weight: 1, code: "lootableSweet" },
				{ weight: 1, code: "sweetBerryBush" },
				{ weight: 0.2, code: "peanut" }
			]
		},
		trappable: {
			"small": { trapChance: 0.0,	trapDestroyChance: 0.5 },
			"large": { trapChance: 0.0,	trapDestroyChance: 0.0 }
		},
		handbook: {
			groupcode: "creaturegroup-raccoon",
			trappableGroupCode: "creaturegroup-raccoon-{type}-{age}"
		}
	},
	client: {
		renderer: "Shape",
		shape: { base: "entity/animal/mammal/raccoon/{type}-{gender}" },
		texture: { base: "entity/animal/mammal/raccoon/{type}-{gender}1" },
		behaviors: [
			{ code: "repulseagents" }, 
			{ code: "controlledphysics", stepHeight: 1.1251 }, 
			{ code: "floatupwhenstuck", onlyWhenDead: true },
			{ code: "interpolateposition" },
			{ code: "harvestable" },
			{ code: "mouthinventory", acceptStacks: [ { type: "item", code: "honeycomb" } ] },
			{ code: "despawn", minPlayerDistance: 8, belowLightLevel: 8, minSeconds: 300 },
			{ code: "ropetieable", minGeneration: 2 }
		],
		animations: [
			{
				code: "hurt",
				animation: "hurt", 
				animationSpeed: 2.2,
				weight: 10,
				blendMode: "AddAverage" 
			},
			{
				code: "die",
				animation: "death", 
				animationSpeed: 1.25,
				weight: 10,
				blendMode: "Average",
				triggeredBy: { onControls: ["dead"] }
			},
			{
				code: "idle", 
				animation: "idle",
				blendMode: "AddAverage",
				easeOutSpeed: 4,
				triggeredBy: { defaultAnim: true },
			},
			{ 
				code: "walk",
				animation: "walk",
				weight: 5
			}
		]
	},
	server: {
		behaviors: [
			{ code: "ropetieable", minGeneration: 2 },
			{ code: "repulseagents" }, 
			{ code: "controlledphysics", stepHeight: 1.1251 },
			{ code: "despawn", minPlayerDistance: 8, belowLightLevel: 8, minSeconds: 300 },
			{ code: "health", currenthealth: 5, maxhealth: 5, },
			{ code: "deaddecay", hoursToDecay: 96, decayedBlock: "carcass-small" },
			{ code: "floatupwhenstuck", onlyWhenDead: true },
			{ code: "harvestable", drops: [
				{
					type: "item", 
					code: "bushmeat-raw", 
					quantity: { avg: 2, var: 1 } 
				},
				{
					type: "item", 
					code: "hide-raw-raccoon-common", 
					quantity: { avg: 1.25, var: 0 } 
				},
				{
					type: "item", 
					code: "fat", 
					quantity: { avg: 0.25, var: 0 } 
				}
				]
			},
			{ code: "breathe" },
			{ 
				code: "emotionstates",
				states: [
					{ code: "aggressiveondamage", duration: 5, chance: 0, slot: 0, priority: 2, accumType: "noaccum" },
					{ code: "fleeondamage", duration: 10, chance: 1, slot: 0, priority: 1, accumType: "max" },
					{ code: "saturated", duration: 1200, chance: 1, slot: 0, priority: 1, accumType: "sum" }
				],
			},
			{ 
				code: "taskai",
				aiCreatureType: "LandCreature",
				aitasks: [
					{
						code: "meleeattack",
						entityCodes: ["player"],
						priority: 3,
						damage: 3,
						slot: 1,
						mincooldown: 1500, 
						maxcooldown: 1500, 
						attackDurationMs: 800,
						damagePlayerAtMs: 500,
						animation: "Attack",
						animationSpeed: 2.5,
						whenInEmotionState: "aggressiveondamage"
					},
					{
						code: "seekentity",
						entityCodes: ["player"],
						priority: 2.5,
						movespeed: 0.022,
						seekingRange: 20,
						animation: "Run",
						animationSpeed: 1.5,
						sound: "creature/raccoon/aggro",
						whenInEmotionState: "aggressiveondamage"
					},
					{
						code: "fleeentity",
						entityCodes: ["player", "wolf-*", "bear-*"],
						priority: 2,
						movespeed: 0.035,
						animationSpeed: 3.5,
						seekingRange: 12,
						animation: "Run"
					},
					{
						code: "fleeentity",
						entityCodes: ["beemob"],
						priority: 2,
						movespeed: 0.03,
						animationSpeed: 3,
						seekingRange: 9,
						fleeDurationMs: 20000,
						fleeingDistance: 25,
						animation: "Run",
						retaliateAttacks: false,
						whenInEmotionState: "fleeondamage"
					},
					{
						code: "seekfoodandeat",
						movespeed: 0.010,
						priority: 1.6,
						animationSpeed: 1.75,
						eatTime: 2,
						eatLooseItems: true,
						animation: "Walk",
						eatAnimation: "gather",
						eatAnimationLooseItems: "eat",
						mincooldownHours: 6,
						maxcooldownHours: 12,
					},
					{
						code: "useinventory",
						animation: "eat",
						priority: 1.5,
						priorityForCancel: 1.7,
						eatItemCategories: ["Fruit"],
						eatItemCodes: ["honeycomb"],
						useTime: 3,
						mincooldownHours: 0,
						maxcooldownHours: 0.5,
					},
					{
						code: "followleadholder",
						minGeneration: 2,
						priority: 1.45,
						animation: "walk",
						animationSpeed: 2,
						movespeed: 0.008
					},
					{
						code: "getoutofwater",
						priority: 1.4,
						movespeed: 0.015,
						animation: "Walk",
						animationSpeed: 2.2
					},
					{
						code: "stayclosetoentity",
						enabledByType: {
							"*-adult-female": true,
							"*": false
						},
						priority: 1.4,
						entityCode: "raccoon-{type}-adult-male",
						movespeed: 0.02,
						animationSpeed: 3,
						maxDistance: 5,
						searchRange: 25,
						animation: "Run"
					},
					{
						code: "idle",
						priority: 1.2,
						priorityForCancel: 1.35,
						minduration: 2500,
						maxduration: 2500,
						mincooldown: 6000,
						maxcooldown: 20000,
						animation: "Sniff",
						animationSpeed: 1.25
					},
					{
						code: "wander", 
						priority: 1.0, 
						priorityForCancel: 1.35,
						animation: "Walk",
						preferredLightLevel: 20,
						movespeed: 0.008,
						animationSpeed: 2
					},
					{
						code: "idle",
						priority: 0.9,
						minduration: 5000,
						maxduration: 30000,
						mincooldown: 2000,
						maxcooldown: 120000,
						priorityForCancel: 1.28,
						animation: "Sit",
						stopOnNearbyEntityCodes: ["player"],
						stopRange: 5
					},
					{ 
						code: "lookaround", 
						priority: 0.5
					}
				]
			},
			{ code: "collectitems" }, 
			{ code: "mouthinventory", acceptStacks: [ { type: "item", code: "honeycomb" }, { type: "item", code: "fruit-blueberry" }, { type: "item", code: "fruit-cranberry" }, { type: "item", code: "fruit-redcurrant" }, { type: "item", code: "fruit-whitecurrant" }, { type: "item", code: "fruit-blackcurrant" } ] },
			{ code: "entitystatetags" }
		],
		spawnconditions: {
			worldgen: {
				TriesPerChunk: { avg: 0.06, var: 0 },
				tryOnlySurface: true,
				groupSize: { dist: "verynarrowgaussian", avg: 2, var: 3 },
				insideBlockCodes: ["air", "tallgrass-*", "snowlayer-1"],
				companions: ["raccoon-{type}-adult-female", "raccoon-{type}-baby-male", "raccoon-{type}-baby-female"]
			},
			runtime: {
				group: "neutral",
				tryOnlySurface: true,
				chance: 0.0009,
				maxQuantity: 4,
				// Make them spawn away from artifical light so they don't spawn inside farmland
				maxLightLevel: 7,
				groupSize: { avg: 1, var: 0 },
				insideBlockCodes: ["air", "tallgrass-*", "snowlayer-1"],
				companions: ["raccoon-{type}-adult-female", "raccoon-{type}-baby-male", "raccoon-{type}-baby-female"]
			},
			climate: {
				minTemp: -4,
				maxTemp: 24,
				minRain: 0.25,
				minForest: 0.25,
				maxForest: 1.0
			}
		}
	},
	sounds: {
		hurt: "creature/raccoon/hurt",
		death: "creature/raccoon/death",
		idle: { path: "creature/raccoon/idle", pitch: { avg: 1, var: 0.25 } }
	},
	idleSoundChance: 0.01
}
