share/hedgewars/Data/Scripts/Multiplayer/TechRacer.lua
changeset 13563 af92481415ef
parent 13359 f9a15dcd857c
child 13564 3c562f52609c
equal deleted inserted replaced
13560:43b72629d453 13563:af92481415ef
   708 
   708 
   709 
   709 
   710 
   710 
   711 function HandleFreshMapCreation()
   711 function HandleFreshMapCreation()
   712 
   712 
       
   713 	if activationStage ~= 1 then
       
   714 		return
       
   715 	end
       
   716 
   713 	-- the boom stage, boom girders, reset ammo, and delete other map objects
   717 	-- the boom stage, boom girders, reset ammo, and delete other map objects
   714 	if activationStage == 1 then
   718 	ClearMap()
   715 
       
   716 		ClearMap()
       
   717 		activationStage = activationStage + 1
       
   718 
   719 
   719 	-- the creation stage, place girders and needed gears, grant ammo
   720 	-- the creation stage, place girders and needed gears, grant ammo
   720 	elseif activationStage == 2 then
   721 	InterpretPoints()
   721 
   722 
   722 		InterpretPoints()
   723 	-- these are from onParameters()
   723 
   724 	if (mapID == nil) or (mapID == 0) then
   724 		-- these are from onParameters()
   725 		LoadMap(2000)
   725 		if (mapID == nil) or (mapID == 0) then
   726 	else
   726 			LoadMap(2000)
   727 		LoadMap(mapID)
   727 		else
   728 	end
   728 			LoadMap(mapID)
   729 
       
   730 	if gameOver then
       
   731 		for i = 0,(wpCount-1) do
       
   732 			SetVisualGearValues(wpCirc[wpCount], wpX[wpCount], wpY[wpCount], 164, 224, 1, 10, 0, wpRad, 5, wpCol[wpCount])
   729 		end
   733 		end
   730 
   734 
   731                 if gameOver then
   735         else
   732 		        for i = 0,(wpCount-1) do
   736 		for i = 0,(wpCount-1) do
   733                                 SetVisualGearValues(wpCirc[wpCount], wpX[wpCount], wpY[wpCount], 164, 224, 1, 10, 0, wpRad, 5, wpCol[wpCount])
   737 			DeleteVisualGear(wpCirc[i])
   734                         end
       
   735 
       
   736                 else
       
   737 		        for i = 0,(wpCount-1) do
       
   738 		        	DeleteVisualGear(wpCirc[i])
       
   739 		        end
       
   740 		        wpCount = 0
       
   741 
       
   742 		        for i = 1, techCount-1 do
       
   743 			        CallBob(techX[i],techY[i])
       
   744 		        end
       
   745                 end
       
   746 
       
   747 		activationStage = 200
       
   748 		--runOnHogs(RestoreHog)
       
   749 
       
   750 		if ufoFuel == 2000 then
       
   751 			SetAmmoDescriptionAppendix(amJetpack, loc("On this map you get infinite fuel."))
       
   752 		elseif ufoFuel ~= nil and ufoFuel ~= 0 then
       
   753 			SetAmmoDescriptionAppendix(amJetpack, string.format(loc("On this map you get %d%% fuel."), div(ufoFuel, 20)))
       
   754 		end
   738 		end
   755 
   739 		wpCount = 0
   756 	end
   740 
       
   741 		for i = 1, techCount-1 do
       
   742 			CallBob(techX[i],techY[i])
       
   743 		end
       
   744 	end
       
   745 
       
   746 	if ufoFuel == 2000 then
       
   747 		SetAmmoDescriptionAppendix(amJetpack, loc("On this map you get infinite fuel."))
       
   748 	elseif ufoFuel ~= nil and ufoFuel ~= 0 then
       
   749 		SetAmmoDescriptionAppendix(amJetpack, string.format(loc("On this map you get %d%% fuel."), div(ufoFuel, 20)))
       
   750 	end
       
   751 
       
   752 	activationStage = 200
   757 
   753 
   758 end
   754 end
   759 
   755 
   760 function TryRepositionHogs()
   756 function TryRepositionHogs()
   761 
   757 
  1052                                 "", 4, 4000
  1048                                 "", 4, 4000
  1053                                 )
  1049                                 )
  1054 
  1050 
  1055         TryRepositionHogs()
  1051         TryRepositionHogs()
  1056 
  1052 
  1057 		activationStage = 2
  1053 		activationStage = 1
  1058 		HandleFreshMapCreation()
  1054 		HandleFreshMapCreation()
  1059 
  1055 
  1060 end
  1056 end
  1061 
  1057 
  1062 
  1058 
  1156         end
  1152         end
  1157         SetGearPosition(cGear, -10000, 0)
  1153         SetGearPosition(cGear, -10000, 0)
  1158         end
  1154         end
  1159 
  1155 
  1160 
  1156 
  1161 	if activationStage < 10 then
  1157 	if activationStage < 200 then
  1162 		HandleFreshMapCreation()
  1158 		HandleFreshMapCreation()
  1163 
  1159 
  1164                 if not gameOver and gameBegun and not racerActive then
  1160                 if not gameOver and gameBegun and not racerActive then
  1165 			if cameraGear then
  1161 			if cameraGear then
  1166 				DeleteGear(cameraGear)
  1162 				DeleteGear(cameraGear)
  1180 
  1176 
  1181                 if (TurnTimeLeft > 0) and (TurnTimeLeft ~= TurnTime) then
  1177                 if (TurnTimeLeft > 0) and (TurnTimeLeft ~= TurnTime) then
  1182 
  1178 
  1183                         -- if the gamehas started put the player in the middle of the first
  1179                         -- if the gamehas started put the player in the middle of the first
  1184                         --waypoint that was placed
  1180                         --waypoint that was placed
  1185                         --if activationStage == 200 then
  1181                         if gameBegun == true then
  1186 						if gameBegun == true then
       
  1187                                 AddCaption(loc("Good to go!"))
  1182                                 AddCaption(loc("Good to go!"))
  1188                                 racerActive = true
  1183                                 racerActive = true
  1189                                 trackTime = 0
  1184                                 trackTime = 0
  1190 
  1185 
  1191 
  1186