share/hedgewars/Data/Scripts/Multiplayer/TechRacer.lua
changeset 11932 f1c7dba0f316
parent 11591 7c9243584a72
child 11933 20b755da986f
equal deleted inserted replaced
11931:a01a890093f3 11932:f1c7dba0f316
   331                                 if wpActive[k] == false then
   331                                 if wpActive[k] == false then
   332                                         wpRem = wpRem + 1
   332                                         wpRem = wpRem + 1
   333                                 end
   333                                 end
   334                         end
   334                         end
   335 
   335 
   336                         AddCaption(loc("Way-Points Remaining") .. ": " .. wpRem,0xffba00ff,capgrpAmmoinfo)
   336                         AddCaption(string.format(loc("Waypoints remaining: %d"), wpRem),0xffba00ff,capgrpAmmoinfo)
   337 
   337 
   338                 end
   338                 end
   339 
   339 
   340                 if wpActive[i] == false then
   340                 if wpActive[i] == false then
   341                         trackFinished = false
   341                         trackFinished = false
   384                 bestTimeComment = (bestTime/1000) ..loc("s")
   384                 bestTimeComment = (bestTime/1000) ..loc("s")
   385         end
   385         end
   386 
   386 
   387         if newScore == true then
   387         if newScore == true then
   388                 if trackTime == bestTime then -- best time of the race
   388                 if trackTime == bestTime then -- best time of the race
   389                         ShowMission(loc("RACER"),
   389                         ShowMission(loc("TechRacer"),
   390                         loc("TRACK COMPLETED"),
   390                         loc("Track completed!"),
   391                         loc("NEW RACE RECORD: ") .. (trackTime/1000) ..loc("s") .. "|" ..
   391                         string.format(loc("New race record: %.1fs"), (trackTime/1000)) .. "|" ..
   392                         loc("WINNING TIME: ") .. bestTimeComment, 0, 4000)
   392                         string.format(loc("Winning time: %s") .. bestTimeComment), 0, 4000)
   393                         PlaySound(sndHomerun)
   393                         PlaySound(sndHomerun)
   394                 else    -- best time for the clan
   394                 else    -- best time for the clan
   395                         ShowMission(loc("RACER"),
   395                         ShowMission(loc("TechRacer"),
   396                         loc("TRACK COMPLETED"),
   396                         loc("Track completed!"),
   397                         loc("NEW CLAN RECORD: ") .. (trackTime/1000) ..loc("s") .. "|" ..
   397                         string.format(loc("New clan record: %.1fs"), (trackTime/1000)) .. "|" ..
   398                         loc("WINNING TIME: ") .. bestTimeComment, 4, 4000)
   398                         string.format(loc("Winning time: %s"), bestTimeComment), 4, 4000)
   399                 end
   399                 end
   400         else -- not any kind of new score
   400         else -- not any kind of new score
   401                 ShowMission(loc("RACER"),
   401                 ShowMission(loc("TechRacer"),
   402                 loc("TRACK COMPLETED"),
   402                 loc("Track completed!"),
   403                 loc("TIME: ") .. (trackTime/1000) ..loc("s") .. "|" ..
   403                 string.format(loc("Time: %.1fs"), (trackTime/1000)) .. "|" ..
   404                 loc("WINNING TIME: ") .. bestTimeComment, -amSkip, 4000)
   404                 string.format(loc("Winning time: %s"), bestTimeComment), -amSkip, 4000)
   405                 PlaySound(sndHellish)
   405                 PlaySound(sndHellish)
   406         end
   406         end
   407 
   407 
   408 
   408 
   409         --------
   409         --------
   445                         elseif teamNameArr[i] == " " then
   445                         elseif teamNameArr[i] == " " then
   446                                 teamComment[i] = "|"
   446                                 teamComment[i] = "|"
   447                         end
   447                         end
   448         end
   448         end
   449 
   449 
   450         ShowMission(    loc("RACER"),
   450         ShowMission(    loc("TechRacer"),
   451                                         loc("STATUS UPDATE"),
   451                                         loc("Status update"),
   452                                         loc("Rounds Complete: ") .. roundNumber .. "/" .. roundLimit .. "|" .. " " .. "|" ..
   452                                         string.format(loc("Rounds complete: %d/%d"), roundNumber, roundLimit) .. "|" .. " " .. "|" ..
   453                                         loc("Best Team Times: ") .. "|" .. totalComment, 0, 4000)
   453                                         loc("Best team times: ") .. "|" .. totalComment, 0, 4000)
   454 
   454 
   455         -- end game if its at round limit
   455         -- end game if its at round limit
   456         if roundNumber >= roundLimit then
   456         if roundNumber >= roundLimit then
   457                 for i = 0, (numhhs-1) do
   457                 for i = 0, (numhhs-1) do
   458                         if GetHogClan(hhs[i]) ~= bestClan then
   458                         if GetHogClan(hhs[i]) ~= bestClan then
   924 			cnthhs = 0
   924 			cnthhs = 0
   925 			runOnHogsInTeam(limitHogs, teamNameArr[i])
   925 			runOnHogsInTeam(limitHogs, teamNameArr[i])
   926 		end
   926 		end
   927 
   927 
   928         ShowMission     (
   928         ShowMission     (
   929                                 loc("RACER"),
   929                                 loc("TechRacer"),
   930                                 loc("a Hedgewars mini-game"),
   930                                 loc("A Hedgewars mini-game"),
   931 
   931 
   932                                 loc("Build a track and race.") .. "|" ..
   932                         	loc("Complete the track as fast as you can!") .. "|" ..
   933                                 loc("Round Limit:") .. " " .. roundLimit .. "|" ..
   933                                 loc("Round limit:") .. " " .. roundLimit .. "|" ..
   934 								loc("You can further customize the race by changing the scheme script paramater.") .. "|" ..
   934 				loc("You can further customize the race by changing the scheme script paramater.") .. "|" ..
   935 								--loc("For example, the below line would play map 4, with infinite fuel for the flying saucer, and four rounds.") .. "|" ..
   935 								--loc("For example, the below line would play map 4, with infinite fuel for the flying saucer, and four rounds.") .. "|" ..
   936 								--"m=4, ufo=true, rounds=4" .. "|" ..
   936 								--"m=4, ufo=true, rounds=4" .. "|" ..
   937 
   937 
   938                                 "", 4, 4000
   938                                 "", 4, 4000
   939                                 )
   939                                 )
   980                -- if wpCount >= 3 then
   980                -- if wpCount >= 3 then
   981                         gameBegun = true
   981                         gameBegun = true
   982 						--  --[[activationStage = 200]]
   982 						--  --[[activationStage = 200]]
   983                         roundNumber = 0
   983                         roundNumber = 0
   984                         firstClan = GetHogClan(CurrentHedgehog)
   984                         firstClan = GetHogClan(CurrentHedgehog)
   985                         ShowMission(loc("RACER"),
       
   986                         loc("GAME BEGUN!!!"),
       
   987                         loc("Complete the track as fast as you can!"), 2, 4000)
       
   988                 --else
   985                 --else
   989                 --        ShowMission(loc("RACER"),
   986                 --        ShowMission(loc("RACER"),
   990                 --        loc("NOT ENOUGH WAYPOINTS"),
   987                 --        loc("NOT ENOUGH WAYPOINTS"),
   991                 --        loc("Place more waypoints using the 'Air Attack' weapon."), 2, 4000)
   988                 --        loc("Place more waypoints using the 'Air Attack' weapon."), 2, 4000)
   992                 --        AddAmmo(CurrentHedgehog, amAirAttack, 4000)
   989                 --        AddAmmo(CurrentHedgehog, amAirAttack, 4000)
  1023         if x > -9000 then
  1020         if x > -9000 then
  1024             x,y = GetGearTarget(cGear)
  1021             x,y = GetGearTarget(cGear)
  1025 
  1022 
  1026 
  1023 
  1027             if TestRectForObstacle(x-20, y-20, x+20, y+20, true) then
  1024             if TestRectForObstacle(x-20, y-20, x+20, y+20, true) then
  1028                 AddCaption(loc("Please place the way-point in the open, within the map boundaries."))
  1025                 AddCaption(loc("Please place the waypoint in the air and within the map boundaries"))
  1029                 PlaySound(sndDenied)
  1026                 PlaySound(sndDenied)
  1030             elseif (y > WaterLine-50) then
  1027             elseif (y > WaterLine-50) then
  1031                 AddCaption(loc("Please place the way-point further from the waterline."))
  1028                 AddCaption(loc("Please place the waypoint further away from the waterline"))
  1032                 PlaySound(sndDenied)
  1029                 PlaySound(sndDenied)
  1033             else
  1030             else
  1034                 CallBob(x, y)
  1031                 CallBob(x, y)
  1035                 if wpCount == wpLimit then
  1032                 if wpCount == wpLimit then
  1036                     AddCaption(loc("Race complexity limit reached."))
  1033                     AddCaption(loc("Race complexity limit reached"))
  1037                     DisableTumbler()
  1034                     DisableTumbler()
  1038                 end
  1035                 end
  1039             end
  1036             end
  1040         else
  1037         else
  1041             DeleteGear(cGear)
  1038             DeleteGear(cGear)
  1102 
  1099 
  1103                         trackTime = trackTime + 20
  1100                         trackTime = trackTime + 20
  1104 
  1101 
  1105                         if GameTime%100 == 0 then
  1102                         if GameTime%100 == 0 then
  1106 
  1103 
  1107                 if trackTime%1000 == 0 then
  1104                 		AddCaption(string.format(loc("Time: %.1fs"), (trackTime/1000)), GetClanColor(GetHogClan(CurrentHedgehog)),capgrpMessage2)
  1108                     AddCaption((trackTime/1000)..'.0',GetClanColor(GetHogClan(CurrentHedgehog)),capgrpMessage2)
       
  1109                 else
       
  1110                     AddCaption(trackTime/1000,GetClanColor(GetHogClan(CurrentHedgehog)),capgrpMessage2)
       
  1111                 end
       
  1112 
  1105 
  1113                                 if (CheckWaypoints() == true) then
  1106                                 if (CheckWaypoints() == true) then
  1114                                         AdjustScores()
  1107                                         AdjustScores()
  1115                                         DisableTumbler()
  1108                                         DisableTumbler()
  1116                                 end
  1109                                 end
  1186 function onGearResurrect(gear)
  1179 function onGearResurrect(gear)
  1187 
  1180 
  1188         AddVisualGear(GetX(gear), GetY(gear), vgtBigExplosion, 0, false)
  1181         AddVisualGear(GetX(gear), GetY(gear), vgtBigExplosion, 0, false)
  1189 
  1182 
  1190         if gear == CurrentHedgehog then
  1183         if gear == CurrentHedgehog then
       
  1184                 AddCaption(loc("Race failed!"), GetClanColor(GetHogClan(gear)), capgrpMessage2)
  1191                 DisableTumbler()
  1185                 DisableTumbler()
  1192         end
  1186         end
  1193 
  1187 
  1194 end
  1188 end
  1195 
  1189