278 |
278 |
279 local abandonCheck = false |
279 local abandonCheck = false |
280 |
280 |
281 function onNewTurn() |
281 function onNewTurn() |
282 if ropedToMoon == 1 then |
282 if ropedToMoon == 1 then |
283 SetInputMask(0) |
283 AnimSetInputMask(0) |
284 sendStatsOnRopedToMoon() |
284 sendStatsOnRopedToMoon() |
285 return |
285 return |
286 end |
286 end |
287 if saucerAcquired then |
287 if saucerAcquired then |
288 -- The only way for the player to have a saucer at turn start is by having used the rope |
288 -- The only way for the player to have a saucer at turn start is by having used the rope |
411 end |
411 end |
412 end |
412 end |
413 |
413 |
414 function prepareDialog02(gear) |
414 function prepareDialog02(gear) |
415 if StoppedGear(gear) and guard1.keepTurning and checkPointReached < 2 then |
415 if StoppedGear(gear) and guard1.keepTurning and checkPointReached < 2 then |
416 SetGearMessage(gear, 0) |
416 SetGearMessage(gear, band(GetGearMessage(gear), bnot(gmLeft+gmRight+gmUp+gmDown+gmPrecise))) |
417 EndTurn(true) |
417 EndTurn(true) |
418 -- save check point |
418 -- save check point |
419 SaveCampaignVar("CosmosCheckPoint", "2") |
419 SaveCampaignVar("CosmosCheckPoint", "2") |
420 checkPointReached = 2 |
420 checkPointReached = 2 |
421 AddAnim(dialog02) |
421 AddAnim(dialog02) |
426 |
426 |
427 function heroAcquiredSaucer(gear) |
427 function heroAcquiredSaucer(gear) |
428 -- check if he was spotted by the guard |
428 -- check if he was spotted by the guard |
429 if guard1.turn and guard1.keepTurning and GetX(gear) > saucerX-150 then |
429 if guard1.turn and guard1.keepTurning and GetX(gear) > saucerX-150 then |
430 guard1.keepTurning = false |
430 guard1.keepTurning = false |
431 SetGearVelocity(gear, 0, 0) |
431 SetGearMessage(gear, band(GetGearMessage(gear), bnot(gmLeft+gmRight+gmUp+gmDown+gmPrecise))) |
|
432 local _, dy = GetGearVelocity(gear) |
|
433 SetGearVelocity(gear, 0, dy) |
432 AddAnim(dialog03) |
434 AddAnim(dialog03) |
433 end |
435 end |
434 |
436 |
435 prepareDialog02(gear) |
437 prepareDialog02(gear) |
436 end |
438 end |
438 function onHeroAcquiredSaucer(gear) |
440 function onHeroAcquiredSaucer(gear) |
439 return saucerAcquired |
441 return saucerAcquired |
440 end |
442 end |
441 |
443 |
442 function heroOutOfGuardSight(gear) |
444 function heroOutOfGuardSight(gear) |
443 SetGearMessage(hero.gear, 0) |
445 SetGearMessage(gear, 0) |
444 guard1.keepTurning = true |
446 guard1.keepTurning = true |
445 AddAnim(dialog04) |
447 AddAnim(dialog04) |
446 |
448 |
447 if onHeroAcquiredSaucer(gear) then |
449 if onHeroAcquiredSaucer(gear) then |
448 prepareDialog02(gear) |
450 prepareDialog02(gear) |
454 -- Player climbed the moon with rope. |
456 -- Player climbed the moon with rope. |
455 -- THIS IS A CRIMINAL OFFENSE AND WILL BE PUNISHED! |
457 -- THIS IS A CRIMINAL OFFENSE AND WILL BE PUNISHED! |
456 ropedToMoon = 1 |
458 ropedToMoon = 1 |
457 SetGearVelocity(gear, 0, 0) |
459 SetGearVelocity(gear, 0, 0) |
458 SetGearMessage(gear, 0) |
460 SetGearMessage(gear, 0) |
459 SetInputMask(0) |
461 AnimSetInputMask(0) |
460 AddAnim(dialog09) |
462 AddAnim(dialog09) |
461 else |
463 else |
462 if checkPointReached ~= 5 then |
464 if checkPointReached ~= 5 then |
463 SaveCampaignVar("CosmosCheckPoint", "4") |
465 SaveCampaignVar("CosmosCheckPoint", "4") |
464 SaveCampaignVar("HeroHealth",GetHealth(hero.gear)) |
466 SaveCampaignVar("HeroHealth",GetHealth(hero.gear)) |
481 AddGear(GetX(gear), 0, gtShell, 0, 0, 0, 0) |
483 AddGear(GetX(gear), 0, gtShell, 0, 0, 0, 0) |
482 AddGear(GetX(gear), -100, gtShell, 0, 0, 0, 0) |
484 AddGear(GetX(gear), -100, gtShell, 0, 0, 0, 0) |
483 AddGear(GetX(gear), -200, gtShell, 0, 0, 0, 0) |
485 AddGear(GetX(gear), -200, gtShell, 0, 0, 0, 0) |
484 AddGear(GetX(gear), -300, gtShell, 0, 0, 0, 0) |
486 AddGear(GetX(gear), -300, gtShell, 0, 0, 0, 0) |
485 FollowGear(hero.gear) |
487 FollowGear(hero.gear) |
486 SetInputMask(0) |
488 AnimSetInputMask(0) |
487 end |
489 end |
488 |
490 |
489 function fruitPlanetLanding(gear) |
491 function fruitPlanetLanding(gear) |
490 if checkPointReached < 5 then |
492 if checkPointReached < 5 then |
491 AddAnim(dialog06) |
493 AddAnim(dialog06) |
624 function Skipanim(anim) |
626 function Skipanim(anim) |
625 if goals[anim] ~= nil then |
627 if goals[anim] ~= nil then |
626 ShowMission(unpack(goals[anim])) |
628 ShowMission(unpack(goals[anim])) |
627 end |
629 end |
628 if anim == dialog09 then |
630 if anim == dialog09 then |
629 SetInputMask(0) |
631 AnimSetInputMask(0) |
630 -- Quick punishment for the impatient |
632 -- Quick punishment for the impatient |
631 AddGear(GetX(hero.gear)-1, GetY(hero.gear)+1, gtDynamite, 0, 0, 0, 1) |
633 AddGear(GetX(hero.gear)-1, GetY(hero.gear)+1, gtDynamite, 0, 0, 0, 1) |
632 sendStatsOnRopedToMoon() |
634 sendStatsOnRopedToMoon() |
633 elseif anim == dialog05 then |
635 elseif anim == dialog05 then |
634 sendStatsOnStuckOnMoon() |
636 sendStatsOnStuckOnMoon() |