Rework of No Gravity script:
- Now called Gravity, gravity is derived from get away time percentage in game scheme
- Watchdog which sets gravity to normal when TurnTimeLeft is frozen for more than 15 seconds
HedgewarsScriptLoad("/Scripts/Locale.lua")
local gravity = 100
local wdGameTicks = 0
local wdTTL = 0
function onNewTurn()
SetGravity(gravity)
wdGameTicks = GameTime
end
function onGameTick20()
if (TurnTimeLeft < 20) or (TurnTimeLeft > 0 and wdGameTicks + 15000 < GameTime) then
SetGravity(100)
elseif wdTTL ~= TurnTimeLeft then
wdGameTicks = GameTime
SetGravity(gravity)
end
wdTTL = TurnTimeLeft
end
function onGameInit()
gravity = GetAwayTime
GetAwayTime = 100
end
function onGameStart()
ShowMission(loc("Gravity"),
loc("Current value is ") .. gravity .. "%",
loc("Set any gravity value you want by adjusting get away time"),
0, 5000)
end