Lua: Add GetVampiric, GetLaserSight
authorWuzzy <Wuzzy2@mail.ru>
Tue, 31 Jul 2018 00:12:19 +0200
changeset 13576 e5761b37e99c
parent 13575 213f2bef8a24
child 13577 66460d5f0d9b
Lua: Add GetVampiric, GetLaserSight
ChangeLog.txt
hedgewars/uScript.pas
--- a/ChangeLog.txt	Mon Jul 30 20:38:01 2018 +0200
+++ b/ChangeLog.txt	Tue Jul 31 00:12:19 2018 +0200
@@ -70,6 +70,8 @@
  + New call: GetAmmoTimer(gearUid, ammoType): Returns current set timer for given ammoType and hog gear in ms. Returns nil for non-timerable ammo
  + New call: EnableSwitchHog(): Enable hog switching
  + New call: GetAmmo(ammoType): Returns ammo configuration (corresponds to SetAmmo)
+ + 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 parameter: SetAmmoTexts: 5th param. showExtra: Set to false to hide texts like “Not yet available”
  + New parameter: ShowMission: 6th param. forceDisplay: Set to true to prevent this particular mission panel to be hidden manually by player
  + New Lua library: Achievements
--- a/hedgewars/uScript.pas	Mon Jul 30 20:38:01 2018 +0200
+++ b/hedgewars/uScript.pas	Tue Jul 31 00:12:19 2018 +0200
@@ -3090,6 +3090,12 @@
     lc_setvampiric := 0;
 end;
 
+function lc_getvampiric(L : Plua_state) : LongInt; Cdecl;
+begin
+    lua_pushboolean(L, cVampiric);
+    lc_getvampiric := 1;
+end;
+
 function lc_setlasersight(L : Plua_state) : LongInt; Cdecl;
 begin
     if CheckLuaParamCount(L, 1, 'SetLaserSight', 'bool') then
@@ -3097,6 +3103,12 @@
     lc_setlasersight:= 0;
 end;
 
+function lc_getlasersight(L : Plua_state) : LongInt; Cdecl;
+begin
+    lua_pushboolean(L, cLaserSighting);
+    lc_getlasersight:= 1;
+end;
+
 function lc_explode(L : Plua_state) : LongInt; Cdecl;
 var mask: LongWord;
     n: LongInt;
@@ -4082,7 +4094,9 @@
 lua_register(luaState, _P'GetAmmoName', @lc_getammoname);
 lua_register(luaState, _P'GetAmmoTimer', @lc_getammotimer);
 lua_register(luaState, _P'SetVampiric', @lc_setvampiric);
+lua_register(luaState, _P'GetVampiric', @lc_getvampiric);
 lua_register(luaState, _P'SetLaserSight', @lc_setlasersight);
+lua_register(luaState, _P'GetLaserSight', @lc_getlasersight);
 lua_register(luaState, _P'Explode', @lc_explode);
 // drawn map functions
 lua_register(luaState, _P'AddPoint', @lc_addPoint);