share/hedgewars/Data/Maps/TrophyRace/map.lua
changeset 4503 a8ab151bcae3
parent 4350 cdb3d7a39fa2
child 4506 37744d5c877e
equal deleted inserted replaced
4502:759c1a3bb156 4503:a8ab151bcae3
       
     1 loadfile(GetDataPath() .. "Scripts/Locale.lua")()
       
     2 
     1 -- Hedgewars - Roperace for 2+ Players
     3 -- Hedgewars - Roperace for 2+ Players
     2 
       
     3 local caption = {
       
     4 	["en"] = "TrophyRace",
       
     5 	["sv"] = "TrophyRace",
       
     6 	["pt_PT"] = "TrophyRace",
       
     7 	["pl"] = "TrophyRace",
       
     8 	["es"] = "TrophyRace",
       
     9 	["pt_BR"] = "TrophyRace",
       
    10 	["sk"] = "Preteky o trofej"
       
    11 	}
       
    12 
       
    13 local goal = {
       
    14 	["en"] = "Use your rope to get from start to finish as fast as you can!",
       
    15 	["sv"] = "Använd ditt rep för att ta dig från start till mål så fort som möjligt!",
       
    16 	["pt_PT"] = "Utilizando a corda, percorre o percurso do inicio ao fim o mais rápido que conseguires!",
       
    17 	["pl"] = "Użyj liny by jak najszybciej dotrzec od startu do mety",
       
    18 	["es"] = "¡Usa tu cuerda para llegar a la salida lo más rápido que puedas!",
       
    19 	["pt_BR"] = "Use sua corda para ir do início ao fim o mais rápido que você puder!",
       
    20 	["sk"] = "Použite lano na presun zo štartovnej pozície do cieľa tak rýchlo, ako to len viete!"
       
    21 	}
       
    22 
       
    23 local done = {
       
    24 	["en"] = "You've reached the goal!| |Time: ",
       
    25 	["sv"] = "Du har nått målet!| |Tid: ",
       
    26 	["pt_PT"] = "Chegaste ao fim!| |Tempo: ",
       
    27 	["pl"] = "Dotarłeś do celu!| |Czas: ",
       
    28 	["es"] = "¡Has llegado a la meta!| |Tiempo: ",
       
    29 	["pt_BR"] = "Você alcançou o objetivo!| |Tempo: ",
       
    30 	["sk"] = "Dosiahli ste cieľ!| |Čas: "
       
    31 	}
       
    32 
       
    33 local eliminated = {
       
    34 	["en"] = "Eliminating worst hedgehog this round...| |%s is OUT!",
       
    35 	["sv"] = "Eliminerar sämsta igelkott den här rundan...| |%s är UTE!",
       
    36 	["pt_PT"] = "A eliminar o pior ouriço da ronda...| |% está FORA!",
       
    37 	["pl"] = "Eliminujemy najgorszego jeża tej rundy...| |%s ODPADŁ!",
       
    38 	["es"] = "Eliminando al peor erizo de esta ronda...| |¡%s está FUERA!",
       
    39 	["pt_BR"] = "Eliminando o ouriço mais lento...| |%s vai para o chuveiro!",
       
    40 	["sk"] = "Eliminujem najhoršieho ježka tohto kola...| |%s je mimo hru!"
       
    41 	}
       
    42 
       
    43 local newbesttime = {
       
    44 	["en"] = "NEW fastest lap: ",
       
    45 	["sv"] = "NYTT snabbast varv: ",
       
    46 	["pt_PT"] = "NOVA volta recorde: ",
       
    47 	["pl"] = "NOWE najszybsze okrążenie: ",
       
    48 	["es"] = "NUEVA vuelta rápida: ",
       
    49 	["pt_BR"] = "NOVA volta mais rápida: ",
       
    50 	["sk"] = "NOVÉ najrýchlejšie kolo: "
       
    51 	}
       
    52 
       
    53 local oldbesttime = {
       
    54 	["en"] = "Fastest lap: ",
       
    55 	["sv"] = "Snabbast varv: ",
       
    56 	["pt_PT"] = "Volta mais rápida: ",
       
    57 	["pl"] = "Najszybsze okrążenie: ",
       
    58 	["es"] = "Vuelta rápida: ",
       
    59 	["pt_BR"] = "Volta mais rápida: ",
       
    60 	["sk"] = "Najrýchlejšie kolo: "
       
    61 	}
       
    62 
       
    63 local bestclantimes = {
       
    64 	["en"] = "Best laps per team: ",
       
    65 	["sv"] = "Bästa varv per lag: ",
       
    66 	["pt_PT"] = "Melhores voltas por equipa: ",
       
    67 	["pl"] = "Najszybsze okrążenie drużyny: ",
       
    68 	["es"] = "Mejores tiempos por equipo: ",
       
    69 	["pt_BR"] = "Melhor volta por equipe: ",
       
    70 	["sk"] = "Najrýchlejšie kolá podľa tímov: "
       
    71 	}
       
    72 
       
    73 local clantime = {
       
    74 	["en"] = "Team %d: ",
       
    75 	["sv"] = "Lag %d: ",
       
    76 	["pt_PT"] = "Equipa %d: ",
       
    77 	["pl"] = "Drużyna %d: ",
       
    78 	["es"] = "Equipo %d",
       
    79 	["pt_BR"] = "Equipe %d: ",
       
    80 	["sk"] = "Tím %d: "
       
    81 	}
       
    82 
       
    83 local function loc(text)
       
    84 	if text == nil then return "**missing**"
       
    85 	elseif text[L] == nil then return text["en"]
       
    86 	else return text[L]
       
    87 	end
       
    88 end
       
    89 
       
    90 ---------------------------------------------------------------
       
    91 
     4 
    92 -- store number of hedgehogs
     5 -- store number of hedgehogs
    93 local numhhs = 0
     6 local numhhs = 0
    94 
     7 
    95 -- store hedgehog gears
     8 -- store hedgehog gears
   138 	SuddenDeathTurns = 99999 -- "disable" sudden death
    51 	SuddenDeathTurns = 99999 -- "disable" sudden death
   139 	Theme = 'Olympics'
    52 	Theme = 'Olympics'
   140 end
    53 end
   141 
    54 
   142 function onGameStart()
    55 function onGameStart()
   143 	ShowMission(loc(caption), "", loc(goal), -amRope, 0)
    56 	ShowMission(loc("TrophyRace"), "", loc("Use your rope to get from start to finish as fast as you can!"), -amRope, 0)
   144 	started = true
    57 	started = true
   145 	p=1820
    58 	p=1820
   146 	for i = 0, numhhs - 1 do
    59 	for i = 0, numhhs - 1 do
   147 	p = p + 50	
    60 	p = p + 50	
   148 	SetGearPosition(hhs[i], p, 0)
    61 	SetGearPosition(hhs[i], p, 0)
   194 			end
   107 			end
   195 			
   108 			
   196 			if ttime < besttime then
   109 			if ttime < besttime then
   197 				besttime = ttime
   110 				besttime = ttime
   198 				besthog = CurrentHedgehog
   111 				besthog = CurrentHedgehog
   199 				hscore = hscore .. loc(newbesttime)
   112 				hscore = hscore .. loc("NEW fastest lap: ")
   200 			else
   113 			else
   201 				hscore = hscore .. loc(oldbesttime)
   114 				hscore = hscore .. loc("Fastest lap: ")
   202 			end
   115 			end
   203 			if ttime > worsttime then
   116 			if ttime > worsttime then
   204 				worsttime = ttime
   117 				worsttime = ttime
   205 				worsthog = CurrentHedgehog
   118 				worsthog = CurrentHedgehog
   206 			end
   119 			end
   207 			hscore = hscore .. GetHogName(besthog) .. " - " .. (besttime / 1000) .. " s | |" .. loc(bestclantimes)
   120 			hscore = hscore .. GetHogName(besthog) .. " - " .. (besttime / 1000) .. " s | |" .. loc("Best laps per team: ")
   208 			
   121 			
   209 			if clan == ClansCount -1 then
   122 			if clan == ClansCount -1 then
   210 				-- Time for elimination - worst hog is out and the worst hog vars are reset.
   123 				-- Time for elimination - worst hog is out and the worst hog vars are reset.
   211 				SetHealth(worsthog, 0)
   124 				SetHealth(worsthog, 0)
   212 				--Place a grenade to make inactive slowest hog active
   125 				--Place a grenade to make inactive slowest hog active
   219 			for i=0, ClansCount -1 do
   132 			for i=0, ClansCount -1 do
   220 				local tt = "" .. (clantimes[i] / 1000) .. " s"
   133 				local tt = "" .. (clantimes[i] / 1000) .. " s"
   221 				if clantimes[i] == 0 then
   134 				if clantimes[i] == 0 then
   222 					tt = "--"
   135 					tt = "--"
   223 				end
   136 				end
   224 				hscore = hscore .. "|" .. string.format(loc(clantime), i+1) .. tt
   137 				hscore = hscore .. "|" .. string.format(loc("Team %d: "), i+1) .. tt
   225 			end
   138 			end
   226 			
   139 			
   227 			ShowMission(loc(caption), "", loc(done) .. (ttime / 1000) .. " s" .. hscore, 0, 0)
   140 			ShowMission(loc("TrophyRace"), "", loc("You've reached the goal!| |Time: ") .. (ttime / 1000) .. " s" .. hscore, 0, 0)
   228 			TurnTimeLeft = 0
   141 			TurnTimeLeft = 0
   229 		end
   142 		end
   230 	end
   143 	end
   231 end
   144 end
   232 
   145