{
	code: "shiver",
	class: "EntityShiver",
	tags: ["rust-creature", "habitat-land"],
	variantgroups: [
		{ code: "type", states: ["surface", "deep", "tainted", "corrupt", "nightmare", "stilt", "bellhead", "deepsplit"]}
	],
	weight: 240,
	canClimb: true,
	hitboxSize: { x: 1.2, y: 1 },
	deadHitboxSize: { x: 0.7, y: 0.7 },
	eyeHeight: 1.3,
	attributes: {
		allowInDevastationArea: true,
		killedByInfoText: "deadcreature-vile",
		glitchAffected: true,
		glitchFlicker: true,
		reckless: true,
		hitAndRunChance: 0.25,
		extraSplashParticlesMul: 4,
		spawnCloserDuringLowStability: true,
		onDeathStabilityRecoveryByType: {
			"shiver-surface": 0.01,
			"shiver-deep": 0.015,
			"shiver-tainted": 0.02,
			"shiver-corrupt": 0.025,
			"shiver-nightmare": 0.3,
			"shiver-*": 0.35,
		}
	},
	drops: [],
	client: {
		renderer: "Shape",
		pitchStep: false,
		shapeByType: {
			"*-surface": { base: "entity/lore/shiver/surface" },
			"*-deep": { base: "entity/lore/shiver/deep" },
			"*-tainted": { base: "entity/lore/shiver/tainted" },
			"*-corrupt": { base: "entity/lore/shiver/corrupt" },
			"*-nightmare": { base: "entity/lore/shiver/nightmare" },
			"*-stilt": { base: "entity/lore/shiver/stilt" },
			"*-bellhead": { base: "entity/lore/shiver/bellhead" },
			"*-deepsplit": { base: "entity/lore/shiver/deepsplit" },
		},
		texturesByType: {
			"*-surface": {
				"skin": { base: "entity/lore/shiver/surface1", alternates: [ { base: "entity/lore/shiver/surface2" }, {base: "entity/lore/shiver/surface3" }, {base: "entity/lore/shiver/surface4" }] },
			},
			"*-deep": {
				"skin": { base: "entity/lore/shiver/deep1", alternates: [ { base: "entity/lore/shiver/deep2" } ] },
			},
			"*-tainted": {
				"skin": { base: "entity/lore/shiver/tainted1", alternates: [ { base: "entity/lore/shiver/tainted2" } ] },
			},
			"*-corrupt": {
				"skin": { base: "entity/lore/shiver/corrupt1", alternates: [ { base: "entity/lore/shiver/corrupt2" } ] },
			},
			"*-nightmare": {
				"skin": { base: "entity/lore/shiver/nightmare1", alternates: [ { base: "entity/lore/shiver/nightmare2" } ] },
			},
			"*-stilt": {
				"skin": { base: "entity/lore/shiver/stilt" },
			},
			"*-bellhead": {
				"skin": { base: "entity/lore/shiver/bellhead" },
			},
			"*-deepsplit": {
				"skin": { base: "entity/lore/shiver/deepsplit" },
			}
		},
		behaviors: [
			{ code: "repulseagents" }, 
			{ code: "controlledphysics", stepHeight: 2.1251 }, 
			{ code: "floatupwhenstuck", onlyWhenDead: true },
			{ code: "interpolateposition" },
			{ code: "harvestable", duration: 2 }
		],
		animations: [
			{
				code: "hurt",
				animation: "hurt", 
				animationSpeed: 1,
				weight: 100,
				easeInSpeed: 100,
				blendMode: "Add" 
			},
			{
				code: "run",
				animation: "run", 
				animationSpeed: 1,
				weight: 1,
				blendMode: "Average" 
			},
			{
				code: "walk",
				animation: "walk", 
				animationSpeed: 1,
				weight: 1,
				blendMode: "Average" 
			},
			{
				code: "swipe",
				animation: "swipe", 
				animationSpeed: 1,
				weight: 100,
				blendMode: "Average" 
			},
			{
				code: "bite",
				animation: "bite", 
				animationSpeed: 1,
				weight: 100,
				blendMode: "Average" 
			},
			{
				code: "die",
				animation: "Death", 
				animationSpeed: 1,
				weight: 10,
				blendMode: "Average",
				triggeredBy: { onControls: ["dead"] }
			},
			{ 
				code: "idle",
				animation: "idle",
				blendMode: "Average", 
				triggeredBy: { defaultAnim: true }
			},
			{ 
				code: "despair",
				animation: "Despair",
				weight: 8,
				easeOutSpeed: 20,
				weightCapFactor: 0.5,
				blendMode: "Average" 
			},
			{ 
				code: "headbang",
				animation: "headbang",
				animationSounds: [{
					frame: 19,
					location: "creature/shiver/thump*",
					pitch: { avg: 1.0, var: 0.25 },
				}]
			},
			{ animation: "mouth-open1" },
			{ animation: "mouth-open2" },
			{ animation: "mouth-open3" },
			{ animation: "mouth-idle1" },
			{ animation: "mouth-idle2" },
			{ animation: "mouth-idle3" },
			{ animation: "mouth-attack1" },
			{ animation: "mouth-attack2" },
			{ animation: "mouth-attack3" },
			{ animation: "mouth-close1" },
			{ animation: "mouth-close2" },
			{ animation: "mouth-close3" },
			
			{ animation: "stroke-start", weight: 50, blendMode: "Average", adjustCollisionBox: true },
			{ animation: "stroke-idle", weight: 2, blendMode: "Average", adjustCollisionBox: true },
			{ animation: "stroke-end", weight: 2, blendMode: "Average", adjustCollisionBox: true }
		]
	},
	server: {
		behaviors: [
			{ code: "repulseagents" }, 
			{ code: "controlledphysics", stepHeight: 2.1251 },
			{ code: "health", 
				currenthealthByType: {
					"*-surface": 14,
					"*-deep": 19,
					"*-tainted": 25,
					"*-corrupt": 34,
					"*-nightmare": 45,
					"*-stilt": 45,
					"*-bellhead": 66,
					"*-deepsplit": 60,
				},
				maxhealthByType: {
					"*-surface": 14,
					"*-deep": 19,
					"*-tainted": 25,
					"*-corrupt": 34,
					"*-nightmare": 45,
					"*-stilt": 45,
					"*-bellhead": 66,
					"*-deepsplit": 60,
				}
			},
			{ code: "deaddecay", hoursToDecay: 3 },
			{ code: "floatupwhenstuck", onlyWhenDead: true },
			{ code: "despawn", minPlayerDistance: 32, minSeconds: 30 },
			{ code: "despawn", minPlayerDistance: 64, minSeconds: 6 },
			{
				code: "emotionstates",
				states: [  
						{
							code: "fleeondamage", 
							duration: 10,
							chanceByType: {
								"*-surface": 0.15,
								"*-deep": 0.07,
								"*-tainted": 0.03,
								"*-corrupt": 0.015,
								"*-nightmare": 0.01,
								"*": 0.01,
							},
							slot: 0, 
							priority: 1, 
							accumType: "max" 
						},
						{ code: "aggressiveondamage", duration: 30, chance: 1, slot: 0, priority: 0.5, accumType: "noaccum" },
					]
			},
			{
				code: "taskai",
				aitasks: [
					{
						code: "fleeentity",
						entityCodes: ["player"],
						priority: 3,
						movespeedByType: {
							"*-deepsplit": 0.03,
							"*": 0.04
						},
						animationSpeedByType: {
							"*-deepsplit": 1,
							"*": 1.3
						},
						seekingRange: 20,
						fleeingDistance: 64,
						fleeDurationMs: 9999999,
						minDayLightByType: {
							"*-surface": 0.925,
							"*-deep": 0.97,
							"*-tainted": 2,
							"*-corrupt": 2,
							"*-nightmare": 2,
							"*": 2,
						},
						ignoreDeepDayLight: true,
						cancelOnHurt: true,
						executionChance: 0.003,
						animation: "run"
					},
					{
						code: "fleeentity",
						entityCodes: ["player"],
						priority: 2.5,
						movespeedByType: {
							"*-deepsplit": 0.03,
							"*": 0.04
						},
						animationSpeedByType: {
							"*-deepsplit": 1,
							"*": 1.3
						},
						seekingRange: 15,
						executionChance: 0.5,
						fleeDurationMs: 5000,
						cancelOnHurt: true,
						animation: "run",
						fleeingDistance: 18,
						whenInEmotionState: "fleeondamage"
					},
					{
						code: "meleeattack",
						entityCodes: ["player"],
						priority: 2,
						damageByType: {
							"*-surface": 2.5,
							"*-deep": 4,
							"*-tainted": 8,
							"*-corrupt": 12,
							"*-nightmare": 20,
							"*": 24
						},
						damageTierByType: {
							"*-surface": 0,
							"*-deep": 1,
							"*-tainted": 2,
							"*-corrupt": 3,
							"*-nightmare": 4,
							"*": 4
						},
						knockbackStrength: {
							"*-bellhead": 4
						},
						damageTypeByType: {
							"*": "SlashingAttack",
						},
						slot: 1,
						mincooldown: 500, 
						maxcooldown: 1750, 
						damagePlayerAtMs: 400,
						attackDurationMs: 1000,
						animation: "bite",
						animationSpeed: 1,
						sound: "creature/drifter-hit",
						soundStartMs: 400
					},
					{
						code: "seekentity",
						entityCodes: ["player"],
						priority: 1.5,
						mincooldown: 200, 
						maxcooldown: 400, 
						searchWaitMs: 2000,
						movespeedByType: {
							"*-deepsplit": 0.038,
							"*": 0.05
						},
						animationSpeedByType: {
							"*-deepsplit": 1.15,
							"*": 1.5
						},
						executionChance: 0.5,
						seekingRange: 20,
						animation: "run",
						sound: "creature/shiver/aggro"
					},
					{
						code: "getoutofwater",
						movespeedByType: {
							"*-stilt": 0.021,
							"*": 0.015
						},
						animationSpeedByType: {
							"*-stilt": 1.4,
							"*": 1
						},
						priority: 1.4,
						animation: "Swim",
					},
					{
						code: "idle",
						priority: 1.2,
						priorityForCancel: 1.35,
						minduration: 13367,
						maxduration: 13367,
						executionChance: 0.001,
						initialMinCoolDown: 2000,
						initialMaxCoolDown: 150000,
						mincooldown: 200000,
						maxcooldown: 1000000,
						animation: "Despair",
						animationSpeed: 1
					},
					{
						code: "idle",
						priority: 1.25,
						priorityForCancel: 1.35,
						minduration: 4667,
						maxduration: 4667,
						mincooldown: 60000,
						maxcooldown: 180000,
						animation: "Headbang",
						animationSpeed: 1
					},
					{
						code: "wander", 
						priority: 1.0, 
						movespeedByType: {
							"*-deepsplit": 0.0138,
							"*": 0.018
						},
						animationSpeedByType: {
							"*-deepsplit": 1.92,
							"*": 2.5
						},
						animation: "walk",
						preferredLightLevel: 15,
						executionChance: 1
					}
				]
			},
			{ code: "harvestable", duration: 2, fixedweight: true, dropsByType: {
				"*-surface": [
					{
						type: "item",
						code: "gear-temporal",
						quantity: { avg: 0.02666, var: 0 }
					},
					{
						type: "item",
						code: "flaxfibers",
						quantity: { avg: 0.2, var: 0 }
					},
					{
						type: "item",
						code: "gear-rusty",
						dropModbyStat: "rustyGearDropRate",
						quantity: { avg: 0.01, var: 0 }
					}
				],
				"*-deep": [
					{
						type: "item",
						code: "gear-temporal",
						quantity: { avg: 0.033325, var: 0 }
					},
					{
						type: "item",
						code: "gear-rusty",
						dropModbyStat: "rustyGearDropRate",
						quantity: { avg: 0.03, var: 0 }
					},
					{
						type: "item",
						code: "flaxfibers",
						quantity: { avg: 0.4, var: 0 }
					}
				],		
				"*-tainted": [
					{
						type: "item",
						code: "gear-temporal",
						quantity: { avg: 0.03999, var: 0 }
					},
					{
						type: "item",
						code: "gear-rusty",
						dropModbyStat: "rustyGearDropRate",
						quantity: { avg: 0.07, var: 0 }
					},
					{
						type: "item",
						code: "flaxfibers",
						quantity: { avg: 0.6, var: 0 }
					}
				],
				"*-corrupt": [
					{
						type: "item",
						code: "gear-temporal",
						quantity: { avg: 0.046655, var: 0 }
					},
					{
						type: "item",
						code: "gear-rusty",
						dropModbyStat: "rustyGearDropRate",
						quantity: { avg: 0.1, var: 0 }
					},
					{
						type: "item",
						code: "flaxfibers",
						quantity: { avg: 0.8, var: 0 }
					}
				],
				"*-nightmare": [
					{
						type: "item",
						code: "gear-temporal",
						quantity: { avg: 0.05332, var: 0 }
					},
					{
						type: "item",
						code: "gear-rusty",
						dropModbyStat: "rustyGearDropRate",
						quantity: { avg: 0.2, var: 0 }
					},
					{
						type: "item",
						code: "flaxfibers",
						quantity: { avg: 1, var: 0 }
					}
				],
				"*": [
					{
						type: "item",
						code: "gear-temporal",
						quantity: { avg: 1, var: 0.4 }
					},
					{
						type: "item",
						code: "gear-rusty",
						dropModbyStat: "rustyGearDropRate",
						quantity: { avg: 5, var: 2.5 }
					},
					{
						type: "item",
						code: "flaxfibers",
						quantity: { avg: 2, var: 0 }
					},
					{
						type: "item",
						code: "stackrandomizer-alljonas",
						quantity: { avg: 0.4, var: 0 }
					}
				],
				},
			},
			{ code: "ripharvestable" },
			{ code: "entitystatetags" }
		],
		spawnconditions: {
			runtime: {
				group: "hostile",
				maxQuantityByType: {
					"*-surface": 1,
					"*-deep": 1,
					"*-tainted": 1,
					"*-stilt": 1,
					"*-bellhead": 1,
					"*-corrupt": 2,
					"*-nightmare": 2,
					"*": 0
				},
				maxLightLevel: 7,
				chance: 0.1,
				lightLevelType: "OnlyBlockLight",
				groupSizeByType: {
					"*-surface": { dist: "invexp", avg: 1, var: 0 },
					"*": { dist: "uniform", avg: 1, var: 0 },
				},
				insideBlockCodes: ["air", "tallgrass-*", "loosestones-*"],
				minYByType: {
					"*-surface": 0.85,
					"*-deep": 0.22,
					"*-tainted": 0.1,
					"*-stilt": 0.1,
					"*-bellhead": 0.1,
					"*-corrupt": 0,
					"*-nightmare": 0,
				},
				maxYByType: {
					"*-surface": 2,
					"*-deep": 0.89,
					"*-tainted": 0.55,
					"*-corrupt": 0.35,
					"*-nightmare": 0.23,
					"*-stilt": 0.19,
					"*-bellhead": 0.19
				}
			}
		}
	},
	sounds: {
		hurt: "creature/shiver/hurt",
		death: "creature/shiver/death",
		idle: { path: "creature/shiver/idle*", range: 32, pitch: { avg: 1, var: 0.25 } }
	}
}
