# HG changeset patch # User Wuzzy # Date 1518111727 -3600 # Node ID 1d7d7d21914ae1e11e21fa980035937b93189bff # Parent fa402ce826c28223b1ce34960d60f99a3a4e4004 Lua API: Add SetVampiric and SetLaserSight diff -r fa402ce826c2 -r 1d7d7d21914a ChangeLog.txt --- 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 diff -r fa402ce826c2 -r 1d7d7d21914a hedgewars/uScript.pas --- 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);