--- a/ChangeLog.txt Sun Sep 02 04:08:58 2018 +0200
+++ b/ChangeLog.txt Sun Sep 02 20:57:33 2018 +0200
@@ -111,6 +111,9 @@
+ New call: GetVampiric(): Returns true if vampirism is currently active
+ New call: GetLaserSight(): Returns true if laser sight (as utility) is currenctly active (ignoring sniper rifle)
+ New call: IsHogHidden(gear): Returns true if hog is hidden
+ + New call: SetTurnTimeLeft(TurnTimeLeft): Set remaining turn time
+ + New call: SetReadyTimeLeft(ReadyTimeLeft): Set remaining ready time
+ * Deprecation: Setting TurnTimeLeft/ReadyTimeLeft directly is now deprecated and will become useless in a future version. Use the setter functions instead
+ Changed call: AddTeam: 2nd param. color: Accepts negative value to use a default clan color from player settings
+ Changed call: HedgewarsScriptLoad: 2nd param. mustExist. If false, it's allowed for the script to not exist
+ Changed call: HedgewarsScriptLoad: Return true on success and false on failure
--- a/hedgewars/uScript.pas Sun Sep 02 04:08:58 2018 +0200
+++ b/hedgewars/uScript.pas Sun Sep 02 20:57:33 2018 +0200
@@ -3186,6 +3186,20 @@
lc_explode:= 1;
end;
+function lc_setturntimeleft(L : Plua_State) : LongInt; Cdecl;
+begin
+ if CheckLuaParamCount(L, 1, 'SetTurnTimeLeft', 'TurnTimeLeft') then
+ TurnTimeLeft:= Trunc(lua_tonumber(L, 1));
+ lc_setturntimeleft:= 0;
+end;
+
+function lc_setreadytimeleft(L : Plua_State) : LongInt; Cdecl;
+begin
+ if CheckLuaParamCount(L, 1, 'SetReadyTimeLeft', 'ReadyTimeLeft') then
+ ReadyTimeLeft:= Trunc(lua_tonumber(L, 1));
+ lc_setreadytimeleft:= 0;
+end;
+
function lc_startghostpoints(L : Plua_State) : LongInt; Cdecl;
begin
if CheckLuaParamCount(L, 1, 'StartGhostPoints', 'count') then
@@ -3669,12 +3683,11 @@
procedure GetGlobals;
begin
-// TODO
-// Use setters instead, because globals should be read-only!
-// Otherwise globals might be changed by Lua, but then unexpectatly overwritten by engine when a ScriptCall is triggered by whatever Lua is doing!
-// Sure, one could work around that in engine (e.g. by setting writable globals in SetGlobals only when their engine-side value has actually changed since SetGlobals was called the last time...), but things just get messier and messier then.
-// It is inconsistent anyway to have some globals be read-only and others not with no indication whatsoever.
-// -- sheepluva
+// This function is deprecated.
+// TODO: Remove this function.
+// Setting TurnTimeLeft and ReadyTimeLeft is now done in the setter functions
+// SetTurnTimeLeft and SetReadTimeLeft.
+// GetGloals should be removed in a future release.
TurnTimeLeft:= ScriptGetInteger('TurnTimeLeft');
ReadyTimeLeft:= ScriptGetInteger('ReadyTimeLeft');
end;
@@ -4176,6 +4189,8 @@
lua_register(luaState, _P'SetLaserSight', @lc_setlasersight);
lua_register(luaState, _P'GetLaserSight', @lc_getlasersight);
lua_register(luaState, _P'Explode', @lc_explode);
+lua_register(luaState, _P'SetTurnTimeLeft', @lc_setturntimeleft);
+lua_register(luaState, _P'SetReadyTimeLeft', @lc_setreadytimeleft);
// drawn map functions
lua_register(luaState, _P'AddPoint', @lc_addPoint);
lua_register(luaState, _P'FlushPoints', @lc_flushPoints);