2857 end; |
2857 end; |
2858 end; |
2858 end; |
2859 |
2859 |
2860 |
2860 |
2861 function lc_setammodelay(L : Plua_State) : LongInt; Cdecl; |
2861 function lc_setammodelay(L : Plua_State) : LongInt; Cdecl; |
2862 var at: LongInt; |
2862 var at, delay: LongInt; |
2863 const |
2863 const |
2864 call = 'SetAmmoDelay'; |
2864 call = 'SetAmmoDelay'; |
2865 params = 'ammoType, delay'; |
2865 params = 'ammoType, delay'; |
2866 begin |
2866 begin |
2867 if CheckLuaParamCount(L, 2, call, params) then |
2867 if CheckLuaParamCount(L, 2, call, params) then |
2868 begin |
2868 begin |
2869 at:= LuaToAmmoTypeOrd(L, 1, call, params); |
2869 at:= LuaToAmmoTypeOrd(L, 1, call, params); |
2870 if at >= 0 then |
2870 delay:= Trunc(lua_tonumber(L, 2)); |
2871 ScriptSetAmmoDelay(TAmmoType(at), Trunc(lua_tonumber(L, 2))); |
2871 if (at >= 0) and (TAmmoType(at) <> amNothing) then |
|
2872 begin |
|
2873 ScriptSetAmmoDelay(TAmmoType(at), delay); |
|
2874 // Unselect weapon if neccessary |
|
2875 if (delay > 0) and (CurrentHedgehog <> nil) and (CurrentHedgehog^.CurAmmoType = TAmmoType(at)) then |
|
2876 ParseCommand('setweap ' + char(0), true, true); |
|
2877 end; |
2872 end; |
2878 end; |
2873 lc_setammodelay:= 0 |
2879 lc_setammodelay:= 0 |
2874 end; |
2880 end; |
2875 |
2881 |
2876 function lc_getrandom(L : Plua_State) : LongInt; Cdecl; |
2882 function lc_getrandom(L : Plua_State) : LongInt; Cdecl; |