share/hedgewars/Data/Missions/Campaign/A_Space_Adventure/desert03.lua
changeset 12568 8a9919381629
parent 12544 19192a3cb674
child 12569 6a8c90a53249
equal deleted inserted replaced
12567:68dd14766445 12568:8a9919381629
    51 	{ x = 324, y = 1400},
    51 	{ x = 324, y = 1400},
    52 	{ x = 660, y = 1310},
    52 	{ x = 660, y = 1310},
    53 	{ x = 1200, y = 1310},
    53 	{ x = 1200, y = 1310},
    54 	{ x = 1700, y = 1310},
    54 	{ x = 1700, y = 1310},
    55 }
    55 }
       
    56 local flameCounter = 0
    56 
    57 
    57 -------------- LuaAPI EVENT HANDLERS ------------------
    58 -------------- LuaAPI EVENT HANDLERS ------------------
    58 
    59 
    59 function onGameInit()
    60 function onGameInit()
    60 	GameFlags = gfOneClanMode
    61 	GameFlags = gfOneClanMode
   122 	if GameTime > 3000 then
   123 	if GameTime > 3000 then
   123 		SetAnimSkip(true)
   124 		SetAnimSkip(true)
   124 	end
   125 	end
   125 end
   126 end
   126 
   127 
       
   128 function onGearAdd(gear)
       
   129 	if GetGearType(gear) == gtFlame then
       
   130 		flameCounter = flameCounter + 1
       
   131 	end
       
   132 end
       
   133 
       
   134 function onGearDelete(gear)
       
   135 	if GetGearType(gear) == gtFlame then
       
   136 		flameCounter = flameCounter - 1
       
   137 	end
       
   138 end
       
   139 
   127 -------------- EVENTS ------------------
   140 -------------- EVENTS ------------------
   128 
   141 
   129 function onHeroDeath(gear)
   142 function onHeroDeath(gear)
   130 	if not GetHealth(hero.gear) then
   143 	if not GetHealth(hero.gear) then
   131 		return true
   144 		return true
   132 	end
   145 	end
   133 	return false
   146 	return false
   134 end
   147 end
   135 
   148 
   136 function onLose(gear)
   149 function onLose(gear)
   137 	if GetHealth(hero.gear) and currentTarget < 4 and GetAmmoCount(hero.gear, amRCPlane) == 0 then
   150 	if GetHealth(hero.gear) and currentTarget < 4 and GetAmmoCount(hero.gear, amRCPlane) == 0 and flameCounter <= 0 then
   138 		return true
   151 		return true
   139 	end
   152 	end
   140 	return false
   153 	return false
   141 end
   154 end
   142 
   155 
   145 function heroDeath(gear)
   158 function heroDeath(gear)
   146 	gameOver()
   159 	gameOver()
   147 end
   160 end
   148 
   161 
   149 function lose(gear)
   162 function lose(gear)
       
   163 	AddCaption(loc("Out of ammo!"), 0xFFFFFFFF, capgrpMessage2)
       
   164 	PlaySound(sndStupid, hero.gear)
   150 	gameOver()
   165 	gameOver()
   151 end
   166 end
   152 
   167 
   153 -------------- ANIMATIONS ------------------
   168 -------------- ANIMATIONS ------------------
   154 
   169 
   198 		SpawnAmmoCrate(rcCrates[2].x, rcCrates[2].y, amRCPlane)
   213 		SpawnAmmoCrate(rcCrates[2].x, rcCrates[2].y, amRCPlane)
   199 		for i=2,3 do
   214 		for i=2,3 do
   200 			targets[i].gear = AddGear(targets[i].x, targets[i].y, gtTarget, 0, 0, 0, 0)
   215 			targets[i].gear = AddGear(targets[i].x, targets[i].y, gtTarget, 0, 0, 0, 0)
   201 		end
   216 		end
   202 	elseif ct == 3 then
   217 	elseif ct == 3 then
   203 		SpawnAmmoCrate(rcCrates[3].x, rcCrates[3].y, amRCPlane)
   218 		SpawnUtilityCrate(rcCrates[4].x, rcCrates[4].y, amNothing)
   204 		SpawnAmmoCrate(rcCrates[3].x, rcCrates[3].y, amRCPlane)
   219 		SpawnAmmoCrate(rcCrates[3].x, rcCrates[3].y, amRCPlane, 2)
   205 		SpawnAmmoCrate(rcCrates[4].x, rcCrates[4].y, amNothing)
       
   206 		for i=4,13 do
   220 		for i=4,13 do
   207 			targets[i].gear = AddGear(targets[i].x, targets[i].y, gtTarget, 0, 0, 0, 0)
   221 			targets[i].gear = AddGear(targets[i].x, targets[i].y, gtTarget, 0, 0, 0, 0)
   208 		end
   222 		end
   209 	end
   223 	end
   210 end
   224 end