{
	code: "fox",
	class: "EntityAgent",
	tags: ["animal", "huntable", "adult", "predator", "habitat-land"],
	weight: 6,
	variantgroups: [
		{ code: "type", states: ["red", "arctic"] },
		{ code: "age", "states": ["adult"] },
		{ code: "gender", states: ["male", "female"] }
	],
	hitboxSize: {"x": 0.75,"y": 0.5},
	deadHitboxSize: {"x": 0.75,"y": 0.3},
	eyeHeight: 0.7,
	drops: [],
	attributes: {
		killedByInfoText: "deadcreature-eaten",
		creatureDiet: {
			weightedFoodTags: [
				{ weight: 0.9, code: "meat" },
				{ weight: 1, code: "egg" }
			]
		},
		trappable: {
			"small": { trapChance: 0.0,	trapDestroyChance: 0.5 },
			"large": { trapChance: 0.7,	trapDestroyChance: 0 }
		},
		handbook: {
			groupcode: "creaturegroup-fox-{type}",
			trappableGroupCode: "creaturegroup-fox-{type}-{age}"
		},
	},
	client: {
		renderer: "Shape",
		shape: { base: "entity/animal/mammal/fox/fox-{gender}" },
		texture: { base: "entity/animal/mammal/fox/{type}-{gender}" },
		behaviors: [
			{ code: "repulseagents" }, 
			{ code: "controlledphysics", stepHeight: 1.1251 }, 
			{ code: "interpolateposition" }, 
			{ code: "floatupwhenstuck", onlyWhenDead: true },
			{ code: "harvestable" },
			{ code: "despawn", minPlayerDistance: 16, 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: "sleep", 
				animation: "sleep",
				easeInSpeed: 4,
				easeOutSpeed: 4,
				blendMode: "Average", 
			},
			{
				code: "sit", 
				animation: "sit",
				easeInSpeed: 4,
				easeOutSpeed: 4,
				blendMode: "Average", 
			}
		]
	},
	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-fox-{type}",
						quantity: { avg: 1, var: 0 } 
					},
					{
						type: "item", 
						code: "fat", 
						quantity: { avg: 0.25, var: 0 } 
					}
				]
			},
			{ code: "breathe" },
			{
				code: "multiply",
				enabledByType: {
					"*-female": true,
					"*": false
				},
				spawnEntityCodes: [ { "code":"fox-{type}-baby-male"}, {"code": "fox-{type}-baby-female"} ],
				requiresNearbyEntityCode: "fox-{type}-adult-male",
				requiresNearbyEntityRange: 10,
				spawnQuantityMin: 1,
				spawnQuantityMax: 4,
				eatAnyway: true,
				pregnancyDays: 5,
				multiplyCooldownDaysMin: 2,
				multiplyCooldownDaysMax: 5,
				portionsEatenForMultiply: 2
			}, 
			{ 
				code: "emotionstates",
				states: [
					{ code: "aggressiveondamage", 
						duration: 15, 
						chance: 0.6, 
						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: 4,
						damageType: "SlashingAttack",
						slot: 1,
						mincooldown: 1500, 
						maxcooldown: 1500, 
						attackDurationMs: 800,
						damagePlayerAtMs: 500,
						animation: "Attack",
						animationSpeed: 2.5,
						sound: "creature/fox/attack",
						whenInEmotionState: "aggressiveondamage"
					},
					{
						code: "seekentity",
						entityCodes: ["player"],
						priority: 2.5,
						movespeed: 0.03,
						seekingRange: 20,
						animation: "Run",
						animationSpeed: 1.5,
						sound: "creature/fox/growl",
						whenInEmotionState: "aggressiveondamage"
					},
					{
						code: "stayclosetoentity",
						enabledByType: {
							"*-adult-female": true,
							"*": false
						},
						priority: 1.4,
						entityCode: "fox-{type}-adult-male",
						movespeed: 0.02,
						animationSpeed: 3,
						maxDistance: 5,
						searchRange: 25,
						animation: "Run"
					},
					{
						code: "fleeentity",
						entityCodes: ["player", "wolf-*", "hyena-*", "bear-*"],
						priority: 2,
						movespeed: 0.03,
						seekingRange: 14,
						animation: "Run",
						animationSpeed: 2.5
					},
					{
						code: "meleeattack",
						entityCodes: ["chicken-rooster", "chicken-hen", "chicken-baby", "hare-*"],
						priority: 1.6,
						damage: 4,
						slot: 1,
						mincooldown: 1500, 
						maxcooldown: 1500, 
						attackDurationMs: 800,
						damagePlayerAtMs: 500,
						animation: "Attack",
						animationSpeed: 2.5,
						sound: "creature/fox/attack",
						whenNotInEmotionState: "saturated"
					},
					{
						code: "seekentity",
						entityCodes: ["chicken-rooster", "chicken-hen", "chicken-baby", "hare-*"],
						priority: 1.5,
						movespeed: 0.04,
						animationSpeed: 2,
						seekingRange: 20,
						maxFollowTime: 20,
						animation: "Run",
						sound: "creature/fox/growl",
						whenNotInEmotionState: "saturated"
					},
					{
						code: "followleadholder",
						minGeneration: 2,
						priority: 1.45,
						animation: "walk",
						animationSpeed: 2.2,
						movespeed: .015
					},					
					{
						code: "getoutofwater",
						priority: 1.4,
						movespeed: 0.015,
						animation: "Walk",
						animationSpeed: 2.2
					},
					{
						code: "idle",
						priority: 1.38,
						minduration: 200000,
						maxduration: 800000,
						mincooldown: 10000,
						maxcooldown: 30000,
						priorityForCancel: 1.38,
						animation: "Sleep",
						whenNotInEmotionState: "aggressiveondamage",
						duringDayTimeFrames: [ { fromHour: 10, toHour: 18 }, { fromHour: 1, toHour: 4 } ],
						stopOnNearbyEntityCodes: ["player", "wolf-*"],
						stopRange: 8,
						stopOnHurt: true
					},
					{
						code: "idle",
						onBlockBelowCode: "snowblock",
						priority: 1.35,
						priorityForCancel: 5,
						minduration: 2400,
						maxduration: 2400,
						mincooldown: 8000,
						maxcooldown: 30000,
						animation: "Dive",
						animationSpeed: 1.25,
						sound: "walk/deepsnow1",
						soundStartMs: 950
					},
					{
						code: "seekfoodandeat",
						movespeed: 0.006,
						priority: 1.3,
						eatItemCategories: ["protein"],
						eatSound: "creature/animal-eat-small",
						eatTime: 1.5,
						animation: "Walk",
						eatAnimation: "Eat",
						mincooldownHours: 1,
						maxcooldownHours: 4
					},
					{
						code: "idle",
						priority: 1.3,
						priorityForCancel: 1.35,
						minduration: 4680,
						maxduration: 4680,
						mincooldown: 80000,
						maxcooldown: 400000,
						animation: "yip",
						animationSpeed: 0.25,
						sound: "creature/fox/yip",
						soundRange: 110
					},
					{
						code: "idle",
						priority: 1.2,
						priorityForCancel: 1.35,
						minduration: 2500,
						maxduration: 2500,
						mincooldown: 6000,
						maxcooldown: 20000,
						animation: "Sniff",
						stopOnNearbyEntityCodes: ["player"],
						animationSpeed: 1.25
					},
					{
						code: "wander", 
						priority: 1.0, 
						priorityForCancel: 1.35,
						movespeed: 0.004,
						animation: "Walk",
						stopOnNearbyEntityCodes: ["player"],
						preferredLightLevel: 20
					},
					{
						code: "idle",
						priority: 0.9,
						minduration: 5000,
						maxduration: 30000,
						mincooldown: 2000,
						maxcooldown: 120000,
						priorityForCancel: 1.39,
						animation: "Sit",
						stopOnNearbyEntityCodes: ["player"],
						stopRange: 5
					},
					{ 
						code: "lookaround", 
						priority: 0.5
					}
				]
			},
			{ code: "pettable", minGeneration: 1 },
			{ code: "entitystatetags" }
		],
		spawnconditionsByType: {
			"fox-red-adult-male": {
				worldgen: {
					TriesPerChunk: { avg: 0.075, var: 0 },
					tryOnlySurface: true,
					groupSize: { dist: "verynarrowgaussian", avg: 2, var: 3 },
					insideBlockCodes: ["air", "tallgrass-*", "snowlayer-1"],
					minTemp: -15,
					maxTemp: 15,
					minRain: 0.25,
					minForestOrShrubs: 0.25,
					maxForest: 0.75,
					maxShrubs: 0.75,
					companions: ["fox-red-adult-female", "fox-red-baby-female", "fox-red-baby-male"]
				},
				runtime: {
					group: "neutral",
					tryOnlySurface: true,
					chance: 0.0006,
					maxQuantity: 4,
					// Make them spawn away from artifical light so they don't spawn inside farmland
					maxLightLevel: 7,
					lightLevelType: "onlyBlockLight",					
					groupSize: { dist: "verynarrowgaussian", avg: 1, var: 2 },
					insideBlockCodes: ["air", "tallgrass-*", "snowlayer-1"],
					minTemp: -15,
					maxTemp: 15,
					minRain: 0.25,
					minForestOrShrubs: 0.25,
					maxForest: 0.75,
					maxShrubs: 0.75,
					companions: ["fox-red-adult-female", "fox-red-baby-female", "fox-red-baby-male"]
				}
			},
			"fox-arctic-adult-male": {
				worldgen: {
					TriesPerChunk: { avg: 0.15, var: 0 },
					tryOnlySurface: true,
					minLightLevel: 10,
					groupSize: { dist: "verynarrowgaussian", avg: 2, var: 3 },
					insideBlockCodes: ["air", "snowlayer-1"],
					minTemp: -70,
					maxTemp: -10,
					minRain: 0.25,
					minForest: 0.5,
					companions: ["fox-arctic-adult-female", "fox-arctic-baby-female", "fox-arctic-baby-male"]
				},
				runtime: {
					group: "neutral",
					tryOnlySurface: true,
					chance: 0.0006,
					maxQuantity: 4,
					minLightLevel: 10,
					groupSize: { dist: "verynarrowgaussian", avg: 2, var: 3 },
					insideBlockCodes: ["air", "snowlayer-1"],
					minTemp: -70,
					maxTemp: -10,
					minRain: 0.25,
					minForest: 0.5,
					companions: ["fox-arctic-adult-female", "fox-arctic-baby-female", "fox-arctic-baby-male"]
				}
			},
		}
	},
	sounds: {
		hurt: "creature/fox/hurt",
		death: "creature/fox/die",
		idle: { path: "creature/fox/yip", pitch: { avg: 1, var: 0.25 } }
	},
	idleSoundChance: 0
}
