local function CheckAndCrumble2(mo, sec)
  for fof in sec.ffloors()
    if not (fof.flags & FF_EXISTS) continue end -- Does it exist?
    if not (fof.flags & FF_BUSTUP) continue end -- Is it bustable?
    
    if mo.z + mo.momz + mo.height < fof.bottomheight continue end -- Are we too low?
    if mo.z + mo.momz > fof.topheight continue end -- Are we too high?

    -- Check for whatever else you may want to    
    local line = fof.master
    EV_CrumbleChain(fof) -- Crumble
	if line.flags & ML_EFFECT5
        P_LinedefExecute(P_AproxDistance(line.dx, line.dy) >> FRACBITS, mo, fof.target)
    end
  end
end






addHook("PlayerThink", function(p)
  if not p.mo return end
  if p.mo.skin != "flame" return end
  if p.mo.state != S_PLAY_FCRASH return end
	CheckAndCrumble2(p.mo, p.mo.subsector.sector)
end)

addHook("MobjLineCollide", function(mo, line)
  if not mo.player return end
  if mo.skin != "flame" return end
  if mo.state != S_PLAY_FCRASH return end
  for _, sec in ipairs({line.frontsector, line.backsector})
    CheckAndCrumble2(mo, sec)
  end
end, MT_PLAYER)