Lua API: Add SetVampiric and SetLaserSight
authorWuzzy <Wuzzy2@mail.ru>
Thu, 08 Feb 2018 18:42:07 +0100
changeset 12934 1d7d7d21914a
parent 12933 fa402ce826c2
child 12935 330b6c353093
Lua API: Add SetVampiric and SetLaserSight
ChangeLog.txt
hedgewars/uScript.pas
--- a/ChangeLog.txt	Thu Feb 08 18:10:39 2018 +0100
+++ b/ChangeLog.txt	Thu Feb 08 18:42:07 2018 +0100
@@ -29,6 +29,8 @@
 
 Lua API:
  + New call: WriteLnToChat(string): Add a line in the chat
+ + New call: SetVampiric(bool): Toggle vampirism
+ + New call: SetLaserSight(bool): Toggle laser sight
  + New callback: onEndTurn(): Called at the end of a turn (when gears have settled)
  * Fix call: SetWeapon(amNothing) now unselects weapon
  * Fix global: TotalRounds was stuck at -1 for several turns
--- a/hedgewars/uScript.pas	Thu Feb 08 18:10:39 2018 +0100
+++ b/hedgewars/uScript.pas	Thu Feb 08 18:42:07 2018 +0100
@@ -2745,6 +2745,20 @@
     lc_getammoname:= 1;
 end;
 
+function lc_setvampiric(L : Plua_state) : LongInt; Cdecl;
+begin
+    if CheckLuaParamCount(L, 1, 'SetVampiric', 'bool') then
+        cVampiric := lua_toboolean(L, 1);
+    lc_setvampiric := 0;
+end;
+
+function lc_setlasersight(L : Plua_state) : LongInt; Cdecl;
+begin
+    if CheckLuaParamCount(L, 1, 'SetLaserSight', 'bool') then
+        cLaserSighting:= lua_toboolean(L, 1);
+    lc_setlasersight:= 0;
+end;
+
 function lc_startghostpoints(L : Plua_State) : LongInt; Cdecl;
 begin
     if CheckLuaParamCount(L, 1, 'StartGhostPoints', 'count') then
@@ -3677,6 +3691,8 @@
 lua_register(luaState, _P'SetCinematicMode', @lc_setcinematicmode);
 lua_register(luaState, _P'SetMaxBuildDistance', @lc_setmaxbuilddistance);
 lua_register(luaState, _P'GetAmmoName', @lc_getammoname);
+lua_register(luaState, _P'SetVampiric', @lc_setvampiric);
+lua_register(luaState, _P'SetLaserSight', @lc_setlasersight);
 // drawn map functions
 lua_register(luaState, _P'AddPoint', @lc_addPoint);
 lua_register(luaState, _P'FlushPoints', @lc_flushPoints);