share/hedgewars/Data/Scripts/Multiplayer/WxW.lua
changeset 14770 0ee6b01c7f30
parent 13982 681a53c8b18c
child 14771 97a36fb44123
equal deleted inserted replaced
14769:dd4daa216398 14770:0ee6b01c7f30
   846 		setGearValue(crate, "frozen", false)
   846 		setGearValue(crate, "frozen", false)
   847 	end
   847 	end
   848 
   848 
   849 end
   849 end
   850 
   850 
       
   851 function onCaseDrop()
       
   852 	if roundN == 100 then
       
   853 		allowCrate = crateGearsInGame < maxCrates
       
   854 		CheckCrateConditions()
       
   855 	end
       
   856 end
       
   857 
   851 function CheckCrateConditions()
   858 function CheckCrateConditions()
   852 
   859 
   853 	local crateSpawn = AreCratesUnlocked()
   860 	local crateSpawn = AreCratesUnlocked()
   854 
   861 
   855 	if crateSpawn == true and crateSpawned == false then
   862 	if crateSpawn == true and crateSpawned == false then
   933 end
   940 end
   934 
   941 
   935 
   942 
   936 function HandleBorderEffects()
   943 function HandleBorderEffects()
   937 
   944 
       
   945 	if band(GetState(CurrentHedgehog), gstHHDriven) == 0 then
       
   946 		return
       
   947 	end
   938 	effectTimer = effectTimer + 1
   948 	effectTimer = effectTimer + 1
   939 	if effectTimer > 15 then --25
   949 	if effectTimer > 15 then --25
   940 
   950 
   941 		effectTimer = 1
   951 		effectTimer = 1
   942 
   952 
  1267 			FinalizeMenu()
  1277 			FinalizeMenu()
  1268 		end
  1278 		end
  1269 	end
  1279 	end
  1270 end
  1280 end
  1271 
  1281 
       
  1282 function onEndTurn()
       
  1283 	crateSpawned = false
       
  1284 	crateCollected = false
       
  1285 	wallsLeft = #wTouched
       
  1286 	for i = 1, #wTouched do
       
  1287 		wTouched[i] = false
       
  1288 	end
       
  1289 	hasSurfed = false
       
  1290 	allWallsHit = false
       
  1291 end
       
  1292 
  1272 function onNewTurn()
  1293 function onNewTurn()
  1273 	turnsCount = turnsCount + 1
  1294 	turnsCount = turnsCount + 1
  1274 
  1295 
  1275 	if roundN == 0 then
  1296 	if roundN == 0 then
  1276 		roundN = 1
  1297 		roundN = 1
  1288 				roundN = 100
  1309 				roundN = 100
  1289 			end
  1310 			end
  1290 		end
  1311 		end
  1291 	end
  1312 	end
  1292 
  1313 
  1293 	wallsLeft = #wTouched
       
  1294 
       
  1295 	for i = 1, #wTouched do
       
  1296 		wTouched[i] = false
       
  1297 	end
       
  1298 
       
  1299 	hasSurfed = false
       
  1300 	allWallsHit = false
       
  1301 	crateCollected = false
       
  1302 
       
  1303 	crateSpawned = false
       
  1304 
       
  1305 	if roundN == 100 then
  1314 	if roundN == 100 then
  1306 		allowCrate = crateGearsInGame < maxCrates
       
  1307 
  1315 
  1308 		local teamName = GetHogTeamName(CurrentHedgehog)
  1316 		local teamName = GetHogTeamName(CurrentHedgehog)
  1309 
  1317 
  1310 		-- Restore team's radar mode
  1318 		-- Restore team's radar mode
  1311 		radarMode = getTeamValue(teamName, "radarMode")
  1319 		radarMode = getTeamValue(teamName, "radarMode")
  1330 			AddCaption(string.format(loc("%s must skip this turn for rule violation."), teamName), msgColorWarn, capgrpMessage)
  1338 			AddCaption(string.format(loc("%s must skip this turn for rule violation."), teamName), msgColorWarn, capgrpMessage)
  1331 			EndTurn(true)
  1339 			EndTurn(true)
  1332 			setTeamValue(teamName, "skipPenalty", false)
  1340 			setTeamValue(teamName, "skipPenalty", false)
  1333 		end
  1341 		end
  1334 
  1342 
  1335 	else
       
  1336 		allowCrate = false
       
  1337 	end
  1343 	end
  1338 
  1344 
  1339 	if roundN == 1 then
  1345 	if roundN == 1 then
  1340 		SetTurnTimeLeft(MAX_TURN_TIME)
  1346 		SetTurnTimeLeft(MAX_TURN_TIME)
  1341 		SetInputMask(0)
  1347 		SetInputMask(0)
  1572 		if gTimer == 25 then
  1578 		if gTimer == 25 then
  1573 			gTimer = 1
  1579 			gTimer = 1
  1574 
  1580 
  1575 			if roundN == 100 then
  1581 			if roundN == 100 then
  1576 				CheckForWallCollision()
  1582 				CheckForWallCollision()
  1577 				CheckCrateConditions()
  1583 				if band(GetState(CurrentHedgehog), gstHHDriven) ~= 0 then
       
  1584 					CheckCrateConditions()
       
  1585 				end
  1578 
  1586 
  1579 				if (GetGearType(GetFollowGear()) == gtCase) then
  1587 				if (GetGearType(GetFollowGear()) == gtCase) then
  1580 					FollowGear(CurrentHedgehog)
  1588 					FollowGear(CurrentHedgehog)
  1581 				end
  1589 				end
  1582 				
  1590