share/hedgewars/Data/Missions/Campaign/A_Classic_Fairytale/journey.lua
changeset 12543 9fda510f0bc4
parent 12542 9d069efefe52
child 12554 194b00c4ba07
equal deleted inserted replaced
12542:9d069efefe52 12543:9fda510f0bc4
   310   SpawnAmmoCrate(950, 674, amDynamite)
   310   SpawnAmmoCrate(950, 674, amDynamite)
   311   SpawnUtilityCrate(994, 825, amRope)
   311   SpawnUtilityCrate(994, 825, amRope)
   312   SpawnUtilityCrate(570, 1357, amLowGravity)
   312   SpawnUtilityCrate(570, 1357, amLowGravity)
   313 end
   313 end
   314 
   314 
       
   315 local trackedGears = {}
       
   316 
       
   317 -- Remove mines and crates for the princess cage scene.
       
   318 -- Some annoying gears might get in the way for this scene, like a dropped
       
   319 -- mine, or the crate on the leaf.
       
   320 function ClearTrashForPrincessCage()
       
   321   for gear, _ in pairs(trackedGears) do
       
   322     if GetY(gear) > 1600 and GetX(gear) > 1800 and GetX(gear) < 2700 then
       
   323       DeleteGear(gear)
       
   324     end
       
   325   end
       
   326 end
       
   327 
       
   328 -- Dump mines in princess cage
   315 function DumpMines()
   329 function DumpMines()
   316   AddGear(2261, 1835, gtMine, 0, 0, 0, 0)
   330   AddGear(2261, 1835, gtMine, 0, 0, 0, 0)
   317   AddGear(2280, 1831, gtMine, 0, 0, 0, 0)
   331   AddGear(2280, 1831, gtMine, 0, 0, 0, 0)
   318   AddGear(2272, 1809, gtMine, 0, 0, 0, 0)
   332   AddGear(2272, 1809, gtMine, 0, 0, 0, 0)
   319   AddGear(2290, 1815, gtMine, 0, 0, 0, 0)
   333   AddGear(2290, 1815, gtMine, 0, 0, 0, 0)
   399   table.insert(midAnimAD, {func = AnimTeleportGear, args = {leaks, 2656, 1842}})
   413   table.insert(midAnimAD, {func = AnimTeleportGear, args = {leaks, 2656, 1842}})
   400   table.insert(midAnimAD, {func = AnimCustomFunction, args = {cyborg, HideCyborg, {}}, swh = false})
   414   table.insert(midAnimAD, {func = AnimCustomFunction, args = {cyborg, HideCyborg, {}}, swh = false})
   401   table.insert(midAnimAD, {func = AnimSay, args = {leaks, loc("Hey! This is cheating!"), SAY_SHOUT, 4000}})
   415   table.insert(midAnimAD, {func = AnimSay, args = {leaks, loc("Hey! This is cheating!"), SAY_SHOUT, 4000}})
   402   AddSkipFunction(midAnimAD, SkipMidAnimAlone, {})
   416   AddSkipFunction(midAnimAD, SkipMidAnimAlone, {})
   403 
   417 
       
   418   table.insert(failAnimAD, {func = AnimCustomFunction, args = {cyborg, ClearTrashForPrincessCage, {}}})
   404   table.insert(failAnimAD, {func = AnimCustomFunction, swh = false, args = {leaks, RestoreCyborg, {2299, 1687, 2294, 1841}}})
   419   table.insert(failAnimAD, {func = AnimCustomFunction, swh = false, args = {leaks, RestoreCyborg, {2299, 1687, 2294, 1841}}})
   405   table.insert(failAnimAD, {func = AnimTeleportGear, args = {leaks, 2090, 1841}})
   420   table.insert(failAnimAD, {func = AnimTeleportGear, args = {leaks, 2090, 1841}})
   406   table.insert(failAnimAD, {func = AnimCustomFunction, swh = false, args = {cyborg, SetupKillRoom, {}}})
   421   table.insert(failAnimAD, {func = AnimCustomFunction, swh = false, args = {cyborg, SetupKillRoom, {}}})
   407   table.insert(failAnimAD, {func = AnimTurn, swh = false, args = {cyborg, "Left"}})
   422   table.insert(failAnimAD, {func = AnimTurn, swh = false, args = {cyborg, "Left"}})
   408   table.insert(failAnimAD, {func = AnimTurn, swh = false, args = {princess, "Left"}})
   423   table.insert(failAnimAD, {func = AnimTurn, swh = false, args = {princess, "Left"}})
   412   table.insert(failAnimAD, {func = AnimSay, args = {cyborg, loc("It's time you learned that your actions have consequences!"), SAY_SAY, 7000}})
   427   table.insert(failAnimAD, {func = AnimSay, args = {cyborg, loc("It's time you learned that your actions have consequences!"), SAY_SAY, 7000}})
   413   table.insert(failAnimAD, {func = AnimSay, args = {princess, loc("No! Please, help me!"), SAY_SAY, 4000}})
   428   table.insert(failAnimAD, {func = AnimSay, args = {princess, loc("No! Please, help me!"), SAY_SAY, 4000}})
   414   table.insert(failAnimAD, {func = AnimSwitchHog, args = {cyborg}})
   429   table.insert(failAnimAD, {func = AnimSwitchHog, args = {cyborg}})
   415   table.insert(failAnimAD, {func = AnimCustomFunction, args = {cyborg, DumpMines, {}}})
   430   table.insert(failAnimAD, {func = AnimCustomFunction, args = {cyborg, DumpMines, {}}})
   416   table.insert(failAnimAD, {func = AnimCustomFunction, args = {cyborg, KillPrincess, {}}})
   431   table.insert(failAnimAD, {func = AnimCustomFunction, args = {cyborg, KillPrincess, {}}})
   417   table.insert(failAnimAD, {func = AnimWait, args = {cyborg, 12000}})
   432   table.insert(failAnimAD, {func = AnimWait, args = {cyborg, 500}})
   418   table.insert(failAnimAD, {func = AnimSay, args = {leaks, loc("No! What have I done?! What have YOU done?!"), SAY_SHOUT, 6000}})
   433   table.insert(failAnimAD, {func = AnimSay, args = {leaks, loc("No! What have I done?! What have YOU done?!"), SAY_SHOUT, 3000}})
       
   434   table.insert(failAnimAD, {func = AnimSwitchHog, args = {princess}})
   419 
   435 
   420   table.insert(endAnimAD, {func = AnimCustomFunction, swh = false, args = {leaks, RestoreCyborg, {437, 1700, 519, 1722}}})
   436   table.insert(endAnimAD, {func = AnimCustomFunction, swh = false, args = {leaks, RestoreCyborg, {437, 1700, 519, 1722}}})
   421   table.insert(endAnimAD, {func = AnimTurn, swh = false, args = {cyborg, "Right"}})
   437   table.insert(endAnimAD, {func = AnimTurn, swh = false, args = {cyborg, "Right"}})
   422   table.insert(endAnimAD, {func = AnimTurn, swh = false, args = {princess, "Right"}})
   438   table.insert(endAnimAD, {func = AnimTurn, swh = false, args = {princess, "Right"}})
   423   table.insert(endAnimAD, {func = AnimSay, args = {princess, loc("Help me, Leaks!"), SAY_SHOUT, 3000}})
   439   table.insert(endAnimAD, {func = AnimSay, args = {princess, loc("Help me, Leaks!"), SAY_SHOUT, 3000}})
   565   pastFlowerAnim = pastFlowerAnimRL
   581   pastFlowerAnim = pastFlowerAnimRL
   566   outPitAnim = outPitAnimRL
   582   outPitAnim = outPitAnimRL
   567 end
   583 end
   568 
   584 
   569 function KillPrincess()
   585 function KillPrincess()
   570   DismissTeam(loc("Cannibal Sentry"))
       
   571   EndTurn(true)
   586   EndTurn(true)
   572 end
   587 end
   573 --/////////////////////////////Misc Functions////////////////////////
   588 --/////////////////////////////Misc Functions////////////////////////
   574 
   589 
   575 function HideHedge(hedge)
   590 function HideHedge(hedge)
   993   end
  1008   end
   994   ExecuteAfterAnimations()
  1009   ExecuteAfterAnimations()
   995   CheckEvents()
  1010   CheckEvents()
   996 end
  1011 end
   997 
  1012 
       
  1013 -- Track gears for princess cage cleanup
       
  1014 function onGearAdd(gear)
       
  1015   local gt = GetGearType(gear)
       
  1016   if gt == gtCase or gt == gtMine then
       
  1017     trackedGears[gear] = true
       
  1018   end
       
  1019 end
       
  1020 
   998 function onGearDelete(gear)
  1021 function onGearDelete(gear)
       
  1022   if trackedGears[gear] then
       
  1023     trackedGears[gear] = nil
       
  1024   end
   999   if gear == blowCrate then
  1025   if gear == blowCrate then
  1000     blowTaken = true
  1026     blowTaken = true
  1001   elseif gear == fireCrate then
  1027   elseif gear == fireCrate then
  1002     fireTaken = true
  1028     fireTaken = true
  1003   elseif gear == gravityCrate then
  1029   elseif gear == gravityCrate then