# HG changeset patch # User Wuzzy # Date 1559985939 -7200 # Node ID a77b0e339929920e29a8bcf89c93dd5d792831f2 # Parent 13e7d4eccb67691537388a881ae3a79dcb0ca749 Lua API: Add SetAmmoSlot diff -r 13e7d4eccb67 -r a77b0e339929 ChangeLog.txt --- a/ChangeLog.txt Fri Jun 07 15:09:42 2019 +0200 +++ b/ChangeLog.txt Sat Jun 08 11:25:39 2019 +0200 @@ -164,6 +164,7 @@ + New call: AddMissionHog(health): Add a hedgehog for the mission team + New call: SetTeamPassive(teamname, isPassive): Mark a team as passive. Passive teams do not play and are treated like frozen teams. + New call: IsHogAlive(gear): Returns true if gear is a hegehog which is alive, not about to die and not hidden + + New call: SetAmmoSlot(ammoType, slot): Overwrite ammo slot of ammo type (use with care!) + New return value: AddTeam/AddMissionTeam return , + SetClanColor: Now accepts negative color argument for user clan color, like in AddTeam + AddTeam: Append “_qau” to voicepack name to enable automatic selection of voicepack language diff -r 13e7d4eccb67 -r a77b0e339929 hedgewars/uScript.pas --- a/hedgewars/uScript.pas Fri Jun 07 15:09:42 2019 +0200 +++ b/hedgewars/uScript.pas Sat Jun 08 11:25:39 2019 +0200 @@ -2931,6 +2931,19 @@ lc_setammodelay:= 0 end; +function lc_setammoslot(L : Plua_State) : LongInt; Cdecl; +var at, slot: LongInt; +begin + if CheckLuaParamCount(L, 2, 'SetAmmoSlot', 'ammoType, slot') then + begin + at:= Trunc(lua_tonumber(L, 1)); + slot:= Trunc(lua_tonumber(L, 2)); + Ammoz[TAmmoType(at)].Slot:= slot - 1; + AmmoMenuInvalidated:= true; + end; + lc_setammoslot:= 0; +end; + function lc_getrandom(L : Plua_State) : LongInt; Cdecl; var m : LongInt; begin @@ -4472,6 +4485,7 @@ lua_register(luaState, _P'SetAmmo', @lc_setammo); lua_register(luaState, _P'GetAmmo', @lc_getammo); lua_register(luaState, _P'SetAmmoDelay', @lc_setammodelay); +lua_register(luaState, _P'SetAmmoSlot', @lc_setammoslot); lua_register(luaState, _P'PlaySound', @lc_playsound); lua_register(luaState, _P'PlayMusicSound', @lc_playmusicsound); lua_register(luaState, _P'StopMusicSound', @lc_stopmusicsound);