freeslot(
	"MT_DEETON",
	"S_DEETON",
	"S_DEETON2",
	"SPR_SPDE"
)

states[S_DEETON] = {
	sprite = SPR_SPDE,
	frame = A,
	tics = 35,
	action = A_Look,
	nextstate = S_DEETON
}

states[S_DEETON2] = {
	sprite = SPR_SPDE,
	frame = A,
	tics = 1,
	action = A_DetonChase,
	nextstate = S_DEETON2
}

mobjinfo[MT_DEETON] = {
	spawnstate = S_DEETON,
	seestate = S_DEETON2,
	seesound = sfx_s3k86,
	attacksound = sfx_deton,
	deathstate = S_XPLD_FLICKY,
	deathsound = sfx_pop,
	raisestate = ANG15,
	spawnhealth = 1,
	reactiontime = 1,
	painchance = 3072,
	speed = 1*FRACUNIT,
	radius = 20*FRACUNIT,
	height = 32*FRACUNIT,
	mass = 0,
	flags = MF_ENEMY|MF_SHOOTABLE|MF_NOGRAVITY|MF_MISSILE
}

addHook("MobjThinker", function(egg)
	for p in players.iterate do
		if not (p.mo and p.mo.valid) then return end
		if p.mo.skin ~= "specki" and p.mo.skin ~= "mechaspecki" then return end
		if not egg and egg.valid then return end
		if not egg.health then return end
		local aggro = P_SpawnMobj(egg.x, egg.y, egg.z, MT_DEETON)
		aggro.flags = egg.flags
		aggro.flags2 = egg.flags2
		aggro.eflags = egg.eflags
		aggro.health = egg.health
		aggro.scale = egg.scale
		aggro.angle = egg.angle
		P_RemoveMobj(egg)
		return
	end
end, MT_DETON)