2588 ScriptSetAmmo(TAmmoType(at), Trunc(lua_tonumber(L, 2)), Trunc(lua_tonumber(L, 3)), Trunc(lua_tonumber(L, 4)), Trunc(lua_tonumber(L, 5))); |
2588 ScriptSetAmmo(TAmmoType(at), Trunc(lua_tonumber(L, 2)), Trunc(lua_tonumber(L, 3)), Trunc(lua_tonumber(L, 4)), Trunc(lua_tonumber(L, 5))); |
2589 end; |
2589 end; |
2590 end; |
2590 end; |
2591 lc_setammo:= 0 |
2591 lc_setammo:= 0 |
2592 end; |
2592 end; |
|
2593 |
|
2594 |
|
2595 function lc_getammo(L : Plua_State) : LongInt; Cdecl; |
|
2596 var i, at, rawProb, probLevel: LongInt; |
|
2597 const |
|
2598 call = 'GetAmmo'; |
|
2599 params = 'ammoType'; |
|
2600 begin |
|
2601 if CheckLuaParamCount(L, 1, call, params) then |
|
2602 begin |
|
2603 at:= LuaToAmmoTypeOrd(L, 1, call, params); |
|
2604 if at >= 0 then |
|
2605 begin |
|
2606 // Ammo count |
|
2607 i:= InitialAmmoCounts[TAmmoType(at)]; |
|
2608 if i = AMMO_INFINITE then |
|
2609 i:= 9; |
|
2610 lua_pushnumber(L, i); |
|
2611 // Probability |
|
2612 rawProb:= Ammoz[TAmmoType(at)].Probability; |
|
2613 probLevel:= -1; |
|
2614 for i := 0 to High(probabilityLevels) do |
|
2615 if rawProb = probabilityLevels[i] then |
|
2616 probLevel:= i; |
|
2617 lua_pushnumber(L, probLevel); |
|
2618 // Delay in turns |
|
2619 lua_pushnumber(L, Ammoz[TAmmoType(at)].SkipTurns); |
|
2620 // Number in case |
|
2621 lua_pushnumber(L, Ammoz[TAmmoType(at)].NumberInCase); |
|
2622 lc_getammo:= 4 |
|
2623 end |
|
2624 else |
|
2625 lc_getammo:= 0 |
|
2626 end; |
|
2627 end; |
|
2628 |
2593 |
2629 |
2594 function lc_setammodelay(L : Plua_State) : LongInt; Cdecl; |
2630 function lc_setammodelay(L : Plua_State) : LongInt; Cdecl; |
2595 var at: LongInt; |
2631 var at: LongInt; |
2596 const |
2632 const |
2597 call = 'SetAmmoDelay'; |
2633 call = 'SetAmmoDelay'; |
3957 lua_register(luaState, _P'HideMission', @lc_hidemission); |
3993 lua_register(luaState, _P'HideMission', @lc_hidemission); |
3958 lua_register(luaState, _P'SetAmmoTexts', @lc_setammotexts); |
3994 lua_register(luaState, _P'SetAmmoTexts', @lc_setammotexts); |
3959 lua_register(luaState, _P'SetAmmoDescriptionAppendix', @lc_setammodescriptionappendix); |
3995 lua_register(luaState, _P'SetAmmoDescriptionAppendix', @lc_setammodescriptionappendix); |
3960 lua_register(luaState, _P'AddCaption', @lc_addcaption); |
3996 lua_register(luaState, _P'AddCaption', @lc_addcaption); |
3961 lua_register(luaState, _P'SetAmmo', @lc_setammo); |
3997 lua_register(luaState, _P'SetAmmo', @lc_setammo); |
|
3998 lua_register(luaState, _P'GetAmmo', @lc_getammo); |
3962 lua_register(luaState, _P'SetAmmoDelay', @lc_setammodelay); |
3999 lua_register(luaState, _P'SetAmmoDelay', @lc_setammodelay); |
3963 lua_register(luaState, _P'PlaySound', @lc_playsound); |
4000 lua_register(luaState, _P'PlaySound', @lc_playsound); |
3964 lua_register(luaState, _P'SetSoundMask', @lc_setsoundmask); |
4001 lua_register(luaState, _P'SetSoundMask', @lc_setsoundmask); |
3965 lua_register(luaState, _P'GetTeamName', @lc_getteamname); |
4002 lua_register(luaState, _P'GetTeamName', @lc_getteamname); |
3966 lua_register(luaState, _P'GetTeamIndex', @lc_getteamindex); |
4003 lua_register(luaState, _P'GetTeamIndex', @lc_getteamindex); |