{
	code: "locust",
	class: "EntityLocust",
	tags: ["mechanical", "habitat-land"],
	variantgroups:  [ { code: "type", states: ["bronze", "corrupt", "corrupt-sawblade" ] } ] ,
	weight: 90,
	canClimb: true,
	canClimbAnywhere: true,
	climbTouchDistance: 0.1,
	rotateModelOnClimb: true,
	fallDamageMultiplier: 0.0,
	hitboxSize: { x: 0.65, y: 0.6 },
	deadHitboxSize: { x: 0.65, y: 0.5 },
	eyeHeight: 0.3,
	attributes: {
		spawnDamageParticles: true,
		isMechanical: true,
		hackedEntityByType: {
			"*-bronze": "locust-bronze-hacked",
			"*-corrupt": "locust-corrupt-hacked"
		}
	},
	dropsByType: {
		"locust-corrupt-sawblade": [
			{
				type: "item",
				code: "gear-rusty",
				dropModbyStat: "rustyGearDropRate",
				quantity: { avg: 1, var: 0 }
			},
			{
				type: "block",
				code: "metal-parts",
				quantity: { avg: 0.5, var: 0.25 }
			},
			{
				type: "block",
				code: "metal-scraps",
				quantity: { avg: 0.75, var: 0.5 }
			},
			{
				type: "item",
				code: "stackrandomizer-alljonas",
				quantity: { avg: 1, var: 0 }
			}
		]
	},
	client: {
		renderer: "Shape",
		shape: { base: "entity/lore/locust/locust-{type}" },
		size: 1.2,
		glowLevelByType: {
			"*-bronze": 16,
			"*-corrupt": 16
		},
		behaviors: [
			{ code: "repulseagents" },
			{ code: "controlledphysics", stepHeight: 1.1251 },
			{ code: "floatupwhenstuck", onlyWhenDead: true },
			{ code: "interpolateposition" }
		],
		animations: [
			{
				code: "hurt",
				animation: "hurt",
				animationSpeed: 2.2,
				weight: 5,
				blendMode: "AddAverage"
			},
			{
				code: "die",
				animation: "die",
				animationSpeed: 1.25,
				weight: 10,
				blendMode: "Average",
				triggeredBy: { onControls: ["dead"] }
			},
			{
				code: "idle",
				animation: "idlecalm",
				blendMode: "Average",
				triggeredBy: { defaultAnim: true },
			}
		]
	},
	server: {
		behaviors: [
			{ code: "repulseagents" },
			{ code: "controlledphysics", stepHeight: 1.1251 },
			{ code: "health",
				currenthealthByType: {
					"*-bronze": 6,
					"*-corrupt": 12,
					"*-corrupt-sawblade": 40
				},
				maxhealthByType: {
					"*-bronze": 6,
					"*-corrupt": 12,
					"*-corrupt-sawblade": 40
				}
			},
			{ code: "deaddecay", hoursToDecay: 24 },
			{ code: "floatupwhenstuck", onlyWhenDead: true },
			{ code: "despawn", minPlayerDistance: 48, minSecondsByType: { "*-corrupt-sawblade": 900, "*": 90 } },
			{
				code: "emotionstates",
				states: [
					{ code: "fleeondamage", duration: 10, chance: 0.2, slot: 0, priority: 1, accumType: "max" },
					{ code: "aggressiveondamage", duration: 30, chance: 1, slot: 0, priority: 0.5, accumType: "noaccum" },
				]
			},
			{
				code: "taskai",
				aitasks: [
					{
						code: "meleeattack",
						entityCodes: ["player"],
						priority: 3,
						damageByType: {
							"*-bronze": 1.5,
							"*-corrupt": 4,
							"*-corrupt-sawblade": 16,
						},
						damageTierByType: {
							"*-bronze": 2,
							"*-corrupt": 3,
							"*-corrupt-sawblade": 3,
						},
						mincooldown: 1500,
						maxcooldown: 1500,
						damageTypeByType: {
							"*-bronze": "PiercingAttack",
							"*-corrupt": "PiercingAttack",
							"*-corrupt-sawblade": "SlashingAttack"
						},
						damagePlayerAtMs: 500,
						attackDurationMs: 800,
						animation: "attack",
						animationSpeed: 1.8,
						soundByType: {
							"*-corrupt-sawblade": "creature/locust/saw"
						},
						soundStartMs: 1000
					},
					{
						code: "stayclosetoentity",
						priority: 3,
						entityCode: "locust",
						movespeed: 0.02,
						maxDistance: 7,
						onlyIfLowerId: true,
						searchRange: 12,
						animation: "run",
						animationSpeed: 6.5
					},
					{
						code: "seekentity",
						entityCodes: ["player"],
						priority: 1.5,
						mincooldown: 500,
						maxcooldown: 1000,
						movespeed: 0.025,
						seekingRange: 15,
						maxFollowTime: 20,
						animationSpeed: 7,
						alarmHerd: true,
						leapAtTarget: true,
						leapAnimation: "jump",
						animation: "rundrill"
					},
					{
						code: "wander",
						priority: 1.3,
						priorityForCancel: 1.3,
						movespeed: 0.016,
						animationSpeed: 4,
						animation: "run",
						maxDistanceToSpawn: 4
					},
					{
						code: "idle",
						priority: 1.2,
						priorityForCancel: 1.35,
						minduration: 10000,
						maxduration: 30000,
						mincooldown: 30000,
						maxcooldown: 60000,
						animation: "sleep",
						animationSpeed: 1.75
					},
					{
						code: "idle",
						priority: 1.2,
						priorityForCancel: 1.35,
						minduration: 2500,
						maxduration: 2500,
						mincooldown: 6000,
						maxcooldown: 20000,
						animation: "lookleft",
						animationSpeed: 1.25
					},
					{
						code: "idle",
						priority: 1.2,
						priorityForCancel: 1.35,
						minduration: 2500,
						maxduration: 2500,
						mincooldown: 6000,
						maxcooldown: 20000,
						animation: "lookright",
						animationSpeed: 1.25
					},
					{
						code: "idle",
						priority: 1.2,
						priorityForCancel: 1.35,
						minduration: 2500,
						maxduration: 2500,
						mincooldown: 6000,
						maxcooldown: 20000,
						animation: "idletwitch",
						animationSpeed: 1.25
					},
					{
						code: "idle",
						priority: 1.2,
						priorityForCancel: 1.25,
						minduration: 2500,
						maxduration: 2500,
						mincooldown: 6000,
						maxcooldown: 20000,
						animation: "idlecalm",
						animationSpeed: 1.25
					},
					{
						code: "wander",
						priority: 1.1,
						priorityForCancel: 1.22,
						movespeed: 0.006,
						animationSpeed: 1.8,
						animation: "run",
						preferredLightLevel: 7
					},
					{
						code: "wander",
						priority: 1.1,
						priorityForCancel: 1.1,
						movespeed: 0.001,
						animationSpeed: 1.5,
						animation: "walk",
						preferredLightLevel: 7
					}
				]
			},
			{ code: "entitystatetags" }
		],
		spawnconditionsByType: {
			"*-corrupt-sawblade": {
				runtime: {
					group: "hostile",
					maxQuantity: 3,
					maxLightLevel: 5,
					chance: 0.0015,
					lightLevelType: "MaxTimeOfDayLight",
					groupSize:{ dist: "invexp", avg: 1, var: 0 },
					insideBlockCodes: ["air"],
					maxY: 0.7,
				}
			}
		}
	},
	sounds: {
		hurt: "creature/locust/hurt",
		death: "creature/locust/death",
		idle: { path: "creature/locust/idle", pitch: { avg: 1, var: 0.25 } }
	},
	idleSoundChance: 0.05
}
