share/hedgewars/Data/Missions/Campaign/A_Space_Adventure/cosmos.lua
changeset 12523 94bba599efd3
parent 12522 193b5882429d
child 12524 206cb38d030f
equal deleted inserted replaced
12522:193b5882429d 12523:94bba599efd3
    52 local guard2 = {}
    52 local guard2 = {}
    53 -- teams
    53 -- teams
    54 local teamA = {}
    54 local teamA = {}
    55 local teamB = {}
    55 local teamB = {}
    56 local teamC = {}
    56 local teamC = {}
       
    57 -- to check if flying saucer is active
       
    58 local saucerGear = nil
    57 -- hedgehogs values
    59 -- hedgehogs values
    58 hero.name = loc("Hog Solo")
    60 hero.name = loc("Hog Solo")
    59 hero.x = 1450
    61 hero.x = 1450
    60 hero.y = 1550
    62 hero.y = 1550
    61 director.name = loc("H")
    63 director.name = loc("H")
   273 		return true
   275 		return true
   274 	end
   276 	end
   275 	return false
   277 	return false
   276 end
   278 end
   277 
   279 
       
   280 function onGearAdd(gear)
       
   281 	if GetGearType(gear) == gtJetpack then
       
   282 		saucerGear = gear
       
   283 	end
       
   284 end
       
   285 
   278 function onGearDelete(gear)
   286 function onGearDelete(gear)
   279 	if GetGearType(gear) == gtCase and band(GetGearMessage(gear), gmDestroy) ~= 0 then
   287 	if GetGearType(gear) == gtCase and band(GetGearMessage(gear), gmDestroy) ~= 0 then
   280 		heroAtSaucerPosition()
   288 		heroAtSaucerPosition()
       
   289 	elseif GetGearType(gear) == gtJetpack then
       
   290 		saucerGear = nil
   281 	end
   291 	end
   282 end
   292 end
   283 
   293 
   284 function onHeroOutOfGuardSight(gear)
   294 function onHeroOutOfGuardSight(gear)
   285 	if GetHealth(hero.gear) and GetX(gear) < 3100 and GetY(gear) > saucerY-25 and StoppedGear(gear) and not guard1.keepTurning then
   295 	if GetHealth(hero.gear) and GetX(gear) < 3100 and GetY(gear) > saucerY-25 and StoppedGear(gear) and not guard1.keepTurning then
   330 	return false
   340 	return false
   331 end
   341 end
   332 
   342 
   333 function onNoFuelAtLand(gear)
   343 function onNoFuelAtLand(gear)
   334 	if checkPointReached > 1 and GetHealth(hero.gear) and GetY(gear) > 1400 and
   344 	if checkPointReached > 1 and GetHealth(hero.gear) and GetY(gear) > 1400 and
   335 			GetAmmoCount(gear, amJetpack) == 0 and StoppedGear(gear) then
   345 			GetAmmoCount(gear, amJetpack) == 0 and saucerGear == nil and StoppedGear(gear) then
   336 		return true
   346 		return true
   337 	end
   347 	end
   338 	return false
   348 	return false
   339 end
   349 end
   340 
   350