share/hedgewars/Data/Maps/ClimbHome/map.lua
changeset 10810 931dd8f42763
parent 10697 fb38a9468862
child 10811 0d9c49e88142
equal deleted inserted replaced
10809:bb2e4e9944f7 10810:931dd8f42763
     1 HedgewarsScriptLoad("/Scripts/Locale.lua")
     1 HedgewarsScriptLoad("/Scripts/Locale.lua")
     2 HedgewarsScriptLoad("/Scripts/Utils.lua")
     2 HedgewarsScriptLoad("/Scripts/Utils.lua")
       
     3 HedgewarsScriptLoad("/Scripts/Params.lua")
     3 
     4 
     4 local hTag = nil
     5 local hTag = nil
     5 local hTagHeight = 33000
     6 local hTagHeight = 33000
     6 local tTag = nil
     7 local tTag = nil
     7 local rTag = nil
     8 local rTag = nil
    23 local YouLost = false
    24 local YouLost = false
    24 local HogsAreInvulnerable = false
    25 local HogsAreInvulnerable = false
    25 local WaterRise = nil
    26 local WaterRise = nil
    26 local Cake = nil
    27 local Cake = nil
    27 local CakeTries = 0
    28 local CakeTries = 0
       
    29 local addCake = true
    28 local Stars = {}
    30 local Stars = {}
    29 local tauntNoo = false
    31 local tauntNoo = false
    30 local jokeAwardNavy = nil
    32 local jokeAwardNavy = nil
    31 local jokeAwardSpeed = nil
    33 local jokeAwardSpeed = nil
    32 local jokeAwardDamage = nil
    34 local jokeAwardDamage = nil
    34 local ready = false
    36 local ready = false
    35 local showWaterStats = false -- uses the AI team to draw water height.
    37 local showWaterStats = false -- uses the AI team to draw water height.
    36 local scaleGraph = false
    38 local scaleGraph = false
    37 local dummyHog = nil
    39 local dummyHog = nil
    38 local dummySkip = 0
    40 local dummySkip = 0
       
    41 local baseWaterSpeed = 2
       
    42 local waterSpeed = 0
       
    43 local waterAccel = 0
       
    44 local delayHeight = 32000
       
    45 local delayTime = 0
       
    46 
       
    47 function onParameters()
       
    48     parseParams()
       
    49 
       
    50     baseWaterSpeed = params["speed"]
       
    51     waterAccel = params["accel"]
       
    52     if waterAccel ~= 0 then waterAccel = div(32640000,waterAccel) end
       
    53     delayTime = params["delaytime"]
       
    54     delayHeight = 32768-params["delayheight"]
       
    55     if params["nocake"] ~= nil then addCake = false end
       
    56 end
    39 
    57 
    40 function onGameInit()
    58 function onGameInit()
    41     -- Ensure people get same map for same theme
    59     -- Ensure people get same map for same theme
    42     TurnTime = 999999999
    60     TurnTime = 999999999
    43     CaseFreq = 0
    61     CaseFreq = 0
   235             Cake = nil
   253             Cake = nil
   236         end
   254         end
   237     end
   255     end
   238 
   256 
   239     if CurrentHedgehog ~= nil and TurnTimeLeft > 0 and band(GetState(CurrentHedgehog),gstHHDriven) ~= 0 then
   257     if CurrentHedgehog ~= nil and TurnTimeLeft > 0 and band(GetState(CurrentHedgehog),gstHHDriven) ~= 0 then
   240         if MaxHeight < 32000 and MaxHeight > 286 and WaterLine > 286  then SetWaterLine(WaterLine-2) end
   258         if MaxHeight < delayHeight and
       
   259            TurnTimeLeft<(999999999-delayTime) and 
       
   260             MaxHeight > 286 and WaterLine > 286 then
       
   261             if waterAccel ~= 0 then
       
   262                 SetWaterLine(WaterLine-(baseWaterSpeed+div(getActualHeight(MaxHeight)*100,waterAccel)))
       
   263             else
       
   264                 SetWaterLine(WaterLine-baseWaterSpeed)
       
   265             end
       
   266         end
   241         if y > 0 and y < 30000 and MaxHeight > 286 and math.random(y) < 500 then
   267         if y > 0 and y < 30000 and MaxHeight > 286 and math.random(y) < 500 then
   242             local s = AddVisualGear(0, 0, vgtStraightShot, 0, true)
   268             local s = AddVisualGear(0, 0, vgtStraightShot, 0, true)
   243             local c = div(250000,y)
   269             local c = div(250000,y)
   244             if c > 255 then c = 255 end
   270             if c > 255 then c = 255 end
   245             c = c * 0x10000 + 0xFF0000FF
   271             c = c * 0x10000 + 0xFF0000FF
   369                         tauntNoo = true
   395                         tauntNoo = true
   370                     end
   396                     end
   371                 end
   397                 end
   372             end
   398             end
   373 
   399 
   374             if CakeTries < 10 and y < 32600 and y > 3000 and Cake == nil and band(GetState(CurrentHedgehog),gstHHDriven) ~= 0 then 
   400             if addCake and CakeTries < 10 and y < 32600 and y > 3000 and Cake == nil and band(GetState(CurrentHedgehog),gstHHDriven) ~= 0 then 
   375                 -- doing this just after the start the first time to take advantage of randomness sources
   401                 -- doing this just after the start the first time to take advantage of randomness sources
   376                 -- Pick a clear y to start with
   402                 -- Pick a clear y to start with
   377                 if y > 31000 then cy = 24585 elseif
   403                 if y > 31000 then cy = 24585 elseif
   378                    y > 28000 then cy = 21500 elseif
   404                    y > 28000 then cy = 21500 elseif
   379                    y > 24000 then cy = 19000 elseif
   405                    y > 24000 then cy = 19000 elseif