hedgewars/uScript.pas
changeset 11058 b91667fd6f20
parent 11052 f55a49bd13b9
child 11060 506b6184f4af
equal deleted inserted replaced
11057:adb5ef54da54 11058:b91667fd6f20
   436         at:= LuaToAmmoTypeOrd(L, 1, call, params);
   436         at:= LuaToAmmoTypeOrd(L, 1, call, params);
   437         if at >= 0 then
   437         if at >= 0 then
   438             ParseCommand('setweap ' + char(at), true, true);
   438             ParseCommand('setweap ' + char(at), true, true);
   439         end;
   439         end;
   440     lc_setweapon:= 0;
   440     lc_setweapon:= 0;
       
   441 end;
       
   442 
       
   443 // no parameter means reset to default (and 0 means unlimited)
       
   444 function lc_setmaxbuilddistance(L : Plua_State) : LongInt; Cdecl;
       
   445 var np: LongInt;
       
   446 const
       
   447     call = 'SetMaxBuildDistance';
       
   448     params = '[ distInPx ]';
       
   449 begin
       
   450     if CheckAndFetchParamCountRange(L, 0, 1, call, params, np) then
       
   451         begin
       
   452         if np = 0 then
       
   453             begin
       
   454             // no args? reset
       
   455             cBuildMaxDist:= cDefaultBuildMaxDist;
       
   456             end
       
   457         else
       
   458             CBuildMaxDist:= lua_tointeger(L, 1);
       
   459         end;
       
   460     lc_setmaxbuilddistance:= 0;
   441 end;
   461 end;
   442 
   462 
   443 // sets weapon to whatever weapons is next (wraps around, amSkip is skipped)
   463 // sets weapon to whatever weapons is next (wraps around, amSkip is skipped)
   444 function lc_setnextweapon(L : Plua_State) : LongInt; Cdecl;
   464 function lc_setnextweapon(L : Plua_State) : LongInt; Cdecl;
   445 var at          : LongInt;
   465 var at          : LongInt;
  3299 lua_register(luaState, _P'GetGravity', @lc_getgravity);
  3319 lua_register(luaState, _P'GetGravity', @lc_getgravity);
  3300 lua_register(luaState, _P'SetGravity', @lc_setgravity);
  3320 lua_register(luaState, _P'SetGravity', @lc_setgravity);
  3301 lua_register(luaState, _P'SetWaterLine', @lc_setwaterline);
  3321 lua_register(luaState, _P'SetWaterLine', @lc_setwaterline);
  3302 lua_register(luaState, _P'SetNextWeapon', @lc_setnextweapon);
  3322 lua_register(luaState, _P'SetNextWeapon', @lc_setnextweapon);
  3303 lua_register(luaState, _P'SetWeapon', @lc_setweapon);
  3323 lua_register(luaState, _P'SetWeapon', @lc_setweapon);
       
  3324 lua_register(luaState, _P'SetMaxBuildDistance', @lc_setmaxbuilddistance);
  3304 // drawn map functions
  3325 // drawn map functions
  3305 lua_register(luaState, _P'AddPoint', @lc_addPoint);
  3326 lua_register(luaState, _P'AddPoint', @lc_addPoint);
  3306 lua_register(luaState, _P'FlushPoints', @lc_flushPoints);
  3327 lua_register(luaState, _P'FlushPoints', @lc_flushPoints);
  3307 
  3328 
  3308 lua_register(luaState, _P'SetGearAIHints', @lc_setaihintsongear);
  3329 lua_register(luaState, _P'SetGearAIHints', @lc_setaihintsongear);