# HG changeset patch # User Wuzzy # Date 1544371967 -3600 # Node ID d670e4efe1ed52deee57bed2fb9e92270cc988f8 # Parent c2cd3f64b9f749b0c79e466e021fe2a11cff52f5 Lua API: SetTurnTimePaused/GetTurnTimePaused diff -r c2cd3f64b9f7 -r d670e4efe1ed ChangeLog.txt --- a/ChangeLog.txt Sun Dec 09 16:54:22 2018 +0100 +++ b/ChangeLog.txt Sun Dec 09 17:12:47 2018 +0100 @@ -4,6 +4,8 @@ + New chat command: “/help room” (shows room chat commands within the game) Lua API: + + New call: SetTurnTimePaused(isPaused): Call with true to pause turn time, false to unpause + + New call: GetTurnTimePaused(): Returns true if turn time is paused due to Lua + Params explode, poison in the SpawnFake*Crate functions now optional and default to false ====================== 0.9.25 ====================== diff -r c2cd3f64b9f7 -r d670e4efe1ed hedgewars/uGears.pas --- a/hedgewars/uGears.pas Sun Dec 09 16:54:22 2018 +0100 +++ b/hedgewars/uGears.pas Sun Dec 09 17:12:47 2018 +0100 @@ -1147,7 +1147,8 @@ or (Ammoz[CurrentHedgehog^.CurAmmoType].Ammo.Propz and ammoprop_DoesntStopTimerWhileAttacking <> 0) or ((GameFlags and gfInfAttack) <> 0) and (Ammoz[CurrentHedgehog^.CurAmmoType].Ammo.Propz and ammoprop_DoesntStopTimerWhileAttackingInInfAttackMode <> 0) or (CurrentHedgehog^.CurAmmoType = amSniperRifle)) - and (not(isInMultiShoot and ((Ammoz[CurrentHedgehog^.CurAmmoType].Ammo.Propz and ammoprop_DoesntStopTimerInMultiShoot) <> 0))); + and (not(isInMultiShoot and ((Ammoz[CurrentHedgehog^.CurAmmoType].Ammo.Propz and ammoprop_DoesntStopTimerInMultiShoot) <> 0))) + and (not LuaClockPaused); end; diff -r c2cd3f64b9f7 -r d670e4efe1ed hedgewars/uScript.pas --- a/hedgewars/uScript.pas Sun Dec 09 16:54:22 2018 +0100 +++ b/hedgewars/uScript.pas Sun Dec 09 17:12:47 2018 +0100 @@ -3303,6 +3303,22 @@ lc_setreadytimeleft:= 0; end; +function lc_setturntimepaused(L : Plua_State) : LongInt; Cdecl; +begin + if CheckLuaParamCount(L, 1, 'SetTurnTimePaused', 'isPaused') then + LuaClockPaused:= lua_toboolean(L, 1); + lc_setturntimepaused:= 0; +end; + +function lc_getturntimepaused(L : Plua_State) : LongInt; Cdecl; +begin + if CheckLuaParamCount(L, 0, 'GetTurnTimePaused', '') then + lua_pushboolean(L, LuaClockPaused) + else + lua_pushnil(L); + lc_getturntimepaused:= 1; +end; + function lc_startghostpoints(L : Plua_State) : LongInt; Cdecl; begin if CheckLuaParamCount(L, 1, 'StartGhostPoints', 'count') then @@ -4337,6 +4353,8 @@ lua_register(luaState, _P'Explode', @lc_explode); lua_register(luaState, _P'SetTurnTimeLeft', @lc_setturntimeleft); lua_register(luaState, _P'SetReadyTimeLeft', @lc_setreadytimeleft); +lua_register(luaState, _P'SetTurnTimePaused', @lc_setturntimepaused); +lua_register(luaState, _P'GetTurnTimePaused', @lc_getturntimepaused); // drawn map functions lua_register(luaState, _P'AddPoint', @lc_addPoint); lua_register(luaState, _P'FlushPoints', @lc_flushPoints); diff -r c2cd3f64b9f7 -r d670e4efe1ed hedgewars/uVariables.pas --- a/hedgewars/uVariables.pas Sun Dec 09 16:54:22 2018 +0100 +++ b/hedgewars/uVariables.pas Sun Dec 09 17:12:47 2018 +0100 @@ -261,6 +261,9 @@ LuaEndTurnRequested: boolean; LuaNoEndTurnTaunts: boolean; + // whether Lua requested to pause the clock + LuaClockPaused: boolean; + MaskedSounds : array[TSound] of boolean; LastVoice : TVoice;