hedgewars/uScript.pas
changeset 5899 0c3db82e9f4d
parent 5897 0e0fc7e08a3d
parent 5896 9ce1cf4e5a32
child 5900 37516a3bdb0e
--- a/hedgewars/uScript.pas	Wed Sep 14 15:23:40 2011 +0200
+++ b/hedgewars/uScript.pas	Wed Sep 14 17:52:46 2011 +0200
@@ -1503,6 +1503,29 @@
         lua_pushinteger(L, ord(CurrentHedgehog^.CurAmmoType));
     lc_getcurammotype := 1;
 end;
+
+// boolean TestRectForObstacle(x1, y1, x2, y2, landOnly)
+function lc_testrectforobstacle(L : Plua_State) : LongInt; Cdecl;
+var rtn: Boolean;
+begin
+    if lua_gettop(L) <> 5 then
+        begin
+        LuaError('Lua: Wrong number of parameters passed to TestRectForObstacle!');
+        lua_pushnil(L); // return value on stack (nil)
+        end
+    else
+        begin
+        rtn:= TestRectancleForObstacle(
+                    lua_tointeger(L, 1),
+                    lua_tointeger(L, 2),
+                    lua_tointeger(L, 3),
+                    lua_tointeger(L, 4),
+                    lua_toboolean(L, 5)
+                    );
+        lua_pushboolean(L, rtn);
+        end;
+    lc_testrectforobstacle:= 1
+end;
 ///////////////////
 
 procedure ScriptPrintStack;
@@ -1986,6 +2009,7 @@
 lua_register(luaState, 'SetHogHat', @lc_sethoghat);
 lua_register(luaState, 'PlaceGirder', @lc_placegirder);
 lua_register(luaState, 'GetCurAmmoType', @lc_getcurammotype);
+lua_register(luaState, 'TestRectForObstacle', @lc_testrectforobstacle);
 
 
 ScriptClearStack; // just to be sure stack is empty