hedgewars/uScript.pas
changeset 13371 da913fc1d350
parent 13370 e202d58236b1
child 13373 0a93948e8ec7
equal deleted inserted replaced
13370:e202d58236b1 13371:da913fc1d350
  2972                 lua_pushstring(L, PChar(trammo[Ammoz[TAmmoType(at)].NameId]));
  2972                 lua_pushstring(L, PChar(trammo[Ammoz[TAmmoType(at)].NameId]));
  2973         end
  2973         end
  2974     else
  2974     else
  2975         lua_pushnil(L);
  2975         lua_pushnil(L);
  2976     lc_getammoname:= 1;
  2976     lc_getammoname:= 1;
       
  2977 end;
       
  2978 
       
  2979 function lc_getammotimer(L : Plua_state) : LongInt; Cdecl;
       
  2980 var at: LongInt;
       
  2981     weapon: PAmmo;
       
  2982 const call = 'GetAmmoTimer';
       
  2983       params = 'ammoType, gearUid';
       
  2984 begin
       
  2985     if CheckLuaParamCount(L, 2, call, params) then
       
  2986         begin
       
  2987         at:= LuaToAmmoTypeOrd(L, 1, call, params);
       
  2988         weapon:= GetAmmoEntry(CurrentHedgehog^, TAmmoType(at));
       
  2989         if (Ammoz[TAmmoType(at)].Ammo.Propz and ammoprop_Timerable) <> 0 then
       
  2990             lua_pushnumber(L, weapon^.Timer)
       
  2991         else
       
  2992             lua_pushnil(L);
       
  2993         end
       
  2994     else
       
  2995         lua_pushnil(L);
       
  2996     lc_getammotimer:= 1;
  2977 end;
  2997 end;
  2978 
  2998 
  2979 function lc_setvampiric(L : Plua_state) : LongInt; Cdecl;
  2999 function lc_setvampiric(L : Plua_state) : LongInt; Cdecl;
  2980 begin
  3000 begin
  2981     if CheckLuaParamCount(L, 1, 'SetVampiric', 'bool') then
  3001     if CheckLuaParamCount(L, 1, 'SetVampiric', 'bool') then
  3969 lua_register(luaState, _P'SetNextWeapon', @lc_setnextweapon);
  3989 lua_register(luaState, _P'SetNextWeapon', @lc_setnextweapon);
  3970 lua_register(luaState, _P'SetWeapon', @lc_setweapon);
  3990 lua_register(luaState, _P'SetWeapon', @lc_setweapon);
  3971 lua_register(luaState, _P'SetCinematicMode', @lc_setcinematicmode);
  3991 lua_register(luaState, _P'SetCinematicMode', @lc_setcinematicmode);
  3972 lua_register(luaState, _P'SetMaxBuildDistance', @lc_setmaxbuilddistance);
  3992 lua_register(luaState, _P'SetMaxBuildDistance', @lc_setmaxbuilddistance);
  3973 lua_register(luaState, _P'GetAmmoName', @lc_getammoname);
  3993 lua_register(luaState, _P'GetAmmoName', @lc_getammoname);
       
  3994 lua_register(luaState, _P'GetAmmoTimer', @lc_getammotimer);
  3974 lua_register(luaState, _P'SetVampiric', @lc_setvampiric);
  3995 lua_register(luaState, _P'SetVampiric', @lc_setvampiric);
  3975 lua_register(luaState, _P'SetLaserSight', @lc_setlasersight);
  3996 lua_register(luaState, _P'SetLaserSight', @lc_setlasersight);
  3976 lua_register(luaState, _P'Explode', @lc_explode);
  3997 lua_register(luaState, _P'Explode', @lc_explode);
  3977 // drawn map functions
  3998 // drawn map functions
  3978 lua_register(luaState, _P'AddPoint', @lc_addPoint);
  3999 lua_register(luaState, _P'AddPoint', @lc_addPoint);