-- Script to make diagonals reangle you
-- Put "LUA.diagonalreangle = true" in a mapheader to put this script into effect (just potential conflict safety)
-- When the script is active, any springs with Extra ticked in zone builder will reangle you

local MTF_EXTRA = 1
addHook("MobjMoveCollide", function(mo, s)
	if not (mapheaderinfo[gamemap].diagonalreangle) then return end
	
	if (s and s.valid) and (s.flags & MF_SPRING)
	and ((mo.z + mo.height*2) >= s.z) and (mo.z <= (s.z + s.height/2))
		-- diagonals should have BOTH of these set
		if not (mobjinfo[s.type].mass) then return end
		if not (mobjinfo[s.type].damage) then return end
		
		-- make sure they have MTF_EXTRA
		if not (s.spawnpoint) then return end	-- no spawnpoint, nothing to check
		if not (s.spawnpoint.options & MTF_EXTRA) then return end	-- they need Extra checked
		
		mo.angle = s.angle	-- force them to the angle of the diagonal spring
	end
end, MT_PLAYER)