changeset 12411 | cd53f1bf52ff |
parent 12393 | 0eb1457f7b94 |
child 12412 | 8cc070640fd1 |
12410:e6ec081b7fe0 | 12411:cd53f1bf52ff |
---|---|
470 SendStat(siCustomAchievement, unfinishedArray[i]) |
470 SendStat(siCustomAchievement, unfinishedArray[i]) |
471 end |
471 end |
472 else |
472 else |
473 SendStat(siGameResult, loc("Round draw")) |
473 SendStat(siGameResult, loc("Round draw")) |
474 SendStat(siCustomAchievement, loc("Nobody managed to finish the race. What a shame!")) |
474 SendStat(siCustomAchievement, loc("Nobody managed to finish the race. What a shame!")) |
475 SendStat(siCustomAchievement, loc("Maybe you should try easier waypoints next time.")) |
475 if specialPointsCount > 0 then |
476 SendStat(siCustomAchievement, loc("Maybe you should try an easier map next time.")) |
|
477 else |
|
478 SendStat(siCustomAchievement, loc("Maybe you should try easier waypoints next time.")) |
|
479 end |
|
476 end |
480 end |
477 |
481 |
478 -- Kill all the losers |
482 -- Kill all the losers |
479 for i = 0, (numhhs-1) do |
483 for i = 0, (numhhs-1) do |
480 if GetHogClan(hhs[i]) ~= bestClan then |
484 if GetHogClan(hhs[i]) ~= bestClan then |
555 WaterRise = 0 |
559 WaterRise = 0 |
556 HealthDecrease = 0 |
560 HealthDecrease = 0 |
557 |
561 |
558 end |
562 end |
559 |
563 |
564 function InstructionsBuild() |
|
565 ShowMission( |
|
566 loc("Racer"), |
|
567 loc("A Hedgewars mini-game"), |
|
568 loc("Build a track and race.") .. "|" .. |
|
569 string.format(loc("Round limit: %d"), roundLimit), |
|
570 4, 4000) |
|
571 end |
|
572 |
|
573 function InstructionsRace(time) |
|
574 ShowMission(loc("Racer"), |
|
575 loc("A Hedgewars mini-game"), |
|
576 loc("Touch all waypoints as fast as you can!"), |
|
577 2, time) |
|
578 end |
|
560 |
579 |
561 function onGameStart() |
580 function onGameStart() |
562 SendGameResultOff() |
581 SendGameResultOff() |
563 SendRankingStatsOff() |
582 SendRankingStatsOff() |
564 SendHealthStatsOff() |
583 SendHealthStatsOff() |
567 roundN = 0 |
586 roundN = 0 |
568 lastRound = TotalRounds |
587 lastRound = TotalRounds |
569 RoundHasChanged = false |
588 RoundHasChanged = false |
570 |
589 |
571 for i = 0, (specialPointsCount-1) do |
590 for i = 0, (specialPointsCount-1) do |
572 PlaceWayPoint(specialPointsX[i], specialPointsY[i]) |
591 PlaceWayPoint(specialPointsX[i], specialPointsY[i], false) |
573 end |
592 end |
574 |
593 |
575 RebuildTeamInfo() |
594 RebuildTeamInfo() |
576 |
595 |
577 ShowMission ( |
596 if specialPointsCount > 0 then |
578 loc("Racer"), |
597 InstructionsRace() |
579 loc("A Hedgewars mini-game"), |
598 else |
580 |
599 InstructionsBuild() |
581 loc("Build a track and race.") .. "|" .. |
600 end |
582 string.format(loc("Round limit: %d"), roundLimit) .. "|" .. |
|
583 |
|
584 "", 4, 4000 |
|
585 ) |
|
586 |
601 |
587 SetAmmoTexts(amAirAttack, loc("Place waypoint"), loc("Racer tool"), |
602 SetAmmoTexts(amAirAttack, loc("Place waypoint"), loc("Racer tool"), |
588 loc("Build an awesome race track by placing|waypoints which the hedgehogs have to|touch in any order to finish a round.") .. "|" .. |
603 loc("Build an awesome race track by placing|waypoints which the hedgehogs have to|touch in any order to finish a round.") .. "|" .. |
589 loc("Hedgehogs will start in the first waypoint.") .. "|" .. |
604 loc("Hedgehogs will start in the first waypoint.") .. "|" .. |
590 loc("Cursor: Place waypoint") .. "|" .. |
605 loc("Cursor: Place waypoint") .. "|" .. |
597 |
612 |
598 TryRepositionHogs() |
613 TryRepositionHogs() |
599 |
614 |
600 end |
615 end |
601 |
616 |
602 function PlaceWayPoint(x,y) |
617 function PlaceWayPoint(x,y,placedByUser) |
603 if not racerActive then |
618 if not racerActive then |
604 if wpCount == 0 or wpX[wpCount - 1] ~= x or wpY[wpCount - 1] ~= y then |
619 if wpCount == 0 or wpX[wpCount - 1] ~= x or wpY[wpCount - 1] ~= y then |
605 |
620 |
606 wpX[wpCount] = x |
621 wpX[wpCount] = x |
607 wpY[wpCount] = y |
622 wpY[wpCount] = y |
614 |
629 |
615 SetVisualGearValues(wpCirc[wpCount], wpX[wpCount], wpY[wpCount], 20, 100, 1, 10, 0, wpRad, 5, wpCol[wpCount]) |
630 SetVisualGearValues(wpCirc[wpCount], wpX[wpCount], wpY[wpCount], 20, 100, 1, 10, 0, wpRad, 5, wpCol[wpCount]) |
616 |
631 |
617 wpCount = wpCount + 1 |
632 wpCount = wpCount + 1 |
618 |
633 |
619 AddCaption(string.format(loc("Waypoint placed. Available points remaining: %d"), wpLimit-wpCount)) |
634 if placedByUser then |
635 AddCaption(string.format(loc("Waypoint placed. Available points remaining: %d"), wpLimit-wpCount)) |
|
636 end |
|
620 end |
637 end |
621 end |
638 end |
622 end |
639 end |
623 |
640 |
624 function onPrecise() |
641 function onPrecise() |
681 if (gameOver == false) and (gameBegun == false) then |
698 if (gameOver == false) and (gameBegun == false) then |
682 if wpCount >= 2 then |
699 if wpCount >= 2 then |
683 gameBegun = true |
700 gameBegun = true |
684 roundNumber = 0 |
701 roundNumber = 0 |
685 firstClan = GetHogClan(CurrentHedgehog) |
702 firstClan = GetHogClan(CurrentHedgehog) |
686 ShowMission(loc("Racer"), |
703 if specialPointsCount == 0 then |
687 loc("A Hedgewars mini-game"), |
704 InstructionsRace() |
688 loc("Touch all waypoints as fast as you can!"), 2, 4000) |
705 end |
689 |
706 |
690 SetAmmoTexts(amSkip, nil, nil, nil) |
707 SetAmmoTexts(amSkip, nil, nil, nil) |
691 else |
708 else |
692 local infoString |
709 local infoString |
693 if wpLimit > 2 then |
710 if wpLimit > 2 then |
729 PlaySound(sndDenied) |
746 PlaySound(sndDenied) |
730 elseif (y > WaterLine-50) then |
747 elseif (y > WaterLine-50) then |
731 AddCaption(loc("Please place the waypoint further away from the waterline")) |
748 AddCaption(loc("Please place the waypoint further away from the waterline")) |
732 PlaySound(sndDenied) |
749 PlaySound(sndDenied) |
733 else |
750 else |
734 PlaceWayPoint(x, y) |
751 PlaceWayPoint(x, y, true) |
735 if wpCount == wpLimit then |
752 if wpCount == wpLimit then |
736 AddCaption(loc("Race complexity limit reached")) |
753 AddCaption(loc("Race complexity limit reached")) |
737 EndTurn(true) |
754 EndTurn(true) |
738 end |
755 end |
739 end |
756 end |