share/hedgewars/Data/Scripts/Multiplayer/Tumbler.lua
changeset 5827 a416f1070fdf
parent 5825 a6eab1b7c00d
child 8043 da083f8d95e6
equal deleted inserted replaced
5825:a6eab1b7c00d 5827:a416f1070fdf
   198 ----------------------------------------------------------------
   198 ----------------------------------------------------------------
   199 ----------------------------------------------------------------
   199 ----------------------------------------------------------------
   200 
   200 
   201 function HideTags()
   201 function HideTags()
   202 
   202 
   203 	for i = 0, 3 do 	
   203 	for i = 0, 3 do
   204 		SetVisualGearValues(vTag[i],0,0,0,0,0,1,0, 0, 240000, 0xffffff00)
   204 		SetVisualGearValues(vTag[i],0,0,0,0,0,1,0, 0, 240000, 0xffffff00)
   205 	end
   205 	end
   206 
   206 
   207 end
   207 end
   208 
   208 
   209 function DrawTag(i)
   209 function DrawTag(i)
   210 	
   210 
   211 	zoomL = 1.3
   211 	zoomL = 1.3
   212 
   212 
   213 	xOffset = 40
   213 	xOffset = 40
   214 
   214 
   215 	if i == 0 then
   215 	if i == 0 then
   216 		yOffset = 40	
   216 		yOffset = 40
   217 		tCol = 0xffba00ff --0xffed09ff --0xffba00ff
   217 		tCol = 0xffba00ff --0xffed09ff --0xffba00ff
   218 		tValue = TimeLeft
   218 		tValue = TimeLeft
   219 	elseif i == 1 then
   219 	elseif i == 1 then
   220 		zoomL = 1.1		
   220 		zoomL = 1.1
   221 		yOffset = 70	
   221 		yOffset = 70
   222 		tCol = wepCol[0]
   222 		tCol = wepCol[0]
   223 		tValue = wepAmmo[0]
   223 		tValue = wepAmmo[0]
   224 	elseif i == 2 then
   224 	elseif i == 2 then
   225 		zoomL = 1.1		
   225 		zoomL = 1.1
   226 		xOffset = 40 + 35
   226 		xOffset = 40 + 35
   227 		yOffset = 70		
   227 		yOffset = 70
   228 		tCol = wepCol[1]
   228 		tCol = wepCol[1]
   229 		tValue = wepAmmo[1]
   229 		tValue = wepAmmo[1]
   230 	elseif i == 3 then
   230 	elseif i == 3 then
   231 		zoomL = 1.1		
   231 		zoomL = 1.1
   232 		xOffset = 40 + 70
   232 		xOffset = 40 + 70
   233 		yOffset = 70		
   233 		yOffset = 70
   234 		tCol = wepCol[2]
   234 		tCol = wepCol[2]
   235 		tValue = wepAmmo[2]
   235 		tValue = wepAmmo[2]
   236 	end
   236 	end
   237 
   237 
   238 	DeleteVisualGear(vTag[i])
   238 	DeleteVisualGear(vTag[i])
   239 	vTag[i] = AddVisualGear(0, 0, vgtHealthTag, 0, false)
   239 	vTag[i] = AddVisualGear(0, 0, vgtHealthTag, 0, false)
   240 	g1, g2, g3, g4, g5, g6, g7, g8, g9, g10 = GetVisualGearValues(vTag[i])
   240 	g1, g2, g3, g4, g5, g6, g7, g8, g9, g10 = GetVisualGearValues(vTag[i])
   241 	SetVisualGearValues	(	
   241 	SetVisualGearValues	(
   242 				vTag[i], 		--id
   242 				vTag[i], 		--id
   243 				-(ScreenWidth/2) + xOffset,	--xoffset
   243 				-(ScreenWidth/2) + xOffset,	--xoffset
   244 				ScreenHeight - yOffset, --yoffset
   244 				ScreenHeight - yOffset, --yoffset
   245 				0, 			--dx
   245 				0, 			--dx
   246 				0, 			--dy
   246 				0, 			--dy
   276 			wepAmmo[0] = wepAmmo[0] + 1
   276 			wepAmmo[0] = wepAmmo[0] + 1
   277 			PlaySound(sndShotgunReload)
   277 			PlaySound(sndShotgunReload)
   278 			DeleteGear(gear)
   278 			DeleteGear(gear)
   279 			AddCaption(wep[0] .. " " .. loc("ammo extended!"), wepCol[0], capgrpAmmoinfo )
   279 			AddCaption(wep[0] .. " " .. loc("ammo extended!"), wepCol[0], capgrpAmmoinfo )
   280 			DrawTag(1)
   280 			DrawTag(1)
   281 			
   281 
   282 			barrelsEaten = barrelsEaten + 1
   282 			barrelsEaten = barrelsEaten + 1
   283 			if barrelsEaten == 5 then
   283 			if barrelsEaten == 5 then
   284 				AddCaption(loc("Achievement Unlocked") .. ": " .. loc("Barrel Eater!"),0xffba00ff,capgrpMessage2)
   284 				AddCaption(loc("Achievement Unlocked") .. ": " .. loc("Barrel Eater!"),0xffba00ff,capgrpMessage2)
   285 			end
   285 			end
   286 		
   286 
   287 		elseif (GetGearType(gear) == gtMine) then
   287 		elseif (GetGearType(gear) == gtMine) then
   288 			wepAmmo[1] = wepAmmo[1] + 1
   288 			wepAmmo[1] = wepAmmo[1] + 1
   289 			PlaySound(sndShotgunReload)
   289 			PlaySound(sndShotgunReload)
   290 			DeleteGear(gear)
   290 			DeleteGear(gear)
   291 			AddCaption(wep[1] .. " " .. loc("ammo extended!"), wepCol[1], capgrpAmmoinfo )
   291 			AddCaption(wep[1] .. " " .. loc("ammo extended!"), wepCol[1], capgrpAmmoinfo )
   292 			DrawTag(2)
   292 			DrawTag(2)
   293 			
   293 
   294 			minesEaten = minesEaten + 1
   294 			minesEaten = minesEaten + 1
   295 			if minesEaten == 5 then
   295 			if minesEaten == 5 then
   296 				AddCaption(loc("Achievement Unlocked") .. ": " .. loc("Mine Eater!"),0xffba00ff,capgrpMessage2)
   296 				AddCaption(loc("Achievement Unlocked") .. ": " .. loc("Mine Eater!"),0xffba00ff,capgrpMessage2)
   297 			end
   297 			end
   298 
   298 
   312 	if (dist < 1600) and (GetGearType(gear) == gtCase) then
   312 	if (dist < 1600) and (GetGearType(gear) == gtCase) then
   313 
   313 
   314 		if GetHealth(gear) > 0 then
   314 		if GetHealth(gear) > 0 then
   315 
   315 
   316 			AddCaption(loc("Tumbling Time Extended!"), 0xffba00ff, capgrpMessage2 )
   316 			AddCaption(loc("Tumbling Time Extended!"), 0xffba00ff, capgrpMessage2 )
   317 			
   317 
   318 			TimeLeft = TimeLeft + HealthCaseAmount  --5 --5s
   318 			TimeLeft = TimeLeft + HealthCaseAmount  --5 --5s
   319 			DrawTag(0)
   319 			DrawTag(0)
   320 			--PlaySound(sndShotgunReload)
   320 			--PlaySound(sndShotgunReload)
   321 		else
   321 		else
   322 			wepAmmo[2] = wepAmmo[2] + 800
   322 			wepAmmo[2] = wepAmmo[2] + 800
   440 	HealthCaseProb = 0
   440 	HealthCaseProb = 0
   441 	Delay = 1000
   441 	Delay = 1000
   442 
   442 
   443 	mineSpawn = MinesNum
   443 	mineSpawn = MinesNum
   444 	if mineSpawn > 4 then
   444 	if mineSpawn > 4 then
   445 		mineSpawn = 4	
   445 		mineSpawn = 4
   446 	end
   446 	end
   447 
   447 
   448 	barrelSpawn = Explosives
   448 	barrelSpawn = Explosives
   449 	if barrelSpawn > 4 then
   449 	if barrelSpawn > 4 then
   450 		barrelSpawn = 4	
   450 		barrelSpawn = 4
   451 	end
   451 	end
   452 
   452 
   453 	--MinesNum = 0
   453 	--MinesNum = 0
   454 	--Explosives = 0
   454 	--Explosives = 0
   455 
   455 
   456 	for i = 0, 3 do 	
   456 	for i = 0, 3 do
   457 		vTag[0] = AddVisualGear(0, 0, vgtHealthTag, 0, false)	
   457 		vTag[0] = AddVisualGear(0, 0, vgtHealthTag, 0, false)
   458 	end
   458 	end
   459 
   459 
   460 	HideTags()
   460 	HideTags()
   461 
   461 
   462 	wep[0] = loc("Barrel Launcher")
   462 	wep[0] = loc("Barrel Launcher")
   463 	wep[1] = loc("Mine Deployer")	
   463 	wep[1] = loc("Mine Deployer")
   464 	wep[2] = loc("Flamer")
   464 	wep[2] = loc("Flamer")
   465 
   465 
   466 	wepCol[0] = 0x78818eff
   466 	wepCol[0] = 0x78818eff
   467 	wepCol[1] = 0xa12a77ff
   467 	wepCol[1] = 0xa12a77ff
   468 	wepCol[2] = 0xf49318ff
   468 	wepCol[2] = 0xf49318ff
   469 	
   469 
   470 	wepCount = 3
   470 	wepCount = 3
   471 
   471 
   472 end
   472 end
   473 
   473 
   474 function onGameStart()
   474 function onGameStart()
   542 
   542 
   543 	HideTags()
   543 	HideTags()
   544 
   544 
   545 	--reset ammo counts
   545 	--reset ammo counts
   546 	wepAmmo[0] = 2
   546 	wepAmmo[0] = 2
   547 	wepAmmo[1] = 1 
   547 	wepAmmo[1] = 1
   548 	wepAmmo[2] = 50 -- 50000 -- 50
   548 	wepAmmo[2] = 50 -- 50000 -- 50
   549 	wepIndex = 2
   549 	wepIndex = 2
   550 	ChangeWeapon()
   550 	ChangeWeapon()
   551 
   551 
   552 	roundKills = 0
   552 	roundKills = 0
   577 			TimeLeft = (TurnTime/1000)
   577 			TimeLeft = (TurnTime/1000)
   578 			AddGear(GetX(CurrentHedgehog), GetY(CurrentHedgehog), gtGrenade, 0, 0, 0, 1)
   578 			AddGear(GetX(CurrentHedgehog), GetY(CurrentHedgehog), gtGrenade, 0, 0, 0, 1)
   579 			SetHealth(CurrentHedgehog, GetHealth(CurrentHedgehog) + 47) -- new
   579 			SetHealth(CurrentHedgehog, GetHealth(CurrentHedgehog) + 47) -- new
   580 			for i = 0, 3 do
   580 			for i = 0, 3 do
   581 				DrawTag(i)
   581 				DrawTag(i)
   582 			end			
   582 			end
   583 		end
   583 		end
   584 	end
   584 	end
   585 
   585 
   586 	if (CurrentHedgehog ~= nil) and (tumbleStarted == true) then
   586 	if (CurrentHedgehog ~= nil) and (tumbleStarted == true) then
   587 
   587