share/hedgewars/Data/Maps/ClimbHome/map.lua
changeset 10824 acbbd49f8274
parent 10812 38dc8445d7a7
child 11067 c632b47b8ff0
equal deleted inserted replaced
10822:def423815f24 10824:acbbd49f8274
    41 local baseWaterSpeed = 2
    41 local baseWaterSpeed = 2
    42 local waterSpeed = 0
    42 local waterSpeed = 0
    43 local waterAccel = 0
    43 local waterAccel = 0
    44 local delayHeight = 32000
    44 local delayHeight = 32000
    45 local delayTime = 0
    45 local delayTime = 0
       
    46 local airMineX = {}
       
    47 local airMineY = {}
       
    48 local airMine = {}
       
    49 local init = true
    46 
    50 
    47 function onParameters()
    51 function onParameters()
    48     parseParams()
    52     parseParams()
    49 
    53 
    50     if params["speed"] ~= nil then
    54     if params["speed"] ~= nil then
    94 function onGearAdd(gear)
    98 function onGearAdd(gear)
    95     if GetGearType(gear) == gtHedgehog then
    99     if GetGearType(gear) == gtHedgehog then
    96         HH[gear] = 1
   100         HH[gear] = 1
    97         totalHedgehogs = totalHedgehogs + 1
   101         totalHedgehogs = totalHedgehogs + 1
    98         teams[GetHogTeamName(gear)] = 1
   102         teams[GetHogTeamName(gear)] = 1
       
   103     elseif init and GetGearType(gear) == gtAirMine then
       
   104         airMine[gear] = 1
    99     end
   105     end
   100 end
   106 end
   101 
   107 
   102 function onGearDelete(gear)
   108 function onGearDelete(gear)
   103     if gear == MrMine then
   109     if gear == MrMine then
   142 function onAmmoStoreInit()
   148 function onAmmoStoreInit()
   143     SetAmmo(amRope, 9, 0, 0, 0)
   149     SetAmmo(amRope, 9, 0, 0, 0)
   144 end
   150 end
   145 
   151 
   146 function onNewTurn()
   152 function onNewTurn()
       
   153     if init then
       
   154         init = false
       
   155         for a,i in pairs(airMine) do
       
   156             x,y = GetGearPosition(a)
       
   157             airMineX[a] = x
       
   158             airMineY[a] = y
       
   159         end
       
   160     else
       
   161         for a,i in pairs(airMine) do
       
   162             local x,y = GetGearPosition(a)
       
   163             if not x or airMineX[a] ~= x or airMineY[a] ~= y then
       
   164                 DeleteGear(a)
       
   165                 AddGear(airMineX[a],airMineY[a], gtAirMine, gsttmpFlag, 0, 0, 0)
       
   166             end
       
   167         end
       
   168     end
       
   169         
   147     ready = false
   170     ready = false
   148     startTime = GameTime
   171     startTime = GameTime
   149     --disable to preserve highest over multiple turns
   172     --disable to preserve highest over multiple turns
   150     --will need to change water check too ofc
   173     --will need to change water check too ofc
   151     MaxHeight = 32640
   174     MaxHeight = 32640
   218     end
   241     end
   219 end
   242 end
   220 
   243 
   221 
   244 
   222 function onGameTick20()
   245 function onGameTick20()
   223     local x,y;
   246     local x,y
   224     if math.random(20) == 1 then AddVisualGear(2012,56,vgtSmoke,0,false) end
   247     if math.random(20) == 1 then AddVisualGear(2012,56,vgtSmoke,0,false) end
   225     if CurrentHedgehog == dummyHog and dummySkip ~= 0 and dummySkip < GameTime then
   248     if CurrentHedgehog == dummyHog and dummySkip ~= 0 and dummySkip < GameTime then
   226         ParseCommand("/skip")
   249         ParseCommand("/skip")
   227         dummySkip = 0
   250         dummySkip = 0
   228     end
   251     end