share/hedgewars/Data/Scripts/Multiplayer/Racer.lua
branch0.9.22
changeset 12406 7342f5020691
parent 12372 3e4044f959a9
equal deleted inserted replaced
12405:c7d73e5840c8 12406:7342f5020691
    92 
    92 
    93 local fastX = {}
    93 local fastX = {}
    94 local fastY = {}
    94 local fastY = {}
    95 local fastCount = 0
    95 local fastCount = 0
    96 local fastIndex = 0
    96 local fastIndex = 0
    97 local fastColour
    97 local fastColour = 0xffffffff
    98 
    98 
    99 local currX = {}
    99 local currX = {}
   100 local currY = {}
   100 local currY = {}
   101 local currCount = 0
   101 local currCount = 0
   102 
   102 
   538 
   538 
   539             wpX[wpCount] = x
   539             wpX[wpCount] = x
   540             wpY[wpCount] = y
   540             wpY[wpCount] = y
   541             wpCol[wpCount] = 0xffffffff
   541             wpCol[wpCount] = 0xffffffff
   542             wpCirc[wpCount] = AddVisualGear(wpX[wpCount],wpY[wpCount],vgtCircle,0,true)
   542             wpCirc[wpCount] = AddVisualGear(wpX[wpCount],wpY[wpCount],vgtCircle,0,true)
   543                                                                                                                                             
   543 
   544             SetVisualGearValues(wpCirc[wpCount], wpX[wpCount], wpY[wpCount], 20, 100, 1, 10, 0, wpRad, 5, wpCol[wpCount])
   544             SetVisualGearValues(wpCirc[wpCount], wpX[wpCount], wpY[wpCount], 20, 100, 1, 10, 0, wpRad, 5, wpCol[wpCount])
   545 
   545 
   546             wpCount = wpCount + 1
   546             wpCount = wpCount + 1
   547 
   547 
   548             AddCaption(loc("Waypoint placed.") .. " " .. loc("Available points remaining: ") .. (wpLimit-wpCount))
   548             AddCaption(loc("Waypoint placed.") .. " " .. loc("Available points remaining: ") .. (wpLimit-wpCount))
   549         end
   549         end
   550     end
   550     end
   551 end
   551 end
   552 
   552 
   553 function onSpecialPoint(x,y,flag)
   553 function onSpecialPoint(x,y,flag)
   554     specialPointsX[specialPointsCount] = x
   554     if flag == 99 then
   555     specialPointsY[specialPointsCount] = y
   555         fastX[fastCount] = x
   556     specialPointsCount = specialPointsCount + 1
   556         fastY[fastCount] = y
       
   557         fastCount = fastCount + 1
       
   558     else
       
   559         addHashData(x)
       
   560         addHashData(y)
       
   561         addHashData(flag)
       
   562         specialPointsX[specialPointsCount] = x
       
   563         specialPointsY[specialPointsCount] = y
       
   564         specialPointsCount = specialPointsCount + 1
       
   565     end
   557 end
   566 end
   558 
   567 
   559 function onNewTurn()
   568 function onNewTurn()
   560 
   569 
   561         CheckForNewRound()
   570         CheckForNewRound()
   741 
   750 
   742 end
   751 end
   743 
   752 
   744 function onAttack()
   753 function onAttack()
   745     at = GetCurAmmoType()
   754     at = GetCurAmmoType()
   746     
   755 
   747     usedWeapons[at] = 0
   756     usedWeapons[at] = 0
   748 end
   757 end
   749 
   758 
   750 function onAchievementsDeclaration()
   759 function onAchievementsDeclaration()
   751     usedWeapons[amSkip] = nil
   760     usedWeapons[amSkip] = nil
   752     
   761     usedWeapons[amExtraTime] = nil
       
   762 
   753     usedRope = usedWeapons[amRope] ~= nil
   763     usedRope = usedWeapons[amRope] ~= nil
   754     usedPortal = usedWeapons[amPortalGun] ~= nil
   764     usedPortal = usedWeapons[amPortalGun] ~= nil
   755     usedSaucer = usedWeapons[amJetpack] ~= nil
   765     usedSaucer = usedWeapons[amJetpack] ~= nil
   756     
   766 
   757     usedWeapons[amNothing] = nil
   767     usedWeapons[amNothing] = nil
   758     usedWeapons[amRope] = nil
   768     usedWeapons[amRope] = nil
   759     usedWeapons[amPortalGun] = nil
   769     usedWeapons[amPortalGun] = nil
   760     usedWeapons[amJetpack] = nil
   770     usedWeapons[amJetpack] = nil
   761 
   771 
   773         raceType = "no tools race"
   783         raceType = "no tools race"
   774     else -- at least two of rope, portal and saucer used
   784     else -- at least two of rope, portal and saucer used
   775         raceType = "mixed race"
   785         raceType = "mixed race"
   776     end
   786     end
   777 
   787 
   778     map = detectMap()
   788     map = detectMapWithDigest()
   779     
   789 
   780     for i = 0, (numTeams-1) do
   790     for i = 0, (numTeams-1) do
   781         if teamScore[i] < 100000 then
   791         if teamScore[i] < 100000 then
   782             DeclareAchievement(raceType, teamNameArr[i], map, teamScore[i])
   792             DeclareAchievement(raceType, teamNameArr[i], map, teamScore[i])
   783         end
   793         end
   784     end
   794     end