// This initializes music and does some other important stuff
IfSpawned
  //Play the default module music track
  tmpargument = 2
  tmpdistance = 0
  PlayMusic

  //Play the rockfall effects when the player spawns
  tmpargument = 0
  PlayFullSound
  
  //Spawn some scattered rocks
  tmpargument = 2
  tmpdistance = 0
  tmpx = selfx
  tmpy = selfy
  SpawnExactParticle
  SpawnExactParticle
  SpawnExactParticle
  SpawnExactParticle
  SpawnExactParticle
  SpawnExactParticle
  SpawnExactParticle
  SpawnExactParticle
  SpawnExactParticle
  SpawnExactParticle
  SpawnExactParticle
  SpawnExactParticle

  //Make some stones fall from the skies
  tmpargument = 0
  tmpdistance = 1200
  tmpx = selfx
  tmpy = selfy
  SpawnExactParticle
  SpawnExactParticle
  SpawnExactParticle
  SpawnExactParticle
  SpawnExactParticle
  SpawnExactParticle
  SpawnExactParticle

  //Make stuff fall into pits
  tmpx = 44 < 7
  tmpy = 37 < 7
  tmpdistance = 700
  PitsFall
  
//Enable escape
IfOrdered
  tmpx = selforder
  tmpy = [EXIT]
  IfXIsEqualToY
    tmpargument = 1
    SetState
    
//Look for escapers
IfTimeOut
  tmpargument = rand & 7 + 15
  SetTime
  IfStateIs1
    tmpargument = 0
    SetTargetToWhoeverIsInPassage
    IfTargetIsAPlayer
    
      //Add some end text
      ClearEndMessage
      tmpargument = 0
      AddEndMessage
      tmpargument = 1
      AddEndMessage
      tmpargument = 2
      AddEndMessage
      tmpargument = 3
      AddEndMessage
      tmpargument = 4
      AddEndMessage
      tmpargument = 5
      AddEndMessage  
      
      //Just to be nice, we restock the camera ammo
      tmpargument = [CAME]
      RestockTargetAmmoIDFirst
    
      //Finish it
      BeatModule
      EnableExport
      tmpargument = [BEAT]
      AddIDSZ
      EndModule
      
End					// All done
