share/hedgewars/Data/Scripts/Multiplayer/Racer.lua
changeset 7142 8842fa26698b
parent 7139 a47fd17ba463
child 7838 5c2337f8dbb2
equal deleted inserted replaced
7141:ea6ad9a97fca 7142:8842fa26698b
   532 		else
   532 		else
   533 			ShowMission(loc("RACER"),
   533 			ShowMission(loc("RACER"),
   534 			loc("NOT ENOUGH WAYPOINTS"),
   534 			loc("NOT ENOUGH WAYPOINTS"),
   535 			loc("Place more waypoints using the 'Air Attack' weapon."), 2, 4000)
   535 			loc("Place more waypoints using the 'Air Attack' weapon."), 2, 4000)
   536 			AddAmmo(CurrentHedgehog, amAirAttack, 4000)
   536 			AddAmmo(CurrentHedgehog, amAirAttack, 4000)
       
   537             ParseCommand("setweap " .. string.char(amAirAttack))
   537 		end
   538 		end
   538 	end
   539 	end
   539 
   540 
   540 	if gameOver == true then
   541 	if gameOver == true then
   541 		gameBegun = false
   542 		gameBegun = false
   552 
   553 
   553 function onGameTick20()
   554 function onGameTick20()
   554 
   555 
   555 	-- airstrike detected, convert this into a potential waypoint spot
   556 	-- airstrike detected, convert this into a potential waypoint spot
   556 	if cGear ~= nil then
   557 	if cGear ~= nil then
   557 		x,y = GetGearTarget(cGear)
   558 		x,y = GetGearPosition(cGear)
   558 
   559         if x > -9000 then
   559 		DeleteGear(cGear)
   560             x,y = GetGearTarget(cGear)
   560 
   561 
   561 		if TestRectForObstacle(x-20, y-20, x+20, y+20, true) then
   562 
   562 			AddCaption(loc("Please place the way-point in the open, within the map boundaries."))
   563             if TestRectForObstacle(x-20, y-20, x+20, y+20, true) then
   563 			PlaySound(sndDenied)
   564                 AddCaption(loc("Please place the way-point in the open, within the map boundaries."))
   564 		elseif (y > WaterLine-50) then
   565                 PlaySound(sndDenied)
   565 			AddCaption(loc("Please place the way-point further from the waterline."))
   566             elseif (y > WaterLine-50) then
   566 			PlaySound(sndDenied)
   567                 AddCaption(loc("Please place the way-point further from the waterline."))
   567 		else
   568                 PlaySound(sndDenied)
   568 			PlaceWayPoint(x, y)
   569             else
   569 			if wpCount == wpLimit then
   570                 PlaceWayPoint(x, y)
   570 				AddCaption(loc("Race complexity limit reached."))
   571                 if wpCount == wpLimit then
   571 				DisableTumbler()
   572                     AddCaption(loc("Race complexity limit reached."))
   572 			end
   573                     DisableTumbler()
   573 		end
   574                 end
   574 
   575             end
       
   576         else
       
   577             DeleteGear(cGear)
       
   578         end
       
   579         SetGearPosition(cGear, -10000, 0)
   575 	end
   580 	end
   576 
   581 
   577 
   582 
   578 	-- start the player tumbling with a boom once their turn has actually begun
   583 	-- start the player tumbling with a boom once their turn has actually begun
   579 	if racerActive == false then
   584 	if racerActive == false then
   616 			end
   621 			end
   617 
   622 
   618 			trackTime = trackTime + 20
   623 			trackTime = trackTime + 20
   619 
   624 
   620 			if GameTime%100 == 0 then
   625 			if GameTime%100 == 0 then
   621 
   626                 
   622 				AddCaption(trackTime/1000,GetClanColor(GetHogClan(CurrentHedgehog)),capgrpMessage2)
   627                 if trackTime%1000 == 0 then
       
   628                     AddCaption((trackTime/1000)..'.0',GetClanColor(GetHogClan(CurrentHedgehog)),capgrpMessage2)
       
   629                 else
       
   630                     AddCaption(trackTime/1000,GetClanColor(GetHogClan(CurrentHedgehog)),capgrpMessage2)
       
   631                 end
   623 
   632 
   624 				if (CheckWaypoints() == true) then
   633 				if (CheckWaypoints() == true) then
   625 					AdjustScores()
   634 					AdjustScores()
   626 					racerActive = false
   635 					racerActive = false
   627 					DisableTumbler()
   636 					DisableTumbler()