--- a/ChangeLog.txt Thu May 03 21:04:55 2018 +0200
+++ b/ChangeLog.txt Thu May 03 21:40:13 2018 +0200
@@ -23,6 +23,7 @@
Lua API:
+ New call: Retreat(time [, respectGetAwayTimeFactor): Force current turn into retreating mode
+ + New parameter: SetAmmoTexts: 5th param. showExtra: Set to false to hide texts like “Not yet available”
* Fix hog being unable to walk after using sniper rifle without firing both shots
====================== 0.9.24.1 ====================
--- a/hedgewars/uScript.pas Thu May 03 21:04:55 2018 +0200
+++ b/hedgewars/uScript.pas Thu May 03 21:40:13 2018 +0200
@@ -560,10 +560,18 @@
function lc_setammotexts(L : Plua_State) : LongInt; Cdecl;
const
call = 'SetAmmoTexts';
- params = 'ammoType, name, caption, description';
+ params = 'ammoType, name, caption, description [, showExtra]';
+var n: integer;
+ showExtra: boolean;
begin
- if CheckLuaParamCount(L, 4, call, params) then
- SetAmmoTexts(TAmmoType(LuaToAmmoTypeOrd(L, 1, call, params)), lua_tostringA(L, 2), lua_tostringA(L, 3), lua_tostringA(L, 4));
+ if CheckAndFetchParamCount(L, 4, 5, call, params, n) then
+ begin
+ if n = 5 then
+ showExtra:= lua_toboolean(L, 5)
+ else
+ showExtra:= true;
+ SetAmmoTexts(TAmmoType(LuaToAmmoTypeOrd(L, 1, call, params)), lua_tostringA(L, 2), lua_tostringA(L, 3), lua_tostringA(L, 4), showExtra);
+ end;
lc_setammotexts:= 0;
end;
--- a/hedgewars/uStore.pas Thu May 03 21:04:55 2018 +0200
+++ b/hedgewars/uStore.pas Thu May 03 21:40:13 2018 +0200
@@ -1008,25 +1008,21 @@
extra:= _S'';
extracolor:= 0;
-if (CurrentTeam <> nil) and (Ammoz[atype].SkipTurns >= CurrentTeam^.Clan^.TurnNumber) then // weapon or utility is not yet available
- begin
- if (atype = amTardis) and (SuddenDeathActive) then
- extra:= trmsg[sidNotAvailableInSD]
- else
- extra:= trmsg[sidNotYetAvailable];
- extracolor:= LongInt($ffc77070);
- end
-else if (((GameFlags and gfInfAttack) <> 0) and ((Ammoz[atype].Ammo.Propz and ammoprop_ForceTurnEnd) = 0)) or ((Ammoz[atype].Ammo.Propz and ammoprop_NoRoundEnd) <> 0) then
- // weapon or utility will not end your turn
- begin
- extra:= trmsg[sidNoEndTurn];
- extracolor:= LongInt($ff70c770);
- end
-else
- begin
- extra:= _S'';
- extracolor:= 0;
- end;
+if (trluaammoe[Ammoz[atype].NameId] = true) then
+ if (CurrentTeam <> nil) and (Ammoz[atype].SkipTurns >= CurrentTeam^.Clan^.TurnNumber) then // weapon or utility is not yet available
+ begin
+ if (atype = amTardis) and (SuddenDeathActive) then
+ extra:= trmsg[sidNotAvailableInSD]
+ else
+ extra:= trmsg[sidNotYetAvailable];
+ extracolor:= LongInt($ffc77070);
+ end
+ else if (((GameFlags and gfInfAttack) <> 0) and ((Ammoz[atype].Ammo.Propz and ammoprop_ForceTurnEnd) = 0)) or ((Ammoz[atype].Ammo.Propz and ammoprop_NoRoundEnd) <> 0) then
+ // weapon or utility will not end your turn
+ begin
+ extra:= trmsg[sidNoEndTurn];
+ extracolor:= LongInt($ff70c770);
+ end;
if length(trluaammo[Ammoz[atype].NameId]) > 0 then
ammoname := trluaammo[Ammoz[atype].NameId]
--- a/hedgewars/uVariables.pas Thu May 03 21:04:55 2018 +0200
+++ b/hedgewars/uVariables.pas Thu May 03 21:40:13 2018 +0200
@@ -2577,6 +2577,7 @@
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)
+ trluaammoe: array[TAmmoStrId] of boolean; // whether to render extra text (Lua overwrite)
trmsg: array[TMsgStrId] of ansistring; // message of the event
trgoal: array[TGoalStrId] of ansistring; // message of the goal
cTestLua : Boolean;
@@ -2644,6 +2645,7 @@
var s: shortstring;
i: integer;
t: TSound;
+ a: TAmmoStrId;
begin
// init LastVoice
LastVoice.snd:= sndNone;
@@ -2908,6 +2910,9 @@
for t:= Low(TSound) to High(TSound) do
MaskedSounds[t]:= false;
+ for a:= Low(TAmmoStrId) to High(TAmmoStrId) do
+ trluaammoe[a]:= true;
+
UIDisplay:= uiAll;
LocalMessage:= 0;
--- a/hedgewars/uWorld.pas Thu May 03 21:04:55 2018 +0200
+++ b/hedgewars/uWorld.pas Thu May 03 21:40:13 2018 +0200
@@ -32,7 +32,7 @@
procedure DrawWorldStereo(Lag: LongInt; RM: TRenderMode);
procedure ShowMission(caption, subcaption, text: ansistring; icon, time : LongInt);
procedure HideMission;
-procedure SetAmmoTexts(ammoType: TAmmoType; name: ansistring; caption: ansistring; description: ansistring);
+procedure SetAmmoTexts(ammoType: TAmmoType; name: ansistring; caption: ansistring; description: ansistring; autoLabels: boolean);
procedure ShakeCamera(amount: LongInt);
procedure InitCameraBorders;
procedure InitTouchInterface;
@@ -1972,7 +1972,7 @@
missionTimer:= 0;
end;
-procedure SetAmmoTexts(ammoType: TAmmoType; name: ansistring; caption: ansistring; description: ansistring);
+procedure SetAmmoTexts(ammoType: TAmmoType; name: ansistring; caption: ansistring; description: ansistring; autoLabels: boolean);
var
ammoStrId: TAmmoStrId;
ammoStr: ansistring;
@@ -1997,6 +1997,7 @@
trluaammoc[ammoStrId] := caption;
trluaammod[ammoStrId] := description;
+ trluaammoe[ammoStrId] := autoLabels;
end;
procedure ShakeCamera(amount: LongInt);