share/hedgewars/Data/Scripts/Multiplayer/Gravity.lua
author unc0rr
Wed, 01 Jan 2014 14:16:01 +0400
changeset 9902 eb8e8b09b2f0
parent 9898 b87695f82d2e
child 9906 93c16a4b0c6a
permissions -rw-r--r--
Special script parameter variable in game scheme

HedgewarsScriptLoad("/Scripts/Locale.lua")

local gravity = 100
local wdGameTicks = 0
local wdTTL = 0

function onNewTurn()
    SetGravity(gravity)
    wdGameTicks = GameTime
end

function onGameTick20()
    if wdGameTicks + 15000 < GameTime then
        SetGravity(100)
    elseif wdTTL ~= TurnTimeLeft then
        wdGameTicks = GameTime
        SetGravity(gravity)
    end

    wdTTL = TurnTimeLeft
end

function onGameInit()
    gravity = ScriptParam
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