--- a/ChangeLog.txt Sat Nov 19 22:00:23 2016 +0100
+++ b/ChangeLog.txt Sat Nov 19 22:17:08 2016 +0100
@@ -77,7 +77,7 @@
Lua-API:
+ New call: SetCinematicMode(enable) -- e.g. for cutscenes etc.
- + New call: GetAmmoName(ammoType) -- returns the localized name for the specified ammoType
+ + New call: GetAmmoName(ammoType [, ignoreOverwrite]) -- returns the localized name for the specified ammoType
+ New call: GetVisualGearType(vgUid) -- returns the visual gear type
+ New call: SetAmmoTexts(ammoType, name, caption, description) -- Overwrite displayed name and description of an ammo type
+ New call: SetAmmoDescriptionAppendix(ammoType, descAppend) -- Append a custom text to the description of an ammo type without overwriting it
--- a/hedgewars/uScript.pas Sat Nov 19 22:00:23 2016 +0100
+++ b/hedgewars/uScript.pas Sat Nov 19 22:17:08 2016 +0100
@@ -2604,15 +2604,19 @@
end;
function lc_getammoname(L : Plua_state) : LongInt; Cdecl;
-var at: LongInt;
+var np, at: LongInt;
+ ignoreOverwrite: Boolean;
const call = 'GetAmmoName';
- params = 'ammoType';
+ params = 'ammoType [, ignoreOverwrite ]';
begin
- if CheckLuaParamCount(L, 1, call, params) then
+ if CheckAndFetchParamCountRange(L, 1, 2, call, params, np) then
begin
at:= LuaToAmmoTypeOrd(L, 1, call, params);
+ ignoreOverwrite := false;
+ if np > 1 then
+ ignoreOverwrite := lua_toboolean(L, 2);
if at >= 0 then
- if length(trluaammo[Ammoz[TAmmoType(at)].NameId]) > 0 then
+ if (not ignoreOverwrite) and (length(trluaammo[Ammoz[TAmmoType(at)].NameId]) > 0) then
lua_pushstring(L, PChar(trluaammo[Ammoz[TAmmoType(at)].NameId]))
else
lua_pushstring(L, PChar(trammo[Ammoz[TAmmoType(at)].NameId]));