# HG changeset patch # User Wuzzy # Date 1462838394 -7200 # Node ID 7ece39a537bd678cf9b81b539ed7459409f97ef5 # Parent 156f1866b8bdae664f16f5ac4c054affe5cd8d8b Add SetAmmoDescriptionAppendix to Lua API, see issue 82 diff -r 156f1866b8bd -r 7ece39a537bd hedgewars/uScript.pas --- a/hedgewars/uScript.pas Tue May 10 01:33:23 2016 +0200 +++ b/hedgewars/uScript.pas Tue May 10 01:59:54 2016 +0200 @@ -560,6 +560,23 @@ lc_setammotexts:= 0; end; +function lc_setammodescriptionappendix(L : Plua_State) : LongInt; Cdecl; +const + call = 'SetAmmoDescriptionAppendix'; + params = 'ammoType, descAppend'; +var + ammoType: TAmmoType; + descAppend: ansistring; +begin + if CheckLuaParamCount(L, 2, call, params) then + begin + ammoType := TAmmoType(LuaToAmmoTypeOrd(L, 1, call, params)); + descAppend := lua_tostringA(L, 2); + trluaammoa[Ammoz[ammoType].NameId] := descAppend; + end; + lc_setammodescriptionappendix := 0; +end; + function lc_enablegameflags(L : Plua_State) : LongInt; Cdecl; var i, n : integer; begin @@ -3360,6 +3377,7 @@ lua_register(luaState, _P'ShowMission', @lc_showmission); lua_register(luaState, _P'HideMission', @lc_hidemission); lua_register(luaState, _P'SetAmmoTexts', @lc_setammotexts); +lua_register(luaState, _P'SetAmmoDescriptionAppendix', @lc_setammodescriptionappendix); lua_register(luaState, _P'AddCaption', @lc_addcaption); lua_register(luaState, _P'SetAmmo', @lc_setammo); lua_register(luaState, _P'SetAmmoDelay', @lc_setammodelay); diff -r 156f1866b8bd -r 7ece39a537bd hedgewars/uStore.pas --- a/hedgewars/uStore.pas Tue May 10 01:33:23 2016 +0200 +++ b/hedgewars/uStore.pas Tue May 10 01:59:54 2016 +0200 @@ -996,6 +996,9 @@ else ammodesc := trammod[Ammoz[atype].NameId]; +if length(trluaammoa[Ammoz[atype].NameId]) > 0 then + ammodesc := ammodesc + '|' + trluaammoa[Ammoz[atype].NameId]; + // render window and return the texture WeaponTooltipTex:= RenderHelpWindow(ammoname, ammocap, ammodesc, extra, extracolor, SpritesData[sprAMAmmos].Surface, @r) end; diff -r 156f1866b8bd -r 7ece39a537bd hedgewars/uVariables.pas --- a/hedgewars/uVariables.pas Tue May 10 01:33:23 2016 +0200 +++ b/hedgewars/uVariables.pas Tue May 10 01:59:54 2016 +0200 @@ -2474,6 +2474,7 @@ trluaammo: array[TAmmoStrId] of ansistring; // name of the weapon (Lua overwrite) trluaammoc: array[TAmmoStrId] of ansistring; // caption of the weapon (Lua overwrite) trluaammod: array[TAmmoStrId] of ansistring; // description of the weapon (Lua overwrite) + trluaammoa: array[TAmmoStrId] of ansistring; // description appendix of the weapon (Lua only) trmsg: array[TMsgStrId] of ansistring; // message of the event trgoal: array[TGoalStrId] of ansistring; // message of the goal cTestLua : Boolean;