-- i hate SOCks, thighhighs are better.

local names = {"MT_SGZ_BUSH", "MT_SGZ_SMALLFLOWER", "MT_SGZ_TALLFLOWER", "MT_EUDORA"}
local numstart = 1815

freeslot("SPR_SGZF")
for i = 1, #names do
	freeslot(names[i])
	freeslot("S_SGZ"..i)
	local state = _G["S_SGZ"..i]

	states[state] = {SPR_SGZF, i-1, -1, nil, 0, 0, state}

	mobjinfo[_G[names[i]]] = {
		doomednum = numstart+(i-1),
		spawnhealth = 1000,
		spawnstate = state,
		height = 64<<FRACBITS,
		radius = (i < #names and 16 or 64)<<FRACBITS,
		flags = i < #names and MF_SCENERY|MF_NOTHINK or MF_SOLID,
	}
end

local desist = {MT_EGGMANITEM, MT_EGGMANITEM_SHIELD,
					MT_BANANA, MT_BANANA_SHIELD,
					MT_ORBINAUT, MT_ORBINAUT_SHIELD,
					MT_JAWZ, MT_JAWZ_DUD, MT_JAWZ_SHIELD,
					MT_SSMINE_SHIELD, MT_SSMINE,
					MT_BALLHOG
				}

-- touch the cat, die.
local function touchCat(mo, mo2)
	-- mo2 needs to die:

	if not mo or not mo.valid return end
	if mo2 and mo2.valid and mo2.health

		if mo2.player	-- :oh:
			local t = P_SpawnMobj(mo2.x, mo2.y, mo2.z, MT_THOK)
			t.state = S_QUICKBOOM1
			t.scale = mapobjectscale*2
			t.color = SKINCOLOR_RED
			P_KillMobj(mo2, mo, mo)
			mo2.momz = 0
			mo2.flags = $|MF_NOGRAVITY
			mo2.flags2 = $|MF2_DONTDRAW
			return
		end

		for i = 1, #desist do

			if desist[i] == mo2.type

				local t = P_SpawnMobj(mo2.x, mo2.y, mo2.z, MT_THOK)
				t.state = S_QUICKBOOM1
				t.scale = mapobjectscale*2
				t.color = SKINCOLOR_RED
				S_StartSound(t, sfx_pop)
				P_RemoveMobj(mo2)
				return
			end
		end
	end
end

addHook("MobjCollide", touchCat, MT_EUDORA)
addHook("MobjMoveCollide", touchCat, MT_EUDORA)