share/hedgewars/Data/Scripts/Multiplayer/Racer.lua
changeset 10228 947cadb40bc5
parent 10227 0b848d595f22
child 10289 c3a77ff02a23
equal deleted inserted replaced
10227:0b848d595f22 10228:947cadb40bc5
   134 local wpActive = {}
   134 local wpActive = {}
   135 local wpRad = 450 --75
   135 local wpRad = 450 --75
   136 local wpCount = 0
   136 local wpCount = 0
   137 local wpLimit = 8
   137 local wpLimit = 8
   138 
   138 
       
   139 local usedWeapons = {}
       
   140 
   139 local roundN
   141 local roundN
   140 local lastRound
   142 local lastRound
   141 local RoundHasChanged
   143 local RoundHasChanged
   142 
   144 
   143 -------------------
   145 -------------------
   716                 cGear = nil
   718                 cGear = nil
   717         end
   719         end
   718 
   720 
   719 end
   721 end
   720 
   722 
       
   723 function onAttack()
       
   724     at = GetCurAmmoType()
       
   725     
       
   726     usedWeapons[at] = 0
       
   727 end
   721 
   728 
   722 function onAchievementsDeclaration()
   729 function onAchievementsDeclaration()
       
   730     usedWeapons[amSkip] = nil
       
   731     
       
   732     usedRope = usedWeapons[amRope] ~= nil
       
   733     usedPortal = usedWeapons[amPortalGun] ~= nil
       
   734     usedSaucer = usedWeapons[amJetpack] ~= nil
       
   735     
       
   736     usedWeapons[amRope] = nil
       
   737     usedWeapons[amPortalGun] = nil
       
   738     usedWeapons[amJetpack] = nil
       
   739 
       
   740     usedOther = next(usedWeapons) ~= nil
       
   741 
       
   742     if usedOther then -- smth besides skip, rope, portal or saucer used
       
   743         raceType = "unknown race"
       
   744     elseif usedRope and not usedPortal and not usedSaucer then
       
   745         raceType = "rope race"
       
   746     elseif not usedRope and usedPortal and not usedSaucer then
       
   747         raceType = "portal race"
       
   748     elseif not usedRope and not usedPortal and usedSaucer then
       
   749         raceType = "saucer race"
       
   750     elseif (usedRope or usedPortal or usedSaucer or usedOther) == false then -- no weapons used at all?
       
   751         raceType = "no tools race"
       
   752     else -- at least two of rope, portal and saucer used
       
   753         raceType = "mixed race"
       
   754     end
       
   755 
   723     map = detectMap()
   756     map = detectMap()
   724     
   757     
   725     for i = 0, (numTeams-1) do
   758     for i = 0, (numTeams-1) do
   726         if teamScore[i] < 100000 then
   759         if teamScore[i] < 100000 then
   727             DeclareAchievement("rope race", teamNameArr[i], map, teamScore[i])
   760             DeclareAchievement(raceType, teamNameArr[i], map, teamScore[i])
   728         end
   761         end
   729     end
   762     end
   730 end
   763 end