share/hedgewars/Data/Scripts/Multiplayer/Tumbler.lua
changeset 13581 9c8749bb0d06
parent 12344 877f55c77a3f
child 13643 690cc84e9fd6
equal deleted inserted replaced
13580:dc4ce9f486b0 13581:9c8749bb0d06
    70 
    70 
    71 local mineSpawn
    71 local mineSpawn
    72 local barrelSpawn
    72 local barrelSpawn
    73 
    73 
    74 local roundKills = 0
    74 local roundKills = 0
    75 local barrelsEaten = 0
       
    76 local minesEaten = 0
       
    77 
    75 
    78 local moveTimer = 0
    76 local moveTimer = 0
    79 local fireTimer = 0
    77 local fireTimer = 0
    80 local TimeLeftCounter = 0
    78 local TimeLeftCounter = 0
    81 local TimeLeft = 0
    79 local TimeLeft = 0
   352 			PlaySound(sndShotgunReload)
   350 			PlaySound(sndShotgunReload)
   353 			DeleteGear(gear)
   351 			DeleteGear(gear)
   354 			AddCaption(loc("+1 barrel!"), wepCol[0], capgrpAmmoinfo )
   352 			AddCaption(loc("+1 barrel!"), wepCol[0], capgrpAmmoinfo )
   355 			DrawTag(1)
   353 			DrawTag(1)
   356 
   354 
   357 			barrelsEaten = barrelsEaten + 1
       
   358 			if barrelsEaten == 5 then
       
   359 				AddCaption(string.format(loc("Achievement gotten: %s"), loc("Barrel Eater")),0xffba00ff,capgrpMessage2)
       
   360 			end
       
   361 
       
   362 		elseif (GetGearType(gear) == gtMine) then
   355 		elseif (GetGearType(gear) == gtMine) then
   363 			wepAmmo[1] = wepAmmo[1] + 1
   356 			wepAmmo[1] = wepAmmo[1] + 1
   364 			PlaySound(sndShotgunReload)
   357 			PlaySound(sndShotgunReload)
   365 			DeleteGear(gear)
   358 			DeleteGear(gear)
   366 			AddCaption(loc("+1 mine!"), wepCol[1], capgrpAmmoinfo )
   359 			AddCaption(loc("+1 mine!"), wepCol[1], capgrpAmmoinfo )
   367 			DrawTag(2)
   360 			DrawTag(2)
   368 
       
   369 			minesEaten = minesEaten + 1
       
   370 			if minesEaten == 5 then
       
   371 				AddCaption(string.format(loc("Achievement gotten: %s"), loc("Mine Eater")),0xffba00ff,capgrpMessage2)
       
   372 			end
       
   373 
   361 
   374 		end
   362 		end
   375 
   363 
   376 	end
   364 	end
   377 
   365 
   413 			shotsMsg = loc("Fuel: %d")
   401 			shotsMsg = loc("Fuel: %d")
   414 		else
   402 		else
   415 			shotsMsg = loc("Ammo: %d")
   403 			shotsMsg = loc("Ammo: %d")
   416 		end
   404 		end
   417 	end
   405 	end
   418 	AddCaption(string.format(shotsMsg, wepAmmo[wepIndex]), wepCol[wepIndex],capgrpMessage2)
   406 	AddCaption(string.format(shotsMsg, wepAmmo[wepIndex]), wepCol[wepIndex],capgrpAmmostate)
   419 end
   407 end
   420 
   408 
   421 function ChangeWeapon(newIndex)
   409 function ChangeWeapon(newIndex)
   422 	if newIndex == nil then
   410 	if newIndex == nil then
   423 		wepIndex = wepIndex + 1
   411 		wepIndex = wepIndex + 1
   428 		wepIndex = newIndex
   416 		wepIndex = newIndex
   429 	end
   417 	end
   430 
   418 
   431 	local selText
   419 	local selText
   432 	if wepIndex == 0 then
   420 	if wepIndex == 0 then
   433 		selText = loc("Barrel Launcher selected!")
   421 		selText = loc("Barrel Launcher")
   434 	elseif wepIndex == 1 then
   422 	elseif wepIndex == 1 then
   435 		selText = loc("Mine Deployer selected!")
   423 		selText = loc("Mine Deployer")
   436 	else
   424 	else
   437 		selText = loc("Flamer selected!")
   425 		selText = loc("Flamer")
   438 	end
   426 	end
   439 	AddCaption(selText, wepCol[wepIndex],capgrpAmmoinfo )
   427 	AddCaption(selText, wepCol[wepIndex],capgrpAmmoinfo )
   440 
   428 
   441 	shotsRemainingMessage()
   429 	shotsRemainingMessage()
   442 end
   430 end
   722 	wepAmmo[2] = 50 -- 50000 -- 50
   710 	wepAmmo[2] = 50 -- 50000 -- 50
   723 	wepIndex = 2
   711 	wepIndex = 2
   724 	ChangeWeapon()
   712 	ChangeWeapon()
   725 
   713 
   726 	roundKills = 0
   714 	roundKills = 0
   727 	barrelsEaten = 0
       
   728 	minesEaten = 0
       
   729 
   715 
   730 	FollowGear(CurrentHedgehog)
   716 	FollowGear(CurrentHedgehog)
   731 
   717 
   732 end
   718 end
   733 
   719 
   928 
   914 
   929 		if GetHogTeamName(gear) ~= GetHogTeamName(CurrentHedgehog) then
   915 		if GetHogTeamName(gear) ~= GetHogTeamName(CurrentHedgehog) then
   930 
   916 
   931 			roundKills = roundKills + 1
   917 			roundKills = roundKills + 1
   932 			if roundKills == 2 then
   918 			if roundKills == 2 then
   933 				AddCaption(loc("Double Kill!"),0xffba00ff,capgrpMessage2)
   919 				AddCaption(loc("Double Kill!"),0xffffffff,capgrpMessage2)
   934 			elseif roundKills == 3 then
   920 			elseif roundKills == 3 then
   935 				AddCaption(loc("Killing spree!"),0xffba00ff,capgrpMessage2)
   921 				AddCaption(loc("Killing spree!"),0xffffffff,capgrpMessage2)
   936 			elseif roundKills >= 4 then
   922 			elseif roundKills >= 4 then
   937 				AddCaption(loc("Unstoppable!"),0xffba00ff,capgrpMessage2)
   923 				AddCaption(loc("Unstoppable!"),0xffffffff,capgrpMessage2)
   938 			end
   924 			end
   939 
   925 
   940 		elseif gear == CurrentHedgehog then
   926 		elseif gear == CurrentHedgehog then
   941 			DisableTumbler()
   927 			DisableTumbler()
   942 
   928 
   943 		elseif gear ~= CurrentHedgehog then
   929 		elseif gear ~= CurrentHedgehog then
   944 			AddCaption(loc("Friendly Fire!"),0xffba00ff,capgrpMessage2)
   930 			AddCaption(loc("Friendly Fire!"),0xffffffff,capgrpMessage2)
   945 		end
   931 		end
   946 
   932 
   947 	end
   933 	end
   948 
   934 
   949 	if CurrentHedgehog ~= nil then
   935 	if CurrentHedgehog ~= nil then