--- a/ChangeLog.txt Wed Sep 27 23:09:25 2017 +0200
+++ b/ChangeLog.txt Wed Sep 27 23:24:29 2017 +0200
@@ -210,6 +210,7 @@
* Searching in the dust: Remove checkpoints. See above.
* Searching in the dust: Fix Hog Solo dropping straight down when roping near smuggler
* Searching in the dust: Fix incorrect messages after collecting device part
+ * Precise flying: Fix victory not being recognized, also wait for flames to settle before losing
* Hard Flying: Fix ending in a Lua error
* The First Stop: Fix stats screen showing teams twice
* Killing The Specialists: Fix killing hog with Deagle gave you chance to use another weapon in same turn
--- a/share/hedgewars/Data/Missions/Campaign/A_Space_Adventure/desert03.lua Wed Sep 27 23:09:25 2017 +0200
+++ b/share/hedgewars/Data/Missions/Campaign/A_Space_Adventure/desert03.lua Wed Sep 27 23:24:29 2017 +0200
@@ -53,6 +53,7 @@
{ x = 1200, y = 1310},
{ x = 1700, y = 1310},
}
+local targetsDead = {}
local flameCounter = 0
-------------- LuaAPI EVENT HANDLERS ------------------
@@ -135,6 +136,12 @@
if GetGearType(gear) == gtFlame then
flameCounter = flameCounter - 1
end
+ for t=1, #targets do
+ if gear == targets[t].gear then
+ targetsDead[t] = true
+ break
+ end
+ end
end
-------------- EVENTS ------------------
@@ -188,23 +195,30 @@
function checkTargetsDestroyed()
if currentTarget == 1 then
- if not GetHealth(targets[1].gear) then
+ if targetsDead[1] then
AddCaption(loc("Level 1 clear!"))
SetGearPosition(hero.gear, 3590, 90)
currentTarget = 2
setTargets(currentTarget)
end
elseif currentTarget == 2 then
- if not (GetHealth(targets[2].gear) or GetHealth(targets[3].gear)) then
+ if targetsDead[2] and targetsDead[3] then
AddCaption(loc("Level 2 clear!"))
SetGearPosition(hero.gear, 1110, 580)
currentTarget = 3
setTargets(currentTarget)
end
elseif currentTarget == 3 then
-
- else
- win()
+ local allDead = true
+ for t=3, #targets do
+ if targetsDead[t] ~= true then
+ allDead = false
+ end
+ end
+ if allDead then
+ currentTarget = 4
+ win()
+ end
end
end
@@ -224,6 +238,8 @@
end
function win()
+ AddCaption(loc("Victory!"))
+ PlaySound(sndVictory, hero.gear)
saveBonus(1, 1)
SendStat(siGameResult, loc("Congratulations, you are the best!"))
SendStat(siCustomAchievement, loc("You have destroyed all the targets."))