share/hedgewars/Data/Scripts/Multiplayer/TechRacer.lua
changeset 12964 a5c5fe878a4e
parent 12963 544c4302efe4
child 12966 b543d767fed3
equal deleted inserted replaced
12963:544c4302efe4 12964:a5c5fe878a4e
   322                 --      AddCaption(dist .. "/" .. (wpRad*wpRad) )
   322                 --      AddCaption(dist .. "/" .. (wpRad*wpRad) )
   323                 --end
   323                 --end
   324 
   324 
   325                 NR = (48/100*wpRad)/2
   325                 NR = (48/100*wpRad)/2
   326 
   326 
   327                 if dist < (NR*NR) then
   327                 if dist < (NR*NR) and not gameOver then
   328                 --if dist < (wpRad*wpRad) then
   328                 --if dist < (wpRad*wpRad) then
   329                         --AddCaption("howdy")
   329                         --AddCaption("howdy")
   330                         wpCol[i] = GetClanColor(GetHogClan(CurrentHedgehog)) -- new                             --GetClanColor(1)
   330                         wpCol[i] = GetClanColor(GetHogClan(CurrentHedgehog)) -- new                             --GetClanColor(1)
   331                         SetVisualGearValues(wpCirc[i], wpX[i], wpY[i], 64, 64, 1, 10, 0, wpRad, 5, wpCol[i])
   331                         SetVisualGearValues(wpCirc[i], wpX[i], wpY[i], 64, 64, 1, 10, 0, wpRad, 5, wpCol[i])
   332 
   332 
   507 				SetHealth(hhs[i],0)
   507 				SetHealth(hhs[i],0)
   508 			end
   508 			end
   509 		end
   509 		end
   510 
   510 
   511 		gameOver = true
   511 		gameOver = true
       
   512                 for i=0, wpCount-1 do
       
   513                          -- Fade out waypoints
       
   514                          SetVisualGearValues(wpCirc[i], nil, nil, 0, 0, nil, 6)
       
   515                 end
   512 		EndTurn(true)
   516 		EndTurn(true)
   513         end
   517         end
   514 
   518 
   515 end
   519 end
   516 
   520 
   576                 fastIndex = 0
   580                 fastIndex = 0
   577                 racerActive = false -- newadd
   581                 racerActive = false -- newadd
   578                 if endTurn then
   582                 if endTurn then
   579                          EndTurn(true)
   583                          EndTurn(true)
   580                 end
   584                 end
   581 		if trackFinished then
   585 		if trackFinished and not gameOver then
   582                          for i=0, wpCount-1 do
   586                          for i=0, wpCount-1 do
   583                        	         SetVisualGearValues(wpCirc[i], nil, nil, 255, 255, nil, 2)
   587                        	         SetVisualGearValues(wpCirc[i], nil, nil, 255, 255, nil, 2)
   584                          end
   588                          end
   585                 else
   589                 elseif not gameOver then
   586                          for i=0, wpCount-1 do
   590                          for i=0, wpCount-1 do
   587                        	         SetVisualGearValues(wpCirc[i], nil, nil, 32, 32, nil, 1)
   591                        	         SetVisualGearValues(wpCirc[i], nil, nil, 32, 32, nil, 1)
   588                          end
   592                          end
   589                 end
   593                 end
   590         end
   594         end
   658 	runOnGears(RemoveGear)
   662 	runOnGears(RemoveGear)
   659 
   663 
   660 end
   664 end
   661 
   665 
   662 function CallBob(x,y)
   666 function CallBob(x,y)
   663 	if not racerActive then
   667 	if not racerActive and not gameOver then
   664         if wpCount == 0 or wpX[wpCount - 1] ~= x or wpY[wpCount - 1] ~= y then
   668         if wpCount == 0 or wpX[wpCount - 1] ~= x or wpY[wpCount - 1] ~= y then
   665 
   669 
   666             wpX[wpCount] = x
   670             wpX[wpCount] = x
   667             wpY[wpCount] = y
   671             wpY[wpCount] = y
   668             wpCol[wpCount] = 0xffffffff
   672             wpCol[wpCount] = 0xffffffff
   697 			LoadMap(2000)
   701 			LoadMap(2000)
   698 		else
   702 		else
   699 			LoadMap(mapID)
   703 			LoadMap(mapID)
   700 		end
   704 		end
   701 
   705 
   702 		for i = 0,(wpCount-1) do
   706                 if gameOver then
   703 			DeleteVisualGear(wpCirc[i])
   707 		        for i = 0,(wpCount-1) do
   704 		end
   708                                 SetVisualGearValues(wpCirc[wpCount], wpX[wpCount], wpY[wpCount], 164, 224, 1, 10, 0, wpRad, 5, wpCol[wpCount])
   705 		wpCount = 0
   709                         end
   706 
   710 
   707 		for i = 1, techCount-1 do
   711                 else
   708 			CallBob(techX[i],techY[i])
   712 		        for i = 0,(wpCount-1) do
   709 		end
   713 		        	DeleteVisualGear(wpCirc[i])
       
   714 		        end
       
   715 		        wpCount = 0
       
   716 
       
   717 		        for i = 1, techCount-1 do
       
   718 			        CallBob(techX[i],techY[i])
       
   719 		        end
       
   720                 end
   710 
   721 
   711 		activationStage = 200
   722 		activationStage = 200
   712 		--runOnHogs(RestoreHog)
   723 		--runOnHogs(RestoreHog)
   713 
   724 
   714 		if ufoFuel == 2000 then
   725 		if ufoFuel == 2000 then
  1039         currCount = 0 -- hopefully this solves problem
  1050         currCount = 0 -- hopefully this solves problem
  1040     --    AddAmmo(CurrentHedgehog, amAirAttack, 0)
  1051     --    AddAmmo(CurrentHedgehog, amAirAttack, 0)
  1041         gTimer = 0
  1052         gTimer = 0
  1042 
  1053 
  1043         -- Set the waypoints to unactive on new round
  1054         -- Set the waypoints to unactive on new round
  1044         for i = 0,(wpCount-1) do
  1055         if not gameOver then
  1045                 wpActive[i] = false
  1056                 for i = 0,(wpCount-1) do
  1046                 wpCol[i] = 0xffffffff
  1057                         wpActive[i] = false
  1047                 SetVisualGearValues(wpCirc[i], wpX[i], wpY[i], 164, 224, 1, 10, 0, wpRad, 5, wpCol[i])
  1058                         wpCol[i] = 0xffffffff
       
  1059                         SetVisualGearValues(wpCirc[i], wpX[i], wpY[i], 164, 224, 1, 10, 0, wpRad, 5, wpCol[i])
       
  1060                 end
  1048         end
  1061         end
  1049 
  1062 
  1050         -- Handle Starting Stage of Game
  1063         -- Handle Starting Stage of Game
  1051         if (gameOver == false) and (gameBegun == false) then
  1064         if (gameOver == false) and (gameBegun == false) then
  1052                -- if wpCount >= 3 then
  1065                -- if wpCount >= 3 then