share/hedgewars/Data/Scripts/Multiplayer/Racer.lua
changeset 15398 09b63f9032f4
parent 15397 b186e1f4c5ed
child 15399 4b792051c159
equal deleted inserted replaced
15397:b186e1f4c5ed 15398:09b63f9032f4
    59 
    59 
    60 local waypointCursor = false
    60 local waypointCursor = false
    61 local waypointPreview = nil
    61 local waypointPreview = nil
    62 
    62 
    63 local officialChallenge
    63 local officialChallenge
       
    64 
       
    65 local ammoDelays = {}
    64 
    66 
    65 --------------------------
    67 --------------------------
    66 -- hog and team tracking variales
    68 -- hog and team tracking variales
    67 --------------------------
    69 --------------------------
    68 
    70 
   609         CaseFreq = 0
   611         CaseFreq = 0
   610         TurnTime = 90000
   612         TurnTime = 90000
   611         WaterRise = 0
   613         WaterRise = 0
   612         HealthDecrease = 0
   614         HealthDecrease = 0
   613 
   615 
       
   616 	-- Remember ammo delays for later
       
   617         for a=0, AmmoTypeMax do
       
   618                 local _, _, delay = GetAmmo(a)
       
   619                 ammoDelays[a] = delay
       
   620         end
   614 end
   621 end
   615 
   622 
   616 function InstructionsBuild()
   623 function InstructionsBuild()
   617         ShowMission(
   624         ShowMission(
   618                 loc("Racer"),
   625                 loc("Racer"),
   777                         firstClan = GetHogClan(CurrentHedgehog)
   784                         firstClan = GetHogClan(CurrentHedgehog)
   778                         if specialPointsCount == 0 then
   785                         if specialPointsCount == 0 then
   779                                 InstructionsRace()
   786                                 InstructionsRace()
   780                         end
   787                         end
   781 
   788 
       
   789                         -- Restore old ammo delays
       
   790                         for a=0, AmmoTypeMax do
       
   791                                 if a ~= amAirAttack and a ~= amSkip then
       
   792                                         SetAmmoDelay(a, ammoDelays[a])
       
   793                                 end
       
   794                         end
       
   795 
   782                         SetAmmoTexts(amSkip, nil, nil, nil)
   796                         SetAmmoTexts(amSkip, nil, nil, nil)
   783                 else
   797                 else
   784                         local infoString
   798                         local infoString
   785                         if wpLimit > 2 then
   799                         if wpLimit > 2 then
   786                                 infoString = string.format(loc("Place 2-%d waypoints using the waypoint placement tool."), wpLimit)
   800                                 infoString = string.format(loc("Place 2-%d waypoints using the waypoint placement tool."), wpLimit)
   788                                 infoString = loc("Place 2 waypoints using the waypoint placement tool.")
   802                                 infoString = loc("Place 2 waypoints using the waypoint placement tool.")
   789                         end
   803                         end
   790                         ShowMission(loc("Racer"),
   804                         ShowMission(loc("Racer"),
   791                         loc("Waypoint placement phase"), infoString, -amAirAttack, 4000)
   805                         loc("Waypoint placement phase"), infoString, -amAirAttack, 4000)
   792                         AddAmmo(CurrentHedgehog, amAirAttack, AMMO_INFINITE)
   806                         AddAmmo(CurrentHedgehog, amAirAttack, AMMO_INFINITE)
       
   807                         for a=0, AmmoTypeMax do
       
   808                                 if a ~= amAirAttack and a ~= amSkip then
       
   809                                         SetAmmoDelay(a, 9999)
       
   810                                 end
       
   811                         end
   793                         SetWeapon(amAirAttack)
   812                         SetWeapon(amAirAttack)
   794                         -- Bots skip waypoint placement
   813                         -- Bots skip waypoint placement
   795                         if GetHogLevel(CurrentHedgehog) ~= 0 then
   814                         if GetHogLevel(CurrentHedgehog) ~= 0 then
   796                                 SkipTurn()
   815                                 SkipTurn()
   797                         end
   816                         end