# HG changeset patch # User Wuzzy # Date 1506459251 -7200 # Node ID 9fda510f0bc4b13b7f1f3580cb4b6b5f05ed0980 # Parent 9d069efefe526ee682218e7ed3bec53e95258c9f ACF, mission 3: Fix broken sequence when princess got caged (failed parcours) diff -r 9d069efefe52 -r 9fda510f0bc4 ChangeLog.txt --- a/ChangeLog.txt Tue Sep 26 22:04:09 2017 +0200 +++ b/ChangeLog.txt Tue Sep 26 22:54:11 2017 +0200 @@ -183,6 +183,7 @@ * Mission 2: Fix crash when trying to open ammo menu in opening sequence * Mission 3: Fix various Lua errors when playing with 2 hogs and one of them dies * Mission 3: Fix broken end sequence after killing cyborg or princess + * Mission 3: Fix broken sequence of princess being caged * Mission 3: All girder crates now have 3 girders each * Mission 5: Fix crash when skipping animation while the cyborg talks before the 3rd wave of cannibals starts * Mission 6: Block off left cave entrance to stop player to just rope all the way around diff -r 9d069efefe52 -r 9fda510f0bc4 share/hedgewars/Data/Missions/Campaign/A_Classic_Fairytale/journey.lua --- a/share/hedgewars/Data/Missions/Campaign/A_Classic_Fairytale/journey.lua Tue Sep 26 22:04:09 2017 +0200 +++ b/share/hedgewars/Data/Missions/Campaign/A_Classic_Fairytale/journey.lua Tue Sep 26 22:54:11 2017 +0200 @@ -312,6 +312,20 @@ SpawnUtilityCrate(570, 1357, amLowGravity) end +local trackedGears = {} + +-- Remove mines and crates for the princess cage scene. +-- Some annoying gears might get in the way for this scene, like a dropped +-- mine, or the crate on the leaf. +function ClearTrashForPrincessCage() + for gear, _ in pairs(trackedGears) do + if GetY(gear) > 1600 and GetX(gear) > 1800 and GetX(gear) < 2700 then + DeleteGear(gear) + end + end +end + +-- Dump mines in princess cage function DumpMines() AddGear(2261, 1835, gtMine, 0, 0, 0, 0) AddGear(2280, 1831, gtMine, 0, 0, 0, 0) @@ -401,6 +415,7 @@ table.insert(midAnimAD, {func = AnimSay, args = {leaks, loc("Hey! This is cheating!"), SAY_SHOUT, 4000}}) AddSkipFunction(midAnimAD, SkipMidAnimAlone, {}) + table.insert(failAnimAD, {func = AnimCustomFunction, args = {cyborg, ClearTrashForPrincessCage, {}}}) table.insert(failAnimAD, {func = AnimCustomFunction, swh = false, args = {leaks, RestoreCyborg, {2299, 1687, 2294, 1841}}}) table.insert(failAnimAD, {func = AnimTeleportGear, args = {leaks, 2090, 1841}}) table.insert(failAnimAD, {func = AnimCustomFunction, swh = false, args = {cyborg, SetupKillRoom, {}}}) @@ -414,8 +429,9 @@ table.insert(failAnimAD, {func = AnimSwitchHog, args = {cyborg}}) table.insert(failAnimAD, {func = AnimCustomFunction, args = {cyborg, DumpMines, {}}}) table.insert(failAnimAD, {func = AnimCustomFunction, args = {cyborg, KillPrincess, {}}}) - table.insert(failAnimAD, {func = AnimWait, args = {cyborg, 12000}}) - table.insert(failAnimAD, {func = AnimSay, args = {leaks, loc("No! What have I done?! What have YOU done?!"), SAY_SHOUT, 6000}}) + table.insert(failAnimAD, {func = AnimWait, args = {cyborg, 500}}) + table.insert(failAnimAD, {func = AnimSay, args = {leaks, loc("No! What have I done?! What have YOU done?!"), SAY_SHOUT, 3000}}) + table.insert(failAnimAD, {func = AnimSwitchHog, args = {princess}}) table.insert(endAnimAD, {func = AnimCustomFunction, swh = false, args = {leaks, RestoreCyborg, {437, 1700, 519, 1722}}}) table.insert(endAnimAD, {func = AnimTurn, swh = false, args = {cyborg, "Right"}}) @@ -567,7 +583,6 @@ end function KillPrincess() - DismissTeam(loc("Cannibal Sentry")) EndTurn(true) end --/////////////////////////////Misc Functions//////////////////////// @@ -995,7 +1010,18 @@ CheckEvents() end +-- Track gears for princess cage cleanup +function onGearAdd(gear) + local gt = GetGearType(gear) + if gt == gtCase or gt == gtMine then + trackedGears[gear] = true + end +end + function onGearDelete(gear) + if trackedGears[gear] then + trackedGears[gear] = nil + end if gear == blowCrate then blowTaken = true elseif gear == fireCrate then