share/hedgewars/Data/Missions/Campaign/A_Space_Adventure/death02.lua
changeset 12575 0c5ce463949b
parent 12565 392f90c79b78
child 12577 e2b5c6e805e8
equal deleted inserted replaced
12574:2a7cc304c8be 12575:0c5ce463949b
    20 	loc("The rope won't get reset.")
    20 	loc("The rope won't get reset.")
    21 -- dialogs
    21 -- dialogs
    22 local dialog01 = {}
    22 local dialog01 = {}
    23 -- mission objectives
    23 -- mission objectives
    24 local goals = {
    24 local goals = {
    25 	[dialog01] = {missionName, loc("Challenge objectives"), challengeObjectives, 1, 4500},
    25 	["init"] = {missionName, loc("Challenge objectives"), challengeObjectives, 1, 35000},
    26 }
    26 }
    27 -- hogs
    27 -- hogs
    28 local hero = {
    28 local hero = {
    29 	name = loc("Hog Solo"),
    29 	name = loc("Hog Solo"),
    30 	x = 850,
    30 	x = 850,
    51 	name = loc("5 Deadly Hogs"),
    51 	name = loc("5 Deadly Hogs"),
    52 	color = tonumber("FF0000",16) -- red
    52 	color = tonumber("FF0000",16) -- red
    53 }
    53 }
    54 -- After hero killed an enemy, his weapons will be reset in the next round
    54 -- After hero killed an enemy, his weapons will be reset in the next round
    55 local heroWeaponResetPending = false
    55 local heroWeaponResetPending = false
       
    56 local battleStarted = false
    56 
    57 
    57 -------------- LuaAPI EVENT HANDLERS ------------------
    58 -------------- LuaAPI EVENT HANDLERS ------------------
    58 
    59 
    59 function onGameInit()
    60 function onGameInit()
    60 	Seed = 1
    61 	Seed = 1
    88 end
    89 end
    89 
    90 
    90 function onGameStart()
    91 function onGameStart()
    91 	AnimWait(hero.gear, 3000)
    92 	AnimWait(hero.gear, 3000)
    92 	FollowGear(hero.gear)
    93 	FollowGear(hero.gear)
    93 	ShowMission(missionName, loc("Challenge Objectives"), challengeObjectives, -amSkip, 0)
    94 	ShowMission(unpack(goals["init"]))
    94 
    95 
    95 	AddEvent(onHeroDeath, {hero.gear}, heroDeath, {hero.gear}, 0)
    96 	AddEvent(onHeroDeath, {hero.gear}, heroDeath, {hero.gear}, 0)
    96 	AddEvent(onHeroWin, {hero.gear}, heroWin, {hero.gear}, 0)
    97 	AddEvent(onHeroWin, {hero.gear}, heroWin, {hero.gear}, 0)
    97 
    98 
    98 	--hero ammo
    99 	--hero ammo
   152 	end
   153 	end
   153 	ExecuteAfterAnimations()
   154 	ExecuteAfterAnimations()
   154 	CheckEvents()
   155 	CheckEvents()
   155 end
   156 end
   156 
   157 
       
   158 -- Hide mission panel when player does anything
       
   159 function hideMissionOnAction()
       
   160 	if battleStarted then
       
   161 		HideMission()
       
   162 	end
       
   163 end
       
   164 
       
   165 onHogAttack = hideMissionOnAction
       
   166 onAttack = hideMissionOnAction
       
   167 onLeft = hideMissionOnAction
       
   168 onRight = hideMissionOnAction
       
   169 onUp = hideMissionOnAction
       
   170 onDown = hideMissionOnAction
       
   171 onLJump = hideMissionOnAction
       
   172 onHJump = hideMissionOnAction
       
   173 onSlot = hideMissionOnAction
       
   174 onSetWeapon = hideMissionOnAction
       
   175 onTimer = hideMissionOnAction
       
   176 
   157 function onPrecise()
   177 function onPrecise()
   158 	if GameTime > 3000 then
   178 	if GameTime > 3000 then
   159 		SetAnimSkip(true)
   179 		SetAnimSkip(true)
   160 	end
   180 	end
   161 end
   181 end
   212 end
   232 end
   213 
   233 
   214 -------------- ANIMATIONS ------------------
   234 -------------- ANIMATIONS ------------------
   215 
   235 
   216 function Skipanim(anim)
   236 function Skipanim(anim)
   217 	if goals[anim] ~= nil then
   237 	startBattle()
   218 		ShowMission(unpack(goals[anim]))
       
   219     end
       
   220     startBattle()
       
   221 end
   238 end
   222 
   239 
   223 function AnimationSetup()
   240 function AnimationSetup()
   224 	-- DIALOG 01 - Start, game instructions
   241 	-- DIALOG 01 - Start, game instructions
   225 	AddSkipFunction(dialog01, Skipanim, {dialog01})
   242 	AddSkipFunction(dialog01, Skipanim, {dialog01})
   238 end
   255 end
   239 
   256 
   240 ------------ Other Functions -------------------
   257 ------------ Other Functions -------------------
   241 
   258 
   242 function startBattle()
   259 function startBattle()
       
   260 	battleStarted = true
   243 	AnimSwitchHog(hero.gear)
   261 	AnimSwitchHog(hero.gear)
   244 	TurnTimeLeft = TurnTime
   262 	TurnTimeLeft = TurnTime
   245 end
   263 end
   246 
   264 
   247 function shuffleHogs(hogs)
   265 function shuffleHogs(hogs)