hedgewars/uScript.pas
changeset 6779 ccd8aecaff6d
parent 6764 e56ff0231540
child 6780 166ee5275915
--- a/hedgewars/uScript.pas	Tue Mar 13 00:05:03 2012 -0400
+++ b/hedgewars/uScript.pas	Tue Mar 13 12:10:48 2012 -0400
@@ -1397,7 +1397,9 @@
         gear:= GearByUID(lua_tointeger(L, 1));
         if gear <> nil then
             begin
-            lua_pushinteger(L, hwRound(gear^.dX * 1000000));
+            // gear dX determines hog orientation
+            if (gear^.dX.isNegative) and (gear^.dX = _0) then lua_pushinteger(L, -1)
+            else lua_pushinteger(L, hwRound(gear^.dX * 1000000));
             lua_pushinteger(L, hwRound(gear^.dY * 1000000))
             end
         end;