share/hedgewars/Data/Scripts/Multiplayer/Tumbler.lua
changeset 12051 05a968518a56
parent 8043 da083f8d95e6
child 12052 144264948277
equal deleted inserted replaced
12050:daf63e2a21d2 12051:05a968518a56
     1 ------------------------------------
     1 ------------------------------------
     2 -- TUMBLER
     2 -- TUMBLER
     3 -- v.0.7.1
     3 -- v.0.8.0
     4 ------------------------------------
     4 ------------------------------------
       
     5 
       
     6 --[[
       
     7 SCRIPT PARAMETER
       
     8 The script is configured with the script parameter.
       
     9 
       
    10 Additional configuration in the game scheme is permitted.
       
    11 
       
    12 The script parameter is a comma-separated list of key=value pairs.
       
    13 
       
    14 The values are always whole numbers, the keys are listed below.
       
    15 
       
    16 Key			Default	Description
       
    17 ----------------------------------------------------------------------
       
    18 spawnbarrels		2	Number of barrels that spawn per turn
       
    19 spawnmines		4	Number of mines that spawn per turn
       
    20 ammoflamer		50	Initial fuel/ammo of Flamer
       
    21 ammobarrel		2	Initial ammo of Barrel Launcher
       
    22 ammomine		1	Initial ammo of Mine Deployer
       
    23 minetimerplaced		1000	Mine timer of mines dropped from Mine Deployer (!) in milliseconds
       
    24 bonustime		25	Bonus time in utility crates, in seconds
       
    25 bonusflames		800	Flamer fuel bonus in ammo crates
       
    26 chanceammo		30	Chance (in %) that an ammo crate will drop before a turn
       
    27 chancetime		50	Chance (in %) that an utility crate (extra time) will drop before a turn
       
    28 
       
    29 
       
    30 EXAMPLES:
       
    31 
       
    32 ammoflamer=800, ammomine=5
       
    33 --> Starts the game with 800 Flamer fuel and 5 Mine Deployer mines.
       
    34 
       
    35 chancetime=0
       
    36 --> No clock crates.
       
    37 
       
    38 
       
    39 GAME SCHEME CONFIGURATION
       
    40 The script recognizes most game modifiers and settings, but changing the following game modifiers
       
    41 will have no effect:
       
    42 - Artillery
       
    43 - Tag Team
       
    44 - Shared ammo
       
    45 - Per-hog ammo
       
    46 - Place hogs
       
    47 - Invulnerable
       
    48 - Reset weapons
       
    49 ]]
       
    50 
     5 
    51 
     6 HedgewarsScriptLoad("/Scripts/Locale.lua")
    52 HedgewarsScriptLoad("/Scripts/Locale.lua")
     7 HedgewarsScriptLoad("/Scripts/Tracker.lua")
    53 HedgewarsScriptLoad("/Scripts/Tracker.lua")
       
    54 HedgewarsScriptLoad("/Scripts/Params.lua")
     8 
    55 
     9 local fMod = 1000000 -- use this for dev and .16+ games
    56 local fMod = 1000000 -- use this for dev and .16+ games
    10 
    57 
    11 local leftOn = false
    58 local leftOn = false
    12 local rightOn = false
    59 local rightOn = false
    34 local TimeLeft = 0
    81 local TimeLeft = 0
    35 local stopMovement = false
    82 local stopMovement = false
    36 local tumbleStarted = false
    83 local tumbleStarted = false
    37 
    84 
    38 local vTag = {}
    85 local vTag = {}
       
    86 
       
    87 local barrelSpawn = 2
       
    88 local mineSpawn = 4
       
    89 local initAmmoFlamer = 50
       
    90 local initAmmoBarrel = 2
       
    91 local initAmmoMine = 1
       
    92 local placedMineTime = 1000
       
    93 local bonusTime = 25
       
    94 local bonusFlames = 800
       
    95 local chanceAmmo = 30
       
    96 local chanceTime = 50
       
    97 
    39 
    98 
    40 ------------------------
    99 ------------------------
    41 -- version 0.4
   100 -- version 0.4
    42 ------------------------
   101 ------------------------
    43 
   102 
   114 -- version 0.7.1
   173 -- version 0.7.1
   115 ------------------------
   174 ------------------------
   116 
   175 
   117 -- redraw HUD on screen resolution change
   176 -- redraw HUD on screen resolution change
   118 
   177 
       
   178 ------------------------
       
   179 -- version 0.8.0
       
   180 ------------------------
       
   181 -- Allow detailed configuration with script parameter (see above)
       
   182 -- Alternative weapon selection with slot keys
       
   183 --- Slot 1: Barrel Launcher
       
   184 --- Slot 2: Mine Deployer
       
   185 --- Slot 3: Flamer
       
   186 -- Add mine/barrel launch sounds
       
   187 -- Improved ammo display
       
   188 -- Denied sound + message when trying to fire empty ammo weapon
       
   189 -- Slightly better mission description
       
   190 --- The old hacks by (ab)using MinesNum, Explosives and HealthCaseAmount have been removed
       
   191 -- Permanently disable some gameflags which currently won't work together with this script (see above)
       
   192 -- Show flamer ammo as fuel everywhere (no more percentage confusion)
       
   193 
   119 ---------------------------
   194 ---------------------------
   120 -- some other ideas/things
   195 -- some other ideas/things
   121 ---------------------------
   196 ---------------------------
   122 --[[
   197 --[[
   123 -- add better gameflag handling
   198 -- allow invulnerability mode (currently broken, thus disabled)
   124 -- fix flamer "shots remaining" message on start or choose a standard versus %
       
   125 -- add more sounds
       
   126 -- better barrel/minespawn effects
   199 -- better barrel/minespawn effects
   127 -- separate grab distance for mines/barrels
   200 -- separate grab distance for mines/barrels
       
   201 -- bug: message color for remaining ammo does not change if two times the same message
       
   202    (but in different desired color) is shown in quick succession (i.e. "Out of ammo!" for all weapons)
   128 -- [probably not] make barrels always explode?
   203 -- [probably not] make barrels always explode?
   129 -- [probably not] persistent ammo?
   204 -- [probably not] persistent ammo?
   130 -- [probably not] dont hurt tumblers and restore their health at turn end?
   205 -- [probably not] dont hurt tumblers and restore their health at turn end?
   131 ]]
   206 ]]
   132 
   207 
   274 		if (GetGearType(gear) == gtExplosives) then
   349 		if (GetGearType(gear) == gtExplosives) then
   275 
   350 
   276 			wepAmmo[0] = wepAmmo[0] + 1
   351 			wepAmmo[0] = wepAmmo[0] + 1
   277 			PlaySound(sndShotgunReload)
   352 			PlaySound(sndShotgunReload)
   278 			DeleteGear(gear)
   353 			DeleteGear(gear)
   279 			AddCaption(wep[0] .. " " .. loc("ammo extended!"), wepCol[0], capgrpAmmoinfo )
   354 			AddCaption(loc("+1 barrel!"), wepCol[0], capgrpAmmoinfo )
   280 			DrawTag(1)
   355 			DrawTag(1)
   281 
   356 
   282 			barrelsEaten = barrelsEaten + 1
   357 			barrelsEaten = barrelsEaten + 1
   283 			if barrelsEaten == 5 then
   358 			if barrelsEaten == 5 then
   284 				AddCaption(loc("Achievement Unlocked") .. ": " .. loc("Barrel Eater!"),0xffba00ff,capgrpMessage2)
   359 				AddCaption(loc("Achievement obtained: Barrel Eater!"),0xffba00ff,capgrpMessage2)
   285 			end
   360 			end
   286 
   361 
   287 		elseif (GetGearType(gear) == gtMine) then
   362 		elseif (GetGearType(gear) == gtMine) then
   288 			wepAmmo[1] = wepAmmo[1] + 1
   363 			wepAmmo[1] = wepAmmo[1] + 1
   289 			PlaySound(sndShotgunReload)
   364 			PlaySound(sndShotgunReload)
   290 			DeleteGear(gear)
   365 			DeleteGear(gear)
   291 			AddCaption(wep[1] .. " " .. loc("ammo extended!"), wepCol[1], capgrpAmmoinfo )
   366 			AddCaption(loc("+1 mine!"), wepCol[1], capgrpAmmoinfo )
   292 			DrawTag(2)
   367 			DrawTag(2)
   293 
   368 
   294 			minesEaten = minesEaten + 1
   369 			minesEaten = minesEaten + 1
   295 			if minesEaten == 5 then
   370 			if minesEaten == 5 then
   296 				AddCaption(loc("Achievement Unlocked") .. ": " .. loc("Mine Eater!"),0xffba00ff,capgrpMessage2)
   371 				AddCaption(loc("Achievement obtained: Mine Eater!"),0xffba00ff,capgrpMessage2)
   297 			end
   372 			end
   298 
   373 
   299 		end
   374 		end
   300 
   375 
   301 	else
       
   302 		--AddCaption("There is nothing here...")
       
   303 	end
   376 	end
   304 
   377 
   305 end
   378 end
   306 
   379 
   307 -- check proximity on crates
   380 -- check proximity on crates
   309 
   382 
   310 	dist = GetGearDistance(gear)
   383 	dist = GetGearDistance(gear)
   311 
   384 
   312 	if (dist < 1600) and (GetGearType(gear) == gtCase) then
   385 	if (dist < 1600) and (GetGearType(gear) == gtCase) then
   313 
   386 
   314 		if GetHealth(gear) > 0 then
   387 		if band(GetGearPos(gear), 0x4) ~= 0 then
   315 
   388 
   316 			AddCaption(loc("Tumbling Time Extended!"), 0xffba00ff, capgrpMessage2 )
   389 			AddCaption(string.format(loc("+%d seconds!"), bonusTime), 0xffba00ff, capgrpMessage2 )
   317 
   390 
   318 			TimeLeft = TimeLeft + HealthCaseAmount  --5 --5s
   391 			TimeLeft = TimeLeft + bonusTime
   319 			DrawTag(0)
   392 			DrawTag(0)
   320 			--PlaySound(sndShotgunReload)
   393 			PlaySound(sndExtraTime)
       
   394 		elseif band(GetGearPos(gear), 0x1) ~= 0 then
       
   395 			wepAmmo[2] = wepAmmo[2] + bonusFlames
       
   396 			PlaySound(sndShotgunReload)
       
   397 			AddCaption(string.format(loc("+%d flamer fuel!"), bonusFlames), wepCol[2], capgrpAmmoinfo )
       
   398 			DrawTag(3)
       
   399 		end
       
   400 
       
   401 		DeleteGear(gear)
       
   402 
       
   403 	end
       
   404 
       
   405 end
       
   406 
       
   407 function shotsRemainingMessage()
       
   408 	local shotsMsg
       
   409 	if wepAmmo[wepIndex] <= 0 then
       
   410 		shotsMsg = loc("Out of ammo!")
       
   411 	else
       
   412 		if wepIndex == 2 then
       
   413 			shotsMsg = loc("%d fuel remaining")
   321 		else
   414 		else
   322 			wepAmmo[2] = wepAmmo[2] + 800
   415 			shotsMsg = loc("%d shots remaining")
   323 			PlaySound(sndShotgunReload)
   416 		end
   324 			AddCaption(wep[2] .. " " .. loc("fuel extended!"), wepCol[2], capgrpAmmoinfo )
   417 	end
   325 			DrawTag(3)
   418 	AddCaption(string.format(shotsMsg, wepAmmo[wepIndex]), wepCol[wepIndex],capgrpMessage2)
   326 		end
   419 end
   327 
   420 
   328 		DeleteGear(gear)
   421 function ChangeWeapon(newIndex)
   329 
   422 	if newIndex == nil then
   330 	end
   423 		wepIndex = wepIndex + 1
   331 
   424 		if wepIndex == wepCount then
   332 end
   425 			wepIndex = 0
   333 
   426 		end
   334 function ChangeWeapon()
   427 	else
   335 
   428 		wepIndex = newIndex
   336 	wepIndex = wepIndex + 1
   429 	end
   337 	if wepIndex == wepCount then
   430 
   338 		wepIndex = 0
   431 	local selText
   339 	end
   432 	if wepIndex == 0 then
   340 
   433 		selText = loc("Barrel Launcher selected!")
   341 	AddCaption(wep[wepIndex] .. " " .. loc("selected!"), wepCol[wepIndex],capgrpAmmoinfo )
   434 	elseif wepIndex == 1 then
   342 	AddCaption(wepAmmo[wepIndex] .. " " .. loc("shots remaining."), wepCol[wepIndex],capgrpMessage2)
   435 		selText = loc("Mine Deployer selected!")
   343 
   436 	else
       
   437 		selText = loc("Flamer selected!")
       
   438 	end
       
   439 	AddCaption(selText, wepCol[wepIndex],capgrpAmmoinfo )
       
   440 
       
   441 	shotsRemainingMessage()
       
   442 end
       
   443 
       
   444 ---------------
       
   445 -- Parse parameters
       
   446 ---------------
       
   447 
       
   448 function parseNum(key, default, min, max)
       
   449 	local num = tonumber(params[key])
       
   450 	if type(num) ~= "number" then 
       
   451 		if default ~= nil then
       
   452 			return default
       
   453 		else
       
   454 			return nil
       
   455 		end
       
   456 	end
       
   457 
       
   458 	if min ~= nil then
       
   459 		num = math.max(min, num)
       
   460 	end
       
   461 	if max ~= nil then
       
   462 		num = math.min(max, num)
       
   463 	end
       
   464 	return num
       
   465 end
       
   466 
       
   467 function onParameters()
       
   468 	parseParams()
       
   469 
       
   470 	barrelSpawn = parseNum("spawnbarrels", barrelSpawn, 0)
       
   471 	mineSpawn = parseNum("spawnmines", mineSpawn, 0)
       
   472 
       
   473 	initAmmoFlamer = parseNum("ammoflamer", initAmmoFlamer, 0)
       
   474 	initAmmoBarrel = parseNum("ammobarrel", initAmmoBarrel, 0)
       
   475 	initAmmoMine = parseNum("ammomine", initAmmoMine, 0)
       
   476 
       
   477 	placedMineTime = parseNum("minetimeplaced", placedMineTime, 0, 5000)
       
   478 
       
   479 	bonusTime = parseNum("bonustime", bonusTime, 0)
       
   480 	bonusFlames = parseNum("bonusflames", bonusFlames, 0)
       
   481 
       
   482 	chanceAmmo = parseNum("chanceammo", chanceAmmo, 0, 100)
       
   483 	chanceTime = parseNum("chancetime", chanceTime, 0, 100)
   344 end
   484 end
   345 
   485 
   346 ---------------
   486 ---------------
   347 -- action keys
   487 -- action keys
   348 ---------------
   488 ---------------
   349 
   489 
   350 function onPrecise()
   490 function onPrecise()
   351 
   491 
   352 	if (CurrentHedgehog ~= nil) and (stopMovement == false) and (tumbleStarted == true) and (wepAmmo[wepIndex] > 0) then
   492 	if (CurrentHedgehog ~= nil) and (stopMovement == false) and (tumbleStarted == true) then
   353 
   493 
   354 		wepAmmo[wepIndex] = wepAmmo[wepIndex] - 1
   494 		if wepAmmo[wepIndex] <= 0 then
   355 		AddCaption(wepAmmo[wepIndex] .. " " .. loc("shots remaining."), wepCol[wepIndex],capgrpMessage2)
   495 			PlaySound(sndDenied)
   356 
   496 			shotsRemainingMessage()
   357 		if wep[wepIndex] == loc("Barrel Launcher") then
   497 		else
   358 			morte = AddGear(GetX(CurrentHedgehog), GetY(CurrentHedgehog), gtExplosives, 0, 0, 0, 1)
   498 
   359 			CopyPV(CurrentHedgehog, morte) -- new addition
   499 			wepAmmo[wepIndex] = wepAmmo[wepIndex] - 1
   360 			x,y = GetGearVelocity(morte)
   500 			shotsRemainingMessage()
   361 			x = x*2
   501 
   362 			y = y*2
   502 			if wep[wepIndex] == loc("Barrel Launcher") then
   363 			SetGearVelocity(morte, x, y)
   503 				morte = AddGear(GetX(CurrentHedgehog), GetY(CurrentHedgehog), gtExplosives, 0, 0, 0, 1)
   364 			DrawTag(1)
   504 				CopyPV(CurrentHedgehog, morte) -- new addition
   365 
   505 				x,y = GetGearVelocity(morte)
   366 		elseif wep[wepIndex] == loc("Mine Deployer") then
   506 				x = x*2
   367 			morte = AddGear(GetX(CurrentHedgehog), GetY(CurrentHedgehog), gtMine, 0, 0, 0, 0)
   507 				y = y*2
   368 			SetTimer(morte, 1000)
   508 				SetGearVelocity(morte, x, y)
   369 			DrawTag(2)
   509 				DrawTag(1)
       
   510 				PlaySound(sndThrowRelease)
       
   511 
       
   512 			elseif wep[wepIndex] == loc("Mine Deployer") then
       
   513 				morte = AddGear(GetX(CurrentHedgehog), GetY(CurrentHedgehog), gtMine, 0, 0, 0, 0)
       
   514 				SetTimer(morte, placedMineTime)
       
   515 				DrawTag(2)
       
   516 				PlaySound(sndThrowRelease)
       
   517 
       
   518 			end
   370 		end
   519 		end
   371 
   520 
   372 	end
   521 	end
   373 
   522 
   374 	preciseOn = true
   523 	preciseOn = true
   376 end
   525 end
   377 
   526 
   378 function onPreciseUp()
   527 function onPreciseUp()
   379 	preciseOn = false
   528 	preciseOn = false
   380 end
   529 end
       
   530 
       
   531 onAttack = onPrecise
       
   532 onAttackUp = onPreciseUp
   381 
   533 
   382 function onHJump()
   534 function onHJump()
   383 	-- pick up explosives/mines if nearby them
   535 	-- pick up explosives/mines if nearby them
   384 	if (CurrentHedgehog ~= nil) and (stopMovement == false) and (tumbleStarted == true) then
   536 	if (CurrentHedgehog ~= nil) and (stopMovement == false) and (tumbleStarted == true) then
   385 		runOnGears(CheckProximityToExplosives)
   537 		runOnGears(CheckProximityToExplosives)
   386 	end
   538 	end
   387 end
   539 end
   388 
   540 
       
   541 -------------------
       
   542 -- Weapon selection
       
   543 -------------------
       
   544 
   389 function onLJump()
   545 function onLJump()
   390 	ChangeWeapon()
   546 	if (CurrentHedgehog ~= nil) and (stopMovement == false) and (tumbleStarted == true) then
       
   547 		ChangeWeapon()
       
   548 	end
       
   549 end
       
   550 
       
   551 function onSlot(slot)
       
   552 	if (CurrentHedgehog ~= nil) and (stopMovement == false) and (tumbleStarted == true) then
       
   553 		if slot >= 0 and slot <= 2 then
       
   554 			ChangeWeapon(slot)
       
   555 		end
       
   556 	end
   391 end
   557 end
   392 
   558 
   393 -----------------
   559 -----------------
   394 -- movement keys
   560 -- movement keys
   395 -----------------
   561 -----------------
   438 function onGameInit()
   604 function onGameInit()
   439 	CaseFreq = 0
   605 	CaseFreq = 0
   440 	HealthCaseProb = 0
   606 	HealthCaseProb = 0
   441 	Delay = 1000
   607 	Delay = 1000
   442 
   608 
   443 	mineSpawn = MinesNum
       
   444 	if mineSpawn > 4 then
       
   445 		mineSpawn = 4
       
   446 	end
       
   447 
       
   448 	barrelSpawn = Explosives
       
   449 	if barrelSpawn > 4 then
       
   450 		barrelSpawn = 4
       
   451 	end
       
   452 
       
   453 	--MinesNum = 0
       
   454 	--Explosives = 0
       
   455 
       
   456 	for i = 0, 3 do
   609 	for i = 0, 3 do
   457 		vTag[0] = AddVisualGear(0, 0, vgtHealthTag, 0, false)
   610 		vTag[0] = AddVisualGear(0, 0, vgtHealthTag, 0, false)
   458 	end
   611 	end
   459 
   612 
   460 	HideTags()
   613 	HideTags()
   467 	wepCol[1] = 0xa12a77ff
   620 	wepCol[1] = 0xa12a77ff
   468 	wepCol[2] = 0xf49318ff
   621 	wepCol[2] = 0xf49318ff
   469 
   622 
   470 	wepCount = 3
   623 	wepCount = 3
   471 
   624 
       
   625 	DisableGameFlags(gfArtillery + gfSharedAmmo + gfPerHogAmmo + gfTagTeam + gfPlaceHog + gfInvulnerable)
       
   626 
   472 end
   627 end
   473 
   628 
   474 function onGameStart()
   629 function onGameStart()
   475 
   630 
       
   631 	local clockStr
       
   632 	local timeStr
       
   633 
       
   634 	if chanceTime > 0 then
       
   635 		clockStr = loc("Utility crates extend your time.") .. "|"
       
   636 		timeStr = string.format(loc("Time extension: %ds"), bonusTime) .. "|"
       
   637 	else
       
   638 		clockStr = ""
       
   639 		timeStr = ""
       
   640 	end
       
   641 
   476 	ShowMission	(
   642 	ShowMission	(
   477 			"TUMBLER",
   643 			"Tumbler",
   478 			loc("a Hedgewars mini-game"),
   644 			loc("A Hedgewars mini-game"),
       
   645 			loc("Fly around and hurl explosives to your enemies.") .."|"..
   479 			loc("Eliminate the enemy hogs to win.") .. "|" ..
   646 			loc("Eliminate the enemy hogs to win.") .. "|" ..
   480 			" " .. "|" ..
   647 			" " .. "|" ..
   481 
   648 
   482 			loc("New Mines Per Turn") .. ": " .. (mineSpawn) .. "|" ..
   649 			string.format(loc("New mines per turn: %d"), mineSpawn) .. "|" ..
   483 			loc("New Barrels Per Turn") .. ": " .. (barrelSpawn) .. "|" ..
   650 			string.format(loc("New barrels per turn: %d"), barrelSpawn) .. "|" ..
   484 			loc("Time Extension") .. ": " .. (HealthCaseAmount) .. loc("sec") .. "|" ..
   651 			timeStr ..
   485 			" " .. "|" ..
   652 			" " .. "|" ..
   486 
   653 
   487 			loc("Movement: [Up], [Down], [Left], [Right]") .. "|" ..
   654 			loc("Movement: [Up], [Down], [Left], [Right]") .. "|" ..
   488 			loc("Fire") .. ": " .. loc("[Left Shift]") .. "|" ..
   655 			loc("Fire: [Precise]") .. "|" ..
   489 			loc("Change Weapon") .. ": " .. loc("[Enter]") .. "|" ..
   656 			loc("Change weapon: [Long jump] or [Slot 1]-[Slot 3]") .. "|" ..
   490 			loc("Grab Mines/Explosives") .. ": " .. loc("[Backspace]") .. "|" ..
   657 			loc("Grab mines/barrels: [High jump]") .. "|" ..
   491 
   658 
   492 			" " .. "|" ..
   659 			" " .. "|" ..
   493 
   660 
   494 			loc("Health crates extend your time.") .. "|" ..
   661 			clockStr ..
   495 			loc("Ammo is reset at the end of your turn.") .. "|" ..
   662 			loc("Ammo is reset at the end of your turn.") .. "|" ..
   496 
   663 
   497 			"", 4, 4000
   664 			"", 4, 4000
   498 			)
   665 			)
   499 
   666 
   506 		for i = 0, 3 do
   673 		for i = 0, 3 do
   507 			DrawTag(i)
   674 			DrawTag(i)
   508 		end
   675 		end
   509 	end
   676 	end
   510 
   677 
       
   678 end
       
   679 
       
   680 function onAmmoStoreInit()
       
   681 	-- Remove all conventional weapons
       
   682 	for a=0, 56 do
       
   683 		SetAmmo(a, 0, 0, 0, 0)
       
   684 	end
   511 end
   685 end
   512 
   686 
   513 function onNewTurn()
   687 function onNewTurn()
   514 
   688 
   515 	stopMovement = false
   689 	stopMovement = false
   530 		end
   704 		end
   531 	end
   705 	end
   532 
   706 
   533 	-- randomly spawn time extension crates / flamer fuel on the map
   707 	-- randomly spawn time extension crates / flamer fuel on the map
   534 	r = GetRandom(100)
   708 	r = GetRandom(100)
   535 	if r > 50 then
   709 	if r > 100-chanceTime then
   536 		gear = SpawnHealthCrate(0, 0)
   710 		gear = SpawnFakeUtilityCrate(0, 0, false, false)
   537 	end
   711 	end
   538 	r = GetRandom(100)
   712 	r = GetRandom(100)
   539 	if r > 70 then
   713 	if r > 100-chanceAmmo then
   540 		gear = SpawnAmmoCrate(0, 0, amSkip)
   714 		gear = SpawnFakeAmmoCrate(0, 0, false, false)
   541 	end
   715 	end
   542 
   716 
   543 	HideTags()
   717 	HideTags()
   544 
   718 
   545 	--reset ammo counts
   719 	--reset ammo counts
   570 function onGameTick()
   744 function onGameTick()
   571 
   745 
   572 	-- start the player tumbling with a boom once their turn has actually begun
   746 	-- start the player tumbling with a boom once their turn has actually begun
   573 	if tumbleStarted == false then
   747 	if tumbleStarted == false then
   574 		if (TurnTimeLeft > 0) and (TurnTimeLeft ~= TurnTime) then
   748 		if (TurnTimeLeft > 0) and (TurnTimeLeft ~= TurnTime) then
   575 			--AddCaption(loc("Good to go!"))
       
   576 			tumbleStarted = true
   749 			tumbleStarted = true
   577 			TimeLeft = (TurnTime/1000)
   750 			TimeLeft = (TurnTime/1000)
   578 			AddGear(GetX(CurrentHedgehog), GetY(CurrentHedgehog), gtGrenade, 0, 0, 0, 1)
   751 			AddGear(GetX(CurrentHedgehog), GetY(CurrentHedgehog), gtGrenade, 0, 0, 0, 1)
   579 			SetHealth(CurrentHedgehog, GetHealth(CurrentHedgehog) + 47) -- new
   752 			SetHealth(CurrentHedgehog, GetHealth(CurrentHedgehog) + 47) -- new
   580 			for i = 0, 3 do
   753 			for i = 0, 3 do
   666 			fireTimer = 0
   839 			fireTimer = 0
   667 
   840 
   668 			if (wep[wepIndex] == loc("Flamer") ) and (preciseOn == true) and (wepAmmo[wepIndex] > 0) and (stopMovement == false) and (tumbleStarted == true) then
   841 			if (wep[wepIndex] == loc("Flamer") ) and (preciseOn == true) and (wepAmmo[wepIndex] > 0) and (stopMovement == false) and (tumbleStarted == true) then
   669 
   842 
   670 				wepAmmo[wepIndex] = wepAmmo[wepIndex] - 1
   843 				wepAmmo[wepIndex] = wepAmmo[wepIndex] - 1
   671 				AddCaption(
   844 				shotsRemainingMessage()
   672 						loc("Flamer") .. ": " ..
       
   673 						(wepAmmo[wepIndex]/800*100) - (wepAmmo[wepIndex]/800*100)%2 .. "%",
       
   674 						wepCol[2],
       
   675 						capgrpMessage2
       
   676 						)
       
   677 				DrawTag(3)
   845 				DrawTag(3)
   678 
   846 
   679 				dx, dy = GetGearVelocity(CurrentHedgehog)
   847 				dx, dy = GetGearVelocity(CurrentHedgehog)
   680 				shell = AddGear(GetX(CurrentHedgehog), GetY(CurrentHedgehog), gtFlame, 0, 0, 0, 0)
   848 				shell = AddGear(GetX(CurrentHedgehog), GetY(CurrentHedgehog), gtFlame, 0, 0, 0, 0)
   681 
   849 
   717 	else
   885 	else
   718 		return(false)
   886 		return(false)
   719 	end
   887 	end
   720 end
   888 end
   721 
   889 
   722 --[[function onGearDamage(gear, damage)
       
   723 	if gear == CurrentHedgehog then
       
   724 		-- You are now tumbling
       
   725 	end
       
   726 end]]
       
   727 
       
   728 function onGearAdd(gear)
   890 function onGearAdd(gear)
   729 
   891 
   730 	if GetGearType(gear) == gtFlame then
   892 	if GetGearType(gear) == gtFlame then
   731 
   893 
   732 		trackFGear(gear)
   894 		trackFGear(gear)