# HG changeset patch # User Wuzzy # Date 1520854033 -3600 # Node ID 98a0edb4bb5a2be83a636985bba6531f5ce64f6d # Parent 6869d27a2f3fa63a52fe099e97a7ca34930a4d33 Lua API: Add SkipTurn() to replace ParseCommand("skip") diff -r 6869d27a2f3f -r 98a0edb4bb5a ChangeLog.txt --- a/ChangeLog.txt Mon Mar 12 02:09:21 2018 +0100 +++ b/ChangeLog.txt Mon Mar 12 12:27:13 2018 +0100 @@ -103,6 +103,7 @@ + New call: HealHog(gearUid, healthBoost[, showMessage[, tint]]): Heal hedgehog with graphical effects and message + New call: SetTeamLabel(teamname[, label]): Set an arbitrary label for a team, will be displayed next to the team bar + New call: SetSoundMask(soundId, isMasked): Allows to disable playing a sound effect from engine + + New call: SkipTurn(): Force current hedgehog to skip turn + New param: PlaySound accepts 3rd parameter for voices: instaVoice: If true, sound plays instantly instead of being queued + New callback: onEndTurn(): Called at the end of a turn (when gears have settled) + New hedgehog effect: heArtillery: Per-hedgehog artillery mode (can't walk). Values: 1 = permanently active. 2 = temporarily active (sniper rifle). 0 = not active diff -r 6869d27a2f3f -r 98a0edb4bb5a hedgewars/uScript.pas --- a/hedgewars/uScript.pas Mon Mar 12 02:09:21 2018 +0100 +++ b/hedgewars/uScript.pas Mon Mar 12 12:27:13 2018 +0100 @@ -1926,6 +1926,13 @@ lc_endturn:= 0 end; +function lc_skipturn(L : Plua_State): LongInt; Cdecl; +begin + L:= L; // avoid compiler hint + ParseCommand('skip', true, true); + lc_skipturn:= 0; +end; + function lc_sendstat(L : Plua_State) : LongInt; Cdecl; var statInfo : TStatInfoType; i, n : LongInt; @@ -3791,6 +3798,7 @@ lua_register(luaState, _P'GetGearType', @lc_getgeartype); lua_register(luaState, _P'EndGame', @lc_endgame); lua_register(luaState, _P'EndTurn', @lc_endturn); +lua_register(luaState, _P'SkipTurn', @lc_skipturn); lua_register(luaState, _P'GetTeamStats', @lc_getteamstats); lua_register(luaState, _P'SendStat', @lc_sendstat); lua_register(luaState, _P'SendGameResultOff', @lc_sendgameresultoff); diff -r 6869d27a2f3f -r 98a0edb4bb5a share/hedgewars/Data/Maps/ClimbHome/map.lua --- a/share/hedgewars/Data/Maps/ClimbHome/map.lua Mon Mar 12 02:09:21 2018 +0100 +++ b/share/hedgewars/Data/Maps/ClimbHome/map.lua Mon Mar 12 12:27:13 2018 +0100 @@ -260,7 +260,7 @@ if math.random(20) == 1 then AddVisualGear(2012,56,vgtSmoke,0,false) end if CurrentHedgehog == dummyHog and dummySkip ~= 0 and dummySkip < GameTime then - ParseCommand("/skip") + SkipTurn() dummySkip = 0 end diff -r 6869d27a2f3f -r 98a0edb4bb5a share/hedgewars/Data/Scripts/Multiplayer/HedgeEditor.lua --- a/share/hedgewars/Data/Scripts/Multiplayer/HedgeEditor.lua Mon Mar 12 02:09:21 2018 +0100 +++ b/share/hedgewars/Data/Scripts/Multiplayer/HedgeEditor.lua Mon Mar 12 12:27:13 2018 +0100 @@ -3789,7 +3789,7 @@ if GetHogLevel(CurrentHedgehog) == 0 then TurnTimeLeft = -1 -- is that turntime in your pocket? :D else - ParseCommand("skip") -- skip the computer's turn + SkipTurn() -- skip the computer's turn end end