addHook("PostThinkFrame", do
	if not mapheaderinfo[gamemap].skykill then return end
	
	for player in players.iterate
		if player.pflags & PF_GODMODE or player.playerstate then continue end
		local mo = player.mo
		if not (mo and mo.valid and mo.health and P_IsObjectOnGround(mo)
		and mo.eflags & MFE_ONGROUND) then continue end
		local sector = mo.subsector and mo.subsector.valid and mo.subsector.sector
		if not (sector and sector.valid) then continue end
		
		if P_MobjFlip(mo) > 0
			if string.upper(sector.floorpic) == "F_SKY1"
			and mo.z <= sector.floorheight
				P_DamageMobj(mo, nil, nil, 1, DMG_DEATHPIT)
			end
		elseif string.upper(sector.ceilingpic) == "F_SKY1"
		and mo.z + mo.height >= sector.ceilingheight
			P_DamageMobj(mo, nil, nil, 1, DMG_DEATHPIT)
		end
	end
end)