Index: binaries/data/mods/public/maps/random/rmgen/library.js
===================================================================
--- binaries/data/mods/public/maps/random/rmgen/library.js	(revision 11319)
+++ binaries/data/mods/public/maps/random/rmgen/library.js	(working copy)
@@ -51,11 +51,6 @@
 	return Math.sin(x);
 }
 
-function tan(x)
-{
-	return Math.tan(x);
-}
-
 function abs(x) {
 	return Math.abs(x);
 }
@@ -596,31 +591,24 @@
 }
 
 
-// Function to get the distance between 2 points
+// Returns the distance between 2 points
 function getDistance(x1, z1, x2, z2)
 {
-	return Math.pow(Math.pow(x1 - x2, 2) + Math.pow(z1 - z2, 2), 1/2)
+	return Math.pow(Math.pow(x1 - x2, 2) + Math.pow(z1 - z2, 2), 1/2);
 }
 
-// Returns the abgle between two points in radians. --Warning:This can cause sync problems in cross-platform multiplayer games--
+// Returns the angle of the vector between point 1 and point 2.  The angle 
 function getAngle(x1, z1, x2, z2)
 {
-        var vector = [x2 - x1, z2 - z1];
-        var output = 0;
-        if (vector[0] !== 0 || vector[1] !== 0)
-        {
-                var output = Math.acos(vector[0]/getDistance(x1, z1, x2, z2));
-                if (vector[1] > 0) {output = PI + (PI - Math.acos(vector[0]/getDistance(x1, z1, x2, z2)))};
-        };
-        return (output + PI/2) % (2*PI);
-};
+	return output = Math.atan2(z2 - z1, x2 - x1);
+}
 
-// Returns the tangent of angle between the line that is created by two points and the X+ axis.
-function getDirection(x1, z1, x2, z2)
+// Returns the gradient of the line between point 1 and 2 in the form dz/dx
+function getGradient(x1, z1, x2, z2)
 {
 	if (x1 == x2)
 	{
-		return 100000;
+		return Infinity;
 	}
 	else
 	{
Index: binaries/data/mods/public/globalscripts/Math.js
===================================================================
--- binaries/data/mods/public/globalscripts/Math.js	(revision 11319)
+++ binaries/data/mods/public/globalscripts/Math.js	(working copy)
@@ -38,12 +38,16 @@
 		sign = -1;
 		a *= -1;
 	}
-	if (a > 1){
+	
+	if (a > 1)
+	{
 		// tan(pi/2 - x) = 1/tan(x)
 		inverted = true;
 		a = 1/a;
 	}
-	if (a > tanPiBy12){
+	
+	if (a > tanPiBy12)
+	{
 		// tan(x-pi/6) = (tan(x) - tan(pi/6)) / (1 + tan(pi/6)tan(x))
 		tanPiBy6Shift = Math.PI/6;
 		a = (a - tanPiBy6) / (1 + tanPiBy6*a);
@@ -113,3 +117,18 @@
 			return r;
 	}
 };
+
+Math.acos = function()
+{
+	error("Math.acos() does not have a synchronization safe implementation");
+};
+
+Math.asin = function()
+{
+	error("Math.asin() does not have a synchronization safe implementation");
+};
+
+Math.tan = function()
+{
+	error("Math.tan() does not have a synchronization safe implementation");
+};
