share/hedgewars/Data/Maps/ClimbHome/map.lua
changeset 12826 42003e235a46
parent 12825 b986a8b8cd56
child 12827 b7453ae2c44d
equal deleted inserted replaced
12825:b986a8b8cd56 12826:42003e235a46
   110 
   110 
   111 function onGearDelete(gear)
   111 function onGearDelete(gear)
   112     if gear == MrMine then
   112     if gear == MrMine then
   113         AddCaption(loc("Once you set off the proximity trigger, Mr. Mine is not your friend"), 0xFFFFFFFF, capgrpMessage)
   113         AddCaption(loc("Once you set off the proximity trigger, Mr. Mine is not your friend"), 0xFFFFFFFF, capgrpMessage)
   114         MrMine = nil
   114         MrMine = nil
   115     elseif gear == Cake then
   115     elseif GetGearType(gear) == Cake then
   116         Cake = nil
   116         Cake = nil
   117     elseif GetGearType(gear) == gtHedgehog then
   117     elseif GetGearType(gear) == gtHedgehog then
   118 	onGameTick20()
   118 	onGameTick20()
   119 	onGearDamage(gear, 0)
   119 	onGearDamage(gear, 0)
   120         HH[gear] = nil
   120         HH[gear] = nil
   310 
   310 
   311     if CurrentHedgehog ~= nil then
   311     if CurrentHedgehog ~= nil then
   312         x,y = GetGearPosition(CurrentHedgehog)
   312         x,y = GetGearPosition(CurrentHedgehog)
   313         if Cake ~= nil then
   313         if Cake ~= nil then
   314             local cx,cy = GetGearPosition(Cake)
   314             local cx,cy = GetGearPosition(Cake)
   315             if y < cy-1500 then
   315             if y < cy-1500 then DeleteGear(Cake) end
   316                 DeleteGear(Cake)
   316 
   317                 Cake = nil
   317             if Cake ~= nil and GetHealth(Cake) < 999980 and gearIsInCircle(CurrentHedgehog,cx,cy,450) then
   318             end
       
   319 
       
   320             if GetHealth(Cake) < 999980 and gearIsInCircle(CurrentHedgehog,cx,cy,450) then
       
   321                 FireBoom(cx,cy,200) -- todo animate
   318                 FireBoom(cx,cy,200) -- todo animate
   322                 DeleteGear(Cake)
   319                 DeleteGear(Cake)
   323                 Cake = nil
   320             end
       
   321         end
       
   322         if band(GetState(CurrentHedgehog),gstHHDriven) == 0 then
       
   323             for f,i in pairs(Fire) do -- takes too long to fall otherwise
       
   324                 DeleteGear(f)
       
   325             end
       
   326             if Cake ~= nil then
       
   327                 DeleteGear(Cake)
   324             end
   328             end
   325         end
   329         end
   326      end
   330      end
   327     
   331     
   328     if CurrentHedgehog ~= nil and band(GetState(CurrentHedgehog),gstHHDriven) == 0 then
       
   329         for f,i in pairs(Fire) do -- takes too long to fall otherwise
       
   330             DeleteGear(f)
       
   331         end
       
   332         if Cake ~= nil then
       
   333             DeleteGear(Cake)
       
   334             Cake = nil
       
   335         end
       
   336     end
       
   337 
   332 
   338     if CurrentHedgehog ~= nil and TurnTimeLeft > 0 and band(GetState(CurrentHedgehog),gstHHDriven) ~= 0 then
   333     if CurrentHedgehog ~= nil and TurnTimeLeft > 0 and band(GetState(CurrentHedgehog),gstHHDriven) ~= 0 then
   339         if MaxHeight < delayHeight and
   334         if MaxHeight < delayHeight and
   340            TurnTimeLeft<(999999999-delayTime) and 
   335            TurnTimeLeft<(999999999-delayTime) and 
   341             MaxHeight > 286 and WaterLine > 286 then
   336             MaxHeight > 286 and WaterLine > 286 then
   486                         tauntNoo = true
   481                         tauntNoo = true
   487                     end
   482                     end
   488                 end
   483                 end
   489             end
   484             end
   490 
   485 
   491             if addCake and CakeTries < 10 and y < 32600 and y > 3000 and Cake == nil and band(GetState(CurrentHedgehog),gstHHDriven) ~= 0 then 
   486             if addCake and CakeTries < 10 and y < 32600 and y > 3000 and Cake == nil then 
   492                 -- doing this just after the start the first time to take advantage of randomness sources
   487                 -- doing this just after the start the first time to take advantage of randomness sources
   493                 -- Pick a clear y to start with
   488                 -- Pick a clear y to start with
   494                 if y > 31000 then cy = 24585 elseif
   489                 if y > 31000 then cy = 24585 elseif
   495                    y > 28000 then cy = 21500 elseif
   490                    y > 28000 then cy = 21500 elseif
   496                    y > 24000 then cy = 19000 elseif
   491                    y > 24000 then cy = 19000 elseif