# HG changeset patch # User Periklis Ntanasis # Date 1385951702 -7200 # Node ID da2cb993fd616bb30ef1ed0f4b518104662f6ebc # Parent 37f84780eb14d6efeac0b6b990d7fed1ae082ab7 fixed moving npc and flying in forbidden area in ice01 diff -r 37f84780eb14 -r da2cb993fd61 share/hedgewars/Data/Missions/Campaign/A_Space_Adventure/ice01.lua --- a/share/hedgewars/Data/Missions/Campaign/A_Space_Adventure/ice01.lua Mon Dec 02 03:07:28 2013 +0200 +++ b/share/hedgewars/Data/Missions/Campaign/A_Space_Adventure/ice01.lua Mon Dec 02 04:35:02 2013 +0200 @@ -193,6 +193,7 @@ AddEvent(onHeroDeath, {hero.gear}, heroDeath, {hero.gear}, 0) AddEvent(onHeroFinalStep, {hero.gear}, heroFinalStep, {hero.gear}, 0) AddEvent(onAntiFlyArea, {hero.gear}, antiFlyArea, {hero.gear}, 1) + AddEvent(onAntiFlyAreaVelocity, {hero.gear}, antiFlyAreaVelocity, {hero.gear}, 1) AddEvent(onNonAntiFlyArea, {hero.gear}, nonAntiFlyArea, {hero.gear}, 1) AddEvent(onThantaDeath, {bandit1.gear}, thantaDeath, {bandit1.gear}, 0) AddEvent(onHeroWin, {hero.gear}, heroWin, {hero.gear}, 0) @@ -341,6 +342,13 @@ return false end +function onAntiFlyAreaVelocity(gear) + if not hero.dead and GetY(gear) < 1300 then + return true + end + return false +end + function onNonAntiFlyArea(gear) if not hero.dead and (GetX(gear) < 860 and GetY(gear) > 1400) and heroAtAntiFlyArea then return true @@ -395,17 +403,19 @@ function antiFlyArea(gear) heroAtAntiFlyArea = true - if TurnTimeLeft < -1 then - heroVisitedAntiFlyArea = true - TurnTimeLeft = 0 + if not heroVisitedAntiFlyArea then + TurnTimeLeft = 0 FollowGear(hero.gear) - AddAmmo(hero.gear, amJetpack, 0) - AnimSwitchHog(bandit1.gear) + AnimSwitchHog(bandit1.gear) FollowGear(hero.gear) TurnTimeLeft = 0 - else - AddAmmo(hero.gear, amJetpack, 0) - end + end + AddAmmo(hero.gear, amJetpack, 0) + heroVisitedAntiFlyArea = true +end + +function antiFlyAreaVelocity(gear) + SetGearVelocity(hero.gear, 0, 0) end function nonAntiFlyArea(gear) @@ -468,6 +478,8 @@ end if anim == dialog02 then actionsOnWin() + else + AnimSwitchHog(hero.gear) end end