share/hedgewars/Data/Scripts/Multiplayer/GaudyRacer.lua
changeset 5325 261b79ba22b1
parent 4872 6b2fb9f0054a
equal deleted inserted replaced
5322:1bcc12a30d5d 5325:261b79ba22b1
   303 		bestTimeComment = (bestTime/1000) ..loc("s")
   303 		bestTimeComment = (bestTime/1000) ..loc("s")
   304 	end
   304 	end
   305 
   305 
   306 	if newScore == true then
   306 	if newScore == true then
   307 		if trackTime == bestTime then -- best time of the race
   307 		if trackTime == bestTime then -- best time of the race
   308 			ShowMission(loc("RACER"), loc("TRACK COMPLETED"), loc("NEW RACE RECORD: ") .. (trackTime/1000) ..loc("s") .. "|" .. loc("WINNING TIME: ") .. bestTimeComment, 0, 4000)
   308 			ShowMission("RACER", loc("TRACK COMPLETED"), loc("NEW RACE RECORD: ") .. (trackTime/1000) ..loc("s") .. "|" .. loc("WINNING TIME: ") .. bestTimeComment, 0, 4000)
   309 		else	-- best time for the clan
   309 		else	-- best time for the clan
   310 			ShowMission(loc("RACER"), loc("TRACK COMPLETED"), loc("NEW CLAN RECORD: ") .. (trackTime/1000) ..loc("s") .. "|" .. loc("WINNING TIME: ") .. bestTimeComment, 4, 4000)
   310 			ShowMission("RACER", loc("TRACK COMPLETED"), loc("NEW CLAN RECORD: ") .. (trackTime/1000) ..loc("s") .. "|" .. loc("WINNING TIME: ") .. bestTimeComment, 4, 4000)
   311 		end
   311 		end
   312 	else -- not any kind of new score
   312 	else -- not any kind of new score
   313 		ShowMission(loc("RACER"), loc("TRACK COMPLETED"), loc("TIME: ") .. (trackTime/1000) ..loc("s") .. "|" .. loc("WINNING TIME: ") .. bestTimeComment, -amSkip, 4000)
   313 		ShowMission("RACER", loc("TRACK COMPLETED"), loc("TIME: ") .. (trackTime/1000) ..loc("s") .. "|" .. loc("WINNING TIME: ") .. bestTimeComment, -amSkip, 4000)
   314 	end
   314 	end
   315 
   315 
   316 end
   316 end
   317 
   317 
   318 function CheckForNewRound()
   318 function CheckForNewRound()
   326 					teamComment[i] = teamNameArr[i] .. ": " .. (teamScore[i]/1000) .. loc("s|")
   326 					teamComment[i] = teamNameArr[i] .. ": " .. (teamScore[i]/1000) .. loc("s|")
   327 				elseif teamNameArr[i] == " " then
   327 				elseif teamNameArr[i] == " " then
   328 					teamComment[i] = "|"
   328 					teamComment[i] = "|"
   329 				end
   329 				end
   330 		end
   330 		end
   331 		ShowMission(loc("RACER"), loc("STATUS UPDATE"), loc("Rounds Complete: ") .. roundNumber .. "/" .. roundLimit .. "|" .. " " .. "|" .. loc("Best Team Times: ") .. "|" .. teamComment[0] .. teamComment[1] .. teamComment[2] .. teamComment[3] .. teamComment[4] .. teamComment[5] .. teamComment[6] .. teamComment[7], 0, 1600)
   331 		ShowMission("RACER", loc("STATUS UPDATE"), loc("Rounds Complete") .. ": " .. roundNumber .. "/" .. roundLimit .. "|" .. " " .. "|" .. loc("Best Team Times: ") .. "|" .. teamComment[0] .. teamComment[1] .. teamComment[2] .. teamComment[3] .. teamComment[4] .. teamComment[5] .. teamComment[6] .. teamComment[7], 0, 1600)
   332 
   332 
   333 		-- end game if its at round limit
   333 		-- end game if its at round limit
   334 		if roundNumber == roundLimit then
   334 		if roundNumber == roundLimit then
   335 			for i = 0, (numhhs-1) do
   335 			for i = 0, (numhhs-1) do
   336 				if GetHogClan(hhs[i]) ~= bestClan then
   336 				if GetHogClan(hhs[i]) ~= bestClan then
   366 end
   366 end
   367 
   367 
   368 
   368 
   369 function onGameStart()
   369 function onGameStart()
   370 	RebuildTeamInfo()
   370 	RebuildTeamInfo()
   371 	ShowMission(loc("RACER"), "", "", 4, 4000)
   371 	ShowMission("RACER", "", "", 4, 4000)
   372 end
   372 end
   373 
   373 
   374 function onHJump()
   374 function onHJump()
   375 	if (shotsLeft > 0) and (CurrentHedgehog ~= nil) and (stopMovement == false) and (tumbleStarted == true) then -- seems to not work with a hedgehog nil chek
   375 	if (shotsLeft > 0) and (CurrentHedgehog ~= nil) and (stopMovement == false) and (tumbleStarted == true) then -- seems to not work with a hedgehog nil chek
   376 
   376 
   516 		if wpCount >= 3 then
   516 		if wpCount >= 3 then
   517 			gameBegun = true
   517 			gameBegun = true
   518 			racerActive = true
   518 			racerActive = true
   519 			roundNumber = 0 -- 0
   519 			roundNumber = 0 -- 0
   520 			firstClan = GetHogClan(CurrentHedgehog)
   520 			firstClan = GetHogClan(CurrentHedgehog)
   521 			ShowMission(loc("RACER"), loc("GAME BEGUN!!!"), loc("Complete the track as fast as you can!"), 2, 4000)
   521 			ShowMission("RACER", loc("GAME BEGUN!!!"), loc("Complete the track as fast as you can!"), 2, 4000)
   522 		else
   522 		else
   523 			ShowMission(loc("RACER"), loc("NOT ENOUGH WAYPOINTS"), loc("Place more waypoints using [ENTER]"), 2, 4000)
   523 			ShowMission("RACER", loc("NOT ENOUGH WAYPOINTS"), loc("Place more waypoints using [ENTER]"), 2, 4000)
   524 		end
   524 		end
   525 	end
   525 	end
   526 
   526 
   527 	if gameOver == true then
   527 	if gameOver == true then
   528 		gameBegun = false
   528 		gameBegun = false
   557 	end
   557 	end
   558 
   558 
   559 	-- has the player started his tumbling spree?
   559 	-- has the player started his tumbling spree?
   560 	if (CurrentHedgehog ~= nil) and (tumbleStarted == true) then
   560 	if (CurrentHedgehog ~= nil) and (tumbleStarted == true) then
   561 
   561 
   562 		--AddCaption(loc("Speed: ") .. GetSpeed())
   562 		--AddCaption(LOC_NOT("Speed: ") .. GetSpeed())
   563 
   563 
   564 		-- if the RACE has started, show tracktimes and keep tabs on waypoints
   564 		-- if the RACE has started, show tracktimes and keep tabs on waypoints
   565 		if (racerActive == true) and (gameBegun == true) then
   565 		if (racerActive == true) and (gameBegun == true) then
   566 
   566 
   567 			trackTime = trackTime + 1
   567 			trackTime = trackTime + 1
   599 			TimeLeftCounter = 0
   599 			TimeLeftCounter = 0
   600 			TimeLeft = TimeLeft - 1
   600 			TimeLeft = TimeLeft - 1
   601 
   601 
   602 			if TimeLeft >= 0 then
   602 			if TimeLeft >= 0 then
   603 				--TurnTimeLeft = TimeLeft
   603 				--TurnTimeLeft = TimeLeft
   604 				--AddCaption(loc("Time Left: ") .. TimeLeft)
   604 				--AddCaption(LOC_NOT("Time Left: ") .. TimeLeft)
   605 			end
   605 			end
   606 
   606 
   607 		end
   607 		end
   608 
   608 
   609 		-- if the player has expended his tunbling time, stop him tumbling
   609 		-- if the player has expended his tunbling time, stop him tumbling