--Changes flats: Does not work properly for animated textures.
--No Sonic: Change only ceiling texture
--No Tails: Change only floor
local function luaflatchange(l, mo, sector)
	if ((l.flags & (ML_NOSONIC|ML_NOTAILS)) != (ML_NOSONIC|ML_NOTAILS))
		for s in sectors.iterate
			if not (s.tag == l.tag) continue end
			if not (l.flags & ML_NOTAILS)
				s.ceilingpic = l.frontsector.ceilingpic
			end
			if not (l.flags & ML_NOSONIC)
				s.floorpic = l.frontsector.floorpic
			end
		end
	else
		print("Lua flat change linedef tag "..l.tag.. " doesn't have anything to do.\nConsider changing the linedef's flag configuration or removing it entirely.\n")
		return
	end
end

addHook("LinedefExecute", luaflatchange, "FLATCHNG")