/* "tweaker".set("character.vulnerable", false) */

/* Preload sounds */
sound("preload", "lift1_mono.wav")
sound("preload", "switch_1.wav")
sound("preload", "lift2_mono.wav")
sound("preload", "owdoor01_open.wav")
sound("preload", "fill_1.wav")
sound("preload", "fill_2.wav")
sound("preload", "so_1.wav")
sound("preload", "so_2.wav")
sound("preload", "tract_statue_1.wav")
sound("preload", "ambience_owcorr01.wav")
sound("preload", "ambience_owcave01.wav")
sound("preload", "ambience_owlift01.wav")

/* sound("preload", "margoss_music.wav") */
sound("preload", "margoss_scene.wav")

/* Zone ambiences (thanks Yannick) */
sound("ambience", "zone_owcave01", "ambience_owcave01.wav", 0.015)
sound("ambience", "zone_owent", "ambience_owlift01.wav", 0.002)
sound("ambience", "zone_owlift01", "ambience_owlift01.wav", 0.005)
sound("ambience", "zone_owtun01", "ambience_owlift01.wav", 0.002)
sound("ambience", "zone_owcorr01", "ambience_owcorr01.wav", 0.005)

//
// Computer Room Bridges
//
rule :=
(L := "owent_bridge01") >> init ->
{
     L.sound("start", "bridge_mono.wav")
     L.distanceMin(8)
     L.distanceMax(1000)
}


rule :=
(L := "owent_bridge02") >> init ->
{
     L.sound("start", "bridge_mono.wav")
     L.distanceMin(8)
     L.distanceMax(1000)
}

rule :=
(L := "owent_bridge03") >> init ->
{
     L.sound("start", "bridge_mono.wav")
     L.distanceMin(8)
     L.distanceMax(1000)
}

//
// pre-Margoss lift
//
rule :=
(L := "owcorr01_bridge01") >> init ->
{
     L.sound("start", "bridge_mono.wav")
     L.distanceMin(8)
     L.distanceMax(1000)
}

/* Lifts */
/* Computer room lift */
rule :=
( L := "lift01" ) >> init ->
{
   L.animation(0, "lift")
   L.sound("start", "lift1_mono.wav")
   L.distanceMin(20)
   L.distanceMax(301)
}

/*
rule :=
( L := "downstairs_lift" ) >> init ->
{
   L.animation(0, "door")
   L.sound("start", "switch_1.wav")
   L.distanceMin(2)
   L.distanceMax(301)
}
*/

/*
rule :=
( L := "upstairs_doors_open" ) >> init ->
{
   L.animation(0, "door")
   L.sound("start", "switch_1.wav")
   L.distanceMin(2)
   L.distanceMax(301)
}
*/

rule :=
"trig_lift_owlift01" >> entered("janseth") -> [1]
{
     "lift01".state(1)
//   "downstairs_lift".state(0)
}

/*
rule :=
"trig_lift_owlift01_2" >> entered("janseth") -> [1]
{
//   "so_owlift01_1".active(false)
//   "so_owlift01_1".distanceMin(3)
//   "so_owlift01_1".distanceMax(400)
//   "so_owlift01_barrier".active(false)
//   "so_owtun01_barrier".active(false)
//   "door05".lock(false)
//   active("FX_orb",false)
//   "light_owlift01_omni01".intensity(1.0, 2.0)
//   "light_owlift01_omni02".intensity(1.0, 2.0)
//   "light_owlift01_omni03".intensity(1.0, 2.0)
//   "light_owlift01_omni04".intensity(1.0, 2.0)
//   "light_owlift01_omni05".intensity(1.0, 2.0)
//   active("FX_shieldtrail", false)
//   active("FX_shieldtrail1", false)
//   active("FX_shieldtrail2", false)
//   active("FX_shieldtrail3", false)
//   active("FX_shieldtrail4", false)
//   active("FX_shieldtrail5", false)
//   active("FX_shieldtrail6", false)
//   active("FX_shieldtrail7", false)
//   active("FX_shieldtrail8", false)
//   active("FX_shieldtrail9", false)
//   active("FX_shieldtrail10", false)
//   active("FX_shieldtrail11", false)
//   active("FX_shieldtrail12", false)
//   pause(3)
//   "upstairs_doors_open".state(1)
}
*/

/* Pre-Margoss Lift*/
rule :=
( L := "lift02" ) >> init ->
{
   L.sound("start", "lift2_mono.wav")
   L.distanceMin(200)
   L.distanceMax(301)
}
/*
rule :=
"trig_lift_owcorr01" >> entered("janseth") -> [1]
{
     "lift02".state(0)
}

rule :=
"trig_lift_owcorr01_2" >> entered("janseth") -> [1]
{
     "lift02".state(1)
}
*/

/*
rule :=
"trig_lift_owcorr01_1" >> entered("janseth") -> [1]
{
     "lift02".state(1)
}
*/

/* The Margoss Lift */
rule :=
( L := "lift03" ) >> init ->
{
   L.animation(0, "lift")
}

rule :=
"trig_lift_owmaze" >> entered("janseth") -> [1]
{
     "lift03".state(1)
}

/* Doors sounds */

rule :=
( D := "door01" ) >> init ->
{
     D.sound("start", "owdoor01_open.wav")
     D.distanceMin(1)
}

rule :=
( D := "door02" ) >> init ->
{
     D.sound("start", "owdoor01_open.wav")
     D.distanceMin(1)
}

rule :=
( D := "door03" ) >> init ->
{
     D.sound("start", "owdoor01_open.wav")
     D.distanceMin(1)
}

rule :=
( D := "door05" ) >> init ->
{
     D.sound("start", "owdoor01_open.wav")
     D.distanceMin(1)
//   D.lock(true)
}

rule :=
( D := "door06" ) >> init ->
{
     D.sound("start", "owdoor01_open.wav")
     D.distanceMin(1)
}

/* Triggered audio */
rule :=
"trig_audio_owlift01_1" >> entered("janseth") -> [1]
{
     sound("create", "", "fill_1.wav", false, 0.2, "play")
}

rule :=
"trig_audio_owcave01_1" >> entered("janseth") -> [1]
{
     sound("create", "", "fill_1.wav", false, 0.2, "play")

     /* Initialise effects */
     active("FX_orb", false)
     active("FX_orb2", false)
     active("FX_shieldtrail", false)
     active("FX_shieldtrail1", false)
     active("FX_shieldtrail2", false)
     active("FX_shieldtrail3", false)
     active("FX_shieldtrail4", false)
     active("FX_shieldtrail5", false)
     active("FX_shieldtrail6", false)
     active("FX_shieldtrail7", false)
     active("FX_shieldtrail8", false)
     active("FX_shieldtrail9", false)
     active("FX_shieldtrail10", false)
     active("FX_shieldtrail11", false)
     active("FX_shieldtrail12", false)
     active("FX_alarm", false)
}

rule :=
"trig_audio_owtun01_1" >> entered("janseth") -> [1]
{
     sound("create", "", "fill_2.wav", false, 0.1, "play")
}

rule :=
"trig_audio_owcorr01_1" >> entered("janseth") -> [1]
{
     sound("create", "", "fill_1.wav", false, 0.1, "play")
}

rule :=
"trig_audio_owcorr01_2" >> entered("janseth") -> [1]
{
     /* sound("create", "", "margoss_music.wav", false, 1.0, "play") */
}

/* Sound objects */
/*
rule :=
( S := "so_owtun01_barrier" ) >> init ->
{
   S.sound("so_3.wav")
   S.volume(1.0)
   S.distanceMin(1.0)
   S.distanceMax(400)
   S.active(false)
}
*/

/*
rule :=
( S := "so_owlift01_barrier" ) >> init ->
{
   S.sound("so_3_2.wav")
   S.volume(1.0)
   S.distanceMin(1.0)
   S.distanceMax(400)
   S.active(false)
}
*/

rule :=
( S := "so_owent_1" ) >> init ->
{
   S.sound("so_1.wav")
   S.volume(1.0)
   S.distanceMin(1.5)
   S.distanceMax(400)
}

rule :=
( S := "so_owent_2" ) >> init ->
{
   S.sound("so_1.wav")
   S.volume(1.0)
   S.distanceMin(1.5)
   S.distanceMax(400)
}

rule :=
( S := "so_owlift01_1" ) >> init ->
{
   S.sound("so_2.wav")
   S.volume(1.0)
   S.distanceMin(3)
   S.distanceMax(400)
}

rule :=
( S := "so_owtun01_1" ) >> init ->
{
   S.sound("so_1.wav")
   S.volume(0.9)
   S.distanceMin(1)
   S.distanceMax(400)
}

rule :=
( S := "so_owtun01_2" ) >> init ->
{
   S.sound("so_1.wav")
   S.volume(0.9)
   S.distanceMin(1)
   S.distanceMax(400)
}

rule :=
( S := "so_owtun01_3" ) >> init ->
{
   S.sound("so_1.wav")
   S.volume(0.8)
   S.distanceMin(1)
   S.distanceMax(400)
}

rule :=
( S := "so_owcorr01_1" ) >> init ->
{
   S.sound("tract_statue_1.wav")
   S.volume(1.0)
   S.distanceMin(2.0)
   S.distanceMax(400)
}

rule :=
( S := "so_owcorr01_2" ) >> init ->
{
   S.sound("tract_statue_1.wav")
   S.volume(1.0)
   S.distanceMin(2.0)
   S.distanceMax(400)
}

/* Switches */
/* Lift 2 switch #1 */
/*
rule :=
"lift02_switch01" >> state(true) ->
{
   "lift02".state(1)
}
*/

/* Lift 2 switch #1 */
/*
rule :=
"lift02_switch02" >> state(true) ->
{
   "lift02".state(1)
}
*/

/* Bottom of computer room */
/*
rule :=
( S := "door02_switch01" ) >> state(true) ->
{
     "downstairs_lift".state(1)
     S.sound("sekkos_ricochet_1.wav")
}
*/

/* Switch at the bottom of the computer room - open the glass doors */
/*
rule :=
"trig_owlift01_downstairs_door" >> entered("janseth") -> [1]
{
     "downstairs_lift".state(1)
}
*/

/* Trigger Box to activate the alarm in the upstairs computer room */
/*
rule :=
"trig_audio_owlift01_3" >> entered("janseth") -> [1]
{
    sound("create", "", "fill_6.wav", false, 1.0, "play")
    "so_owlift01_1".sound("so_2_tail.wav")
//  "door02".lock(true)
//  "so_owlift01_barrier".active(true)
//  "so_owtun01_barrier".active(true)
//  "light_owlift01_omni01".intensity(0.3, 8.0)
//  "light_owlift01_omni02".intensity(0.1, 8.0)
//  "light_owlift01_omni03".intensity(0.1, 8.0)
//  "light_owlift01_omni04".intensity(0.1, 8.0)
//  "light_owlift01_omni05".intensity(0.1, 8.0)
//  active("FX_orb2", true)
//  active("FX_shieldtrail", true)
//  active("FX_shieldtrail1", true)
//  active("FX_shieldtrail2", true)
//  active("FX_shieldtrail3", true)
//  active("FX_shieldtrail4", true)
//  active("FX_shieldtrail5", true)
//  active("FX_shieldtrail6", true)
//  active("FX_shieldtrail7", true)
//  active("FX_shieldtrail8", true)
//  active("FX_shieldtrail9", true)
//  active("FX_shieldtrail10", true)
//  active("FX_shieldtrail11", true)
//  active("FX_shieldtrail12", true)
    pause(8)
//  "light_owlift01_omni01".color( # [ 1.0, 0.33, 0.33 ], 2.0)
//  "light_owlift01_omni02".color( # [ 1.0, 0.33, 0.33 ], 2.0)
//  "light_owlift01_omni03".color( # [ 1.0, 0.33, 0.33 ], 2.0)
//  "light_owlift01_omni04".color( # [ 1.0, 0.33, 0.33 ], 2.0)
//  "light_owlift01_omni05".color( # [ 1.0, 0.33, 0.33 ], 2.0)
    "so_owlift01_1".sound("alarm_loop_1_mono.wav")
    "so_owlift01_1".distanceMin(4)
    "so_owlift01_1".distanceMax(400)
}
*/

/* Final Margoss room */
rule :=
"trigend" >> entered("janseth") -> [1]
{
    sound("create", "", "margoss_scene.wav", false, 1.0, "play")
}

//
// Initialise switch sounds
rule :=
(L := "owsec01_sym20") >> init ->
{
    L.sound("switch_2.wav")
}

rule :=
(L := "owent_switch01") >> init ->
{
    L.sound("switch_2.wav")
}

rule :=
(L := "owent_switch02") >> init ->
{
    L.sound("switch_2.wav")
}

rule :=
(L := "owent_switch03") >> init ->
{
    L.sound("switch_2.wav")
}

rule :=
(L := "owent_switch04") >> init ->
{
    L.sound("switch_2.wav")
}

rule :=
(L := "owent_switch05") >> init ->
{
    L.sound("switch_2.wav")
}

rule :=
(L := "owent_switch06") >> init ->
{
    L.sound("switch_2.wav")
}

rule :=
(L := "owent_switch07") >> init ->
{
    L.sound("switch_2.wav")
}

rule :=
(L := "owent_switch08") >> init ->
{
    L.sound("switch_2.wav")
}

rule :=
(L := "owent_switch09") >> init ->
{
    L.sound("switch_2.wav")
}

rule :=
(L := "owent_switch10") >> init ->
{
    L.sound("switch_2.wav")
}

rule :=
(L := "owent_switch11") >> init ->
{
    L.sound("switch_2.wav")
}

rule :=
(L := "owent_switch12") >> init ->
{
    L.sound("switch_2.wav")
}

rule :=
(L := "owent_switch13") >> init ->
{
    L.sound("switch_2.wav")
}

rule :=
(L := "owent_switch14") >> init ->
{
    L.sound("switch_2.wav")
}

rule :=
(L := "owcorr01_switch15") >> init ->
{
    L.sound("switch_2.wav")
}

rule :=
(L := "owcorr01_switch16") >> init ->
{
    L.sound("switch_2.wav")
}

//
// Audio for the "trap"
//
// First, the stone slab
rule :=
(L := "owcorr01_walltrap02") >> init ->
{
   L.sound("start", "slab.wav")
   L.distanceMin(20)
   L.distanceMax(301)
}

// Second, the tract statue that gets raised
rule :=
(L := "owcorr01_tracthead02") >> init ->
{
   L.sound("start", "tract_statue.wav")
   L.distanceMin(20)
   L.distanceMax(301)
}

//
// Jan Seth's lines of dialogue
//
// "I'd better keep an eye on that scanner..."
/*
rule :=
"trig_audio_js_line1" >> entered("janseth") -> [1]
{
     sound("create", "", "line1_22.wav", false, 0.6, "play")
}
*/

// Looks like he's stopped for now...

// He's on the move again - this is in Murielle's script

/* technoghost init*/

rule :=
"technoghost" >> init ->
{
   display("technoghost is at start wp")    
   "technoghost".setToWaypoint(Group("technoghost_wp_start"))
   "tweaker".set("technomancer.perimeterDistance", 154.0)
}

/* technoghost path */


technoWalkFlag := false
technoWalk := function()
{
	if not technoWalkFlag
	then
	{
		technoWalkFlag := true
  	
	"technoghost".addWaypoint("technoghost_wp_09", 5.9)
	display("technog moves to wp9")
	"technoghost".addWaypoint("technoghost_wp_10", 5.95)
	display("technog moves to wp10")
	"technoghost".addWaypoint("technoghost_wp_11", 6.15)
	display("technog moves to wp11")
	"technoghost".addWaypoint("technoghost_wp_12", 6.22)
	display("technog moves to wp12")
	"technoghost".addWaypoint("technoghost_wp_13", 6.43)
	display("technog moves to wp13")
	"technoghost".addWaypoint("technoghost_wp_14", 6.5)
	display("technog moves to wp14")
	}
}


/*
technowalksoundFlag := false
technowalksound := function()
{
	if not technowalksoundFlag
	then
	{
		technowalksoundFlag := true
  	
	sound("create", "", "line3_22.wav", false, 0.4, "play")
	
	}
}
*/

/*
technoWalkFlag2 := false
technoWalk2 := function()
{
	if not technoWalkFlag2
	then
	{
		technoWalkFlag2 := true
  	
	"technoghost".addWaypoint("technoghost_wp_08", 5.9)
	display("technog moves to wp8")
	
	}
}
*/

rule :=
"trigstart" >> entered("janseth") -> [1]

{
        display("jan enters trigstart")
	"technoghost".addWaypoint("technoghost_wp_01", 5.2)
	display("technog moves to wp1")
	"technoghost".addWaypoint("technoghost_wp_02", 5.4)
	display("technog moves to wp2")
	"technoghost".addWaypoint("technoghost_wp_03", 5.5)
	display("technog moves to wp3")
	"technoghost".addWaypoint("technoghost_wp_04", 5.6)
	display("technog moves to wp4")
	"technoghost".addWaypoint("technoghost_wp_05", 5.7)
	display("technog moves to wp5")
	"technoghost".addWaypoint("technoghost_wp_06", 5.75)
	display("technog moves to wp6")
	"technoghost".addWaypoint("technoghost_wp_07", 5.8)
	display("technog moves to wp7")
	"technoghost".addWaypoint("technoghost_wp_08", 5.8)
	display("technog moves to wp8")
	
}

/*
rule :=
  ( T := "technoghost" ) >> arrivedAtWaypoint(Group("technoghost_wp_07")) ->
 {
   display("techno is at wp7")
   pause(220)
   technoWalk2() 
 }
*/

/*
rule :=
"trig02esk" >> entered("janseth") -> [1]

{
   technoWalk2()  
}
*/
rule :=
  ( T := "technoghost" ) >> arrivedAtWaypoint(Group("technoghost_wp_08")) ->
 {
   display("techno is at wp8")
   "tweaker".set("technomancer.perimeterDistance", 146.8) 
   pause(220)
   technoWalk()
   /*technowalksound()*/
 }


rule :=
"trigentropic" >> entered("janseth") -> [1]

{
   technoWalk()
   /*technowalksound()*/
}


/*Computer rooms puzzle init*/


rule :=
(L := "owent_bridge01") >> init ->
{
     L.animation(0, "bridge")
}


rule :=
(L := "owent_bridge02") >> init ->
{
     L.animation(0, "bridge")
}

rule :=
(L := "owent_bridge03") >> init ->
{
     L.animation(0, "bridge")
}


rule :=
"trigstart" >> entered("janseth") -> [1]
{
	active("fx_glow_symswitch01", false)
	active("fx_glow_sym01", false)
	active("fx_glow_symswitch02", false)
	active("fx_glow_sym02", false)
	active("fx_glow_symswitch03", false)
	active("fx_glow_sym03", false)
	active("fx_glow_symswitch04", false)
	active("fx_glow_sym04", false)
	active("fx_glow_symswitch05", false)
	active("fx_glow_symswitch06", false)
	active("fx_glow_sym06", false)
	active("fx_glow_symswitch07", false)
	active("fx_glow_symswitch08", false)
	active("fx_glow_sym08", false)
}

rule :=
"trigpuzzle" >> entered("janseth") -> [1]
{
	display("trigpuzzle is entered by JS")
	"owent_bridge02".state(1)
	"owent_switch02".state(1)
	"owent_switch03".state(1)
}



/*puzzle part 1*/

switches_pressed := #()

contains := function(x, list)
{
     for element in list do 
     { 
        if element = x then return true
     }
     return false
}


event_pressed := function(switch, pressed)
{
   if  pressed  then
       switches_pressed:= switches_pressed + #(switch)
   else
       switches_pressed:= switches_pressed - #(switch)


  if switches_pressed.count = 2
  then
  {    
   display("pressed" + switches_pressed)
       
      	    
if contains("owent_switch02", switches_pressed)
and contains("owent_switch03", switches_pressed) 
	then
        {
          display("combin is on: open bridge2")
          "owent_bridge02".state(1)
   	}
	else 
	{
        display("combin is off: close bridge2")
	"owent_bridge02".state(0)
        }

if contains("owent_switch01", switches_pressed)
and contains("owent_switch04", switches_pressed) 
	then
        {
          display("combin is on: open bridge3")
          "owent_bridge03".state(1)
   	}
	else 
	{
        display("combin is off: close bridge3")
	"owent_bridge03".state(0)
        }

if contains("owent_switch06", switches_pressed)
and contains("owent_switch08", switches_pressed) 
	then
        {
          display("combin is on: open bridge1")
          "owent_bridge01".state(1)
   	}
	else 
	{
        display("combin is off: close bridge1")
	"owent_bridge01".state(0)
        }

  } 
  else if switches_pressed.count = 3
  then
  {
     x := switches_pressed[1]
     display("one switch too much, deactivate " + x)
     x.state(0)
  }
  else if switches_pressed.count = 1
  then
  {
	"owent_bridge02".state(0)
	"owent_bridge03".state(0)
	"owent_bridge01".state(0)
  }

}


rule := 
"owent_switch01"  >> state(pressed?) ->
{
    event_pressed("owent_switch01", pressed)     
}

rule := 
"owent_switch02" >> state(pressed?) ->
{
    event_pressed("owent_switch02", pressed)     
}

rule := 
"owent_switch03" >> state(pressed?) ->
{
    event_pressed("owent_switch03", pressed)     
}

rule := 
"owent_switch04" >> state(pressed?) ->
{
    event_pressed("owent_switch04", pressed)     
}

rule := 
"owent_switch05"  >> state(pressed?) ->
{
    event_pressed("owent_switch05", pressed)     
}

rule := 
"owent_switch06" >> state(pressed?) ->
{
    event_pressed("owent_switch06", pressed)     
}

rule := 
"owent_switch07" >> state(pressed?) ->
{
    event_pressed("owent_switch07", pressed)     
}

rule := 
"owent_switch08" >> state(pressed?) ->
{
    event_pressed("owent_switch08", pressed)     
}

rule :=
"owent_switch01" >> state(1) ->
{
	active("fx_glow_symswitch01", true)
	active("fx_glow_sym01", true)
}


rule :=
"owent_switch02" >> state(1) ->
{
	active("fx_glow_symswitch02", true)
	active("fx_glow_sym02", true)
}

rule :=
"owent_switch03" >> state(1) ->
{
	active("fx_glow_symswitch03", true)
	active("fx_glow_sym03", true)
}

rule :=
"owent_switch04" >> state(1) ->
{
	active("fx_glow_symswitch04", true)
	active("fx_glow_sym04", true)
}

rule :=
"owent_switch05" >> state(1) ->
{
	active("fx_glow_symswitch05", true)
}


rule :=
"owent_switch06" >> state(1) ->
{
	active("fx_glow_symswitch06", true)
	active("fx_glow_sym06", true)
}

rule :=
"owent_switch07" >> state(1) ->
{
	active("fx_glow_symswitch07", true)
}

rule :=
"owent_switch08" >> state(1) ->
{
	active("fx_glow_symswitch08", true)
	active("fx_glow_sym08", true)
}

rule :=
"owent_switch01" >> state(0) ->
{
	active("fx_glow_symswitch01", false)
	active("fx_glow_sym01", false)
}


rule :=
"owent_switch02" >> state(0) ->
{
	active("fx_glow_symswitch02", false)
	active("fx_glow_sym02", false)
}

rule :=
"owent_switch03" >> state(0) ->
{
	active("fx_glow_symswitch03", false)
	active("fx_glow_sym03", false)
}

rule :=
"owent_switch04" >> state(0) ->
{
	active("fx_glow_symswitch04", false)
	active("fx_glow_sym04", false)
}

rule :=
"owent_switch05" >> state(0) ->
{
	active("fx_glow_symswitch05", false)
}


rule :=
"owent_switch06" >> state(0) ->
{
	active("fx_glow_symswitch06", false)
	active("fx_glow_sym06", false)
}

rule :=
"owent_switch07" >> state(0) ->
{
	active("fx_glow_symswitch07", false)
}

rule :=
"owent_switch08" >> state(0) ->
{
	active("fx_glow_symswitch08", false)
	active("fx_glow_sym08", false)
}


/*lift platform*/


rule :=
(L := "owcorr01_bridge01") >> init ->
{
     L.animation(0, "bridge")
}


rule :=
(L := "lift02") >> init ->
{
     L.animation(0, "lift")
}


rule := 
"owcorr01_switch15" >> init ->
{
    "owcorr01_switch15".state(0)
    active("fx_glow_symswitch15", false)    
}

rule := 
"owcorr01_switch16" >> init ->
{
    "owcorr01_switch16".state(0) 
    active("fx_glow_symswitch16", false)    
}


rule := 
"owcorr01_switch15" >> state(1) ->

{    
	active("fx_glow_symswitch15", true)	
	"lift02".state(1)		
}

rule := 
"owcorr01_switch16" >> state(1) ->

{    
	active("fx_glow_symswitch16", true)	
	"lift02".state(1)		
}

rule := 
"owcorr01_switch15" >> state(0) ->

{    
	active("fx_glow_symswitch15", false)			
}

rule := 
"owcorr01_switch16" >> state(0) ->

{    
	active("fx_glow_symswitch16", false)			
}

rule :=
"trig_lift_owcorr01" >> entered("janseth") -> [1]
{
     "lift02".state(0)
}

rule := 
"triglift" >> entered("janseth") -> [1]
{	
	"owcorr01_bridge01".state(1)
}


rule :=
"trigbridge" >> entered("janseth") -> [1]
{
	"owcorr01_bridge01".state(0)
}


/*Atmospheric Skrittles*/


rule :=
"trigatmo1" >> entered("janseth") -> [1]
{
     "ask1".walk(true)
}


/*First Skrittle*/

rule :=
"esk8" >> init ->
{
   "esk8".active(false)
}

rule :=
"trigatmo1" >> entered("janseth") -> [1]
{
	pause(1)	
	"esk8".active(true)
}

/*Skrittles in the first corridor section*/

rule :=

"trigatmo2" >> entered("janseth") -> [1]
{
		
	"ask2".walk(true)
}


rule :=
"trigatmo2" >> entered("janseth") -> [1]
{
	pause(1)
	"ask3".walk(true)
}


rule :=
"esk1" >> init ->
{
   "esk1".active(false)
}

rule :=
"trig01esk" >> entered("janseth") -> [1]
{
	display("trig01 is entered by janseth")
	"esk1".active(true)
}

rule :=
"esk2" >> init ->
{
   "esk2".active(false)
}

rule :=
"trig01esk" >> entered("janseth") -> [1]
{
	"esk2".active(true)
}


rule :=
"esk4" >> init ->
{
   "esk4".active(false)
}

rule :=
"trig01esk" >> entered("janseth") -> [1]
{
	"esk4".active(true)
}


rule :=
"trigatmo3" >> entered("janseth") -> [1]
{
	//pause(1)
	"ask4".walk(true)
}


rule :=
"esk5" >> init ->
{
   "esk5".active(false)
}

rule :=
"trig02esk" >> entered("janseth") -> [1]
{
	"esk5".active(true)
}

rule :=
"esk6" >> init ->
{
   "esk6".active(false)
}

rule :=
"trig02esk" >> entered("janseth") -> [1]
{
	display("trig02 is entered by janseth")
	"esk6".active(true)
}

rule :=
"esk7" >> init ->
{
   "esk7".active(false)
}

rule :=
"trig02esk" >> entered("janseth") -> [1]
{
	"esk7".active(true)
}

rule :=
"esk9" >> init ->
{
   "esk9".active(false)
}

rule :=
"trig02esk" >> entered("janseth") -> [1]
{
	"esk9".active(true)
}


rule :=

"trigscary2" >> entered("janseth") -> [1]
{
	
	pause(1)	
	"ask6".walk(true)
}

/*janseth suit mode test*/

rule :=
"janseth" >> enterStealth ->	

{
	display("js enters stealth mod")
	sound("create", "", "suit_toggle.wav", false, 1.0, "play")
}

rule := 
"janseth" >> leaveStealth ->
{
	display("js leaves stealth mod")
	sound("create", "", "suit_toggle.wav", false, 1.0, "play")
}


/*energy lines damage and stop Jan Seth


rule := 
"triggerenergyhit02" >> entered("janseth") ->

{
	display("triggerenergyhit02 is entered by js")    

	if "janseth".has("stealth") 
	then 
	{
		display("janseth has her suit")	
	}
	else 
	{
		display("janseth hasn't her suit")
		"janseth".hit(3.0)	
	}
}

rule := 
"triggerenergyhit01" >> entered("janseth") ->

{
	display("triggerenergyhit01 is entered by js")    

	if "janseth".has("stealth") 
	then 
	{
		display("janseth has her suit")	
	}
	else 
	{
		display("janseth hasn't her suit")	
		"janseth".hit(3.0)
	}
}
*/

/*first 2 skrittles in curving corridor*/


rule :=
"scarysk8" >> init ->
{
   "scarysk8".active(false)
}

rule :=
"trig" >> entered("janseth") -> [1]
{
	display("trig is entered by janseth")
	"scarysk8".active(true)
}

rule :=
"scarysk9" >> init ->
{
   "scarysk9".active(false)
}

rule :=
"trig" >> entered("janseth") -> [1]
{
	display("trig is entered by janseth")
	"scarysk9".active(true)
}

rule :=
"sk2" >> init ->
{
   "sk2".active(false)
}

rule :=
"triggerenergyhit02" >> entered("janseth") -> [1]
{
	display("trig is entered by janseth")
	"sk2".active(true)
}


rule :=
"sk3" >> init ->
{
   "sk3".active(false)
}

rule :=
"triggerenergyhit02" >> entered("janseth") -> [1]
{
	"sk3".active(true)
}


rule :=
"esk10" >> init ->
{
   "esk10".active(false)
}

rule :=
"triggerenergyhit02" >> entered("janseth") -> [1]
{
	"esk10".active(true)
}

/*lonely skrittle in the curving corridor*/


rule :=
"sk11" >> init ->
{
	"sk11".active(false)
}

rule :=
"trig5" >> entered("janseth") -> [1]
{
	display("trig5 is entered by janseth")
	"sk11".active(true)
}

rule :=
"esk11" >> init ->
{
	"esk11".active(false)
}

rule :=
"trig5" >> entered("janseth") -> [1]
{
	"esk11".active(true)
}

/*second attack of skrittles in curving corridor*/

rule :=
"sk4" >> init ->
{
   "sk4".active(false)
}

rule :=
"trig5" >> entered("janseth") -> [1]
{
	display("trig3 is entered by janseth")
	"sk4".active(true)
}

rule :=
"sk5" >> init ->
{
   "sk5".active(false)
}

rule :=
"trig2" >> entered("janseth") -> [1]
{
	"sk5".active(true)
}

rule :=
"sk6" >> init ->
{
   "sk6".active(false)
}

rule :=
"trig7" >> entered("janseth") -> [1]
{
	"sk6".active(true)
}

rule :=
"scarysk6" >> init ->
{
   "scarysk6".active(false)
}

rule :=
"trig7" >> entered("janseth") -> [1]
{
	"scarysk6".active(true)
}

rule :=
"scarysk7" >> init ->
{
   "scarysk7".active(false)
}

rule :=
"trig7" >> entered("janseth") -> [1]
{
	"scarysk7".active(true)
}


rule :=
"scarysk5" >> init ->
{
   "scarysk5".active(false)
}

rule :=
"trig3" >> entered("janseth") -> [1]
{
	"scarysk5".active(true)
}


/* skrittles in the lower computer room*/

/*
rule :=
"sk7" >> init ->
{
   "sk7".active(false)
}

rule :=
"triggerenergyhit01" >> entered("janseth") -> [1]
{
	display("trigenergyhit is entered by janseth")
	"sk7".active(true)
}
*/

rule :=
"esk12" >> init ->
{
   "esk12".active(false)
}

rule :=
"triggerenergyhit01" >> entered("janseth") -> [1]
{
	"esk12".active(true)
}

/*
rule :=
"esk13" >> init ->
{
   "esk13".active(false)
}

rule :=
"triggerenergyhit01" >> entered("janseth") -> [1]
{
	"esk13".active(true)
}
*/

rule :=
"esk14" >> init ->
{
   "esk14".active(false)
}

rule :=
"triggerenergyhit01" >> entered("janseth") -> [1]
{
	"esk14".active(true)
}

/*Traps in the statues corridor*/


rule :=
(L := "owcorr01_walltrap02") >> init ->
{
     L.animation(0, "anim")
}

rule :=
"tg_owcorr01_trap" >> entered("janseth") -> [1]
{

	pause(0)	
	"owcorr01_walltrap02".state(1)
}

rule :=
(L := "owcorr01_floorswitch01") >> init ->
{
     L.animation(0, "anim")
}


rule :=
"tg_owcorr01_trap" >> entered("janseth") -> [1]
{	
	"owcorr01_floorswitch01".state(1)
}


rule :=
"door05owcorr01" >> init ->
{
     "door05owcorr01".lock(false)
}


rule :=
"tg_owcorr01_trap" >> entered("janseth") -> [1]
{
	"door05".lock(true)
}


rule :=
"door05owlift01" >> init ->
{
     "door05owlift01".lock(false)
}



rule :=
"tg_owcorr01_trap" >> entered("janseth") -> [1]
{
	"door05owlift01".lock(true)
}


rule :=
"trigstart" >> entered("janseth") -> [1]
{
	active("fx_doorlock01_01", false)
	active("ow_base01_symglass",true)
	active("fx_ow_base01_symglass",true)
}

rule :=
"tg_owcorr01_trap" >> entered("janseth") -> [1]
{
	active("fx_doorlock01_01", true)
}

rule :=
(L := "owcorr01_skrit_hatch01") >> init ->
{
     L.animation(0, "anim")
}

rule :=
"tg_owcorr01_trap" >> entered("janseth") -> [1]
{
	"owcorr01_skrit_hatch01".state(1)
}

/*shaders change*/


rule :=
"owcorr01_shadermod" >> init ->
{
display("it should be around now")
     active("ow_base01_symglass",true)
}

rule :=
"owcorr01_shadermod_walltrap" >> init ->
{
     active("ow_base01_symglass", true)
}

rule :=
"tg_owcorr01_trap" >> entered("janseth") -> [1]
{
display("work damn you")
	"owcorr01_shadermod".override(Shader("ow_base01_symglass"), Shader("fx_ow_base01_symglass"))
}

rule :=
"tg_owcorr01_trap" >> entered("janseth") -> [1]
{
display("work damn you")
	"owcorr01_shadermod_walltrap".override(Shader("ow_base01_symglass"), Shader("fx_ow_base01_symglass"))
}

/*swarm in the statues corridor*/

/*
rule :=
"esk15" >> init ->
{
   "esk15".active(false)
}

rule :=
"tg_owcorr01_trap" >> entered("janseth") -> [1]
{
	pause(3)	
	"esk15".active(true)
}
*/

rule :=
"esk16" >> init ->
{
   "esk16".active(false)
}

rule :=
"tg_owcorr01_trap" >> entered("janseth") -> [1]
{
	pause(2)	
	"esk16".active(true)
}

rule :=
"esk17" >> init ->
{
   "esk17".active(false)
}

rule :=
"tg_owcorr01_trap" >> entered("janseth") -> [1]
{
	pause(2)
	"esk17".active(true)
}

/*
rule :=
"esk18" >> init ->
{
   "esk18".active(false)
}

rule :=
"tg_owcorr01_trap" >> entered("janseth") -> [1]
{
	pause(2)
	"esk18".active(true)
}
*/

rule :=
"esk20" >> init ->
{
   "esk20".active(false)
}

rule :=
"tg_owcorr01_trap" >> entered("janseth") -> [1]
{
	pause(2)	
	"esk20".active(true)
}

rule :=
"esk19" >> init ->
{
   "esk19".active(false)
}

rule :=
"tg_owcorr01_trap" >> entered("janseth") -> [1]
{
	pause(2)	
	"esk19".active(true)
}

/*
rule :=
"scarysk1" >> init ->
{
   "scarysk1".active(false)
}

rule :=
"tg_owcorr01_trap" >> entered("janseth") -> [1]
{
	pause(3)	
	"scarysk1".active(true)
}
*/

rule :=
"scarysk10" >> init ->
{
   "scarysk10".active(false)
}

rule :=
"tg_owcorr01_trap" >> entered("janseth") -> [1]
{
	pause(2)	
	"scarysk10".active(true)
}

/*
rule :=
"sks1" >> init ->
{
   "sks1".active(false)
}

rule :=
"tg_owcorr01_trap" >> entered("janseth") -> [1]
{
	pause(3)	
	"sks1".active(true)
}
*/

/*
rule :=
"sks2" >> init ->
{
   "sks2".active(false)
}

rule :=
"tg_owcorr01_trap" >> entered("janseth") -> [1]
{	
	pause(3)	
	"sks2".active(true)
}
*/

/*
rule :=
"sks3" >> init ->
{
   "sks3".active(false)
}

rule :=
"tg_owcorr01_trap" >> entered("janseth") -> [1]
{	
	pause(2)	
	"sks3".active(true)
}
*/

rule :=
"sks4" >> init ->
{
   "sks4".active(false)
}

rule :=
"tg_owcorr01_trap" >> entered("janseth") -> [1]
{	
	pause(2)	
	"sks4".active(true)
}

/*
rule :=
"sks5" >> init ->
{
   "sks5".active(false)
}

rule :=
"tg_owcorr01_trap" >> entered("janseth") -> [1]
{	
	pause(2)	
	"sks5".active(true)
}
*/

/*
rule :=
"sks6" >> init ->
{
   "sks6".active(false)
}

rule :=
"tg_owcorr01_trap" >> entered("janseth") -> [1]
{	
	pause(3)	
	"sks6".active(true)
}
*/

/*
rule :=
"sks7" >> init ->
{
   "sks7".active(false)
}

rule :=
"tg_owcorr01_trap" >> entered("janseth") -> [1]
{	
	pause(2)	
	"sks7".active(true)
}
*/

rule :=
"sks8" >> init ->
{
   "sks8".active(false)
}

rule :=
"tg_owcorr01_trap" >> entered("janseth") -> [1]
{	
	pause(2)	
	"sks8".active(true)
}

/*
rule :=
"sks9" >> init ->
{
   "sks9".active(false)
}

rule :=
"tg_owcorr01_trap" >> entered("janseth") -> [1]
{	
	pause(3)	
	"sks9".active(true)
}
*/

rule :=
"sks10" >> init ->
{
   "sks10".active(false)
}

rule :=
"tg_owcorr01_trap" >> entered("janseth") -> [1]
{	
	pause(2)	
	"sks10".active(true)
}


rule :=
"sks11" >> init ->
{
   "sks11".active(false)
}

rule :=
"tg_owcorr01_trap" >> entered("janseth") -> [1]
{	
	pause(2)	
	"sks11".active(true)
}

rule :=
"sks12" >> init ->
{
   "sks12".active(false)
}

rule :=
"tg_owcorr01_trap" >> entered("janseth") -> [1]
{
	pause(2)	
	"sks12".active(true)
}

rule :=
"sks13" >> init ->
{
   "sks13".active(false)
}

rule :=
"tg_owcorr01_trap" >> entered("janseth") -> [1]
{	
	pause(2)	
	"sks13".active(true)
}

rule :=
"sks14" >> init ->
{
   "sks14".active(false)
}

rule :=
"tg_owcorr01_trap" >> entered("janseth") -> [1]
{	
	pause(2)	
	"sks14".active(true)
}

rule :=
"sks15" >> init ->
{
   "sks15".active(false)
}

rule :=
"tg_owcorr01_trap" >> entered("janseth") -> [1]
{	
	pause(2)
	"sks15".active(true)
}

rule :=
"sks16" >> init ->
{
   "sks16".active(false)
}

rule :=
"tg_owcorr01_trap" >> entered("janseth") -> [1]
{	
	pause(2)
	"sks16".active(true)
}

rule :=
"sks17" >> init ->
{
   "sks17".active(false)
}

rule :=
"tg_owcorr01_trap" >> entered("janseth") -> [1]
{	
	pause(2)
	"sks17".active(true)
}

/*
rule :=
"sks18" >> init ->
{
   "sks18".active(false)
}

rule :=
"tg_owcorr01_trap" >> entered("janseth") -> [1]
{	
	pause(3)
	"sks18".active(true)
}
*/

/*
rule :=
"sks19" >> init ->
{
   "sks19".active(false)
}

rule :=
"tg_owcorr01_trap" >> entered("janseth") -> [1]
{	
	pause(3)
	"sks19".active(true)
}
*/

rule :=
"sks20" >> init ->
{
   "sks20".active(false)
}

rule :=
"tg_owcorr01_trap" >> entered("janseth") -> [1]
{	
	pause(2)
	"sks20".active(true)
}

/*
rule :=
"sks21" >> init ->
{
   "sks21".active(false)
}

rule :=
"tg_owcorr01_trap" >> entered("janseth") -> [1]
{	
	pause(2)
	"sks21".active(true)
}
*/

rule :=
"sks22" >> init ->
{
   "sks22".active(false)
}

rule :=
"tg_owcorr01_trap" >> entered("janseth") -> [1]
{	
	pause(2)
	"sks22".active(true)
}

/*
rule :=
"sks23" >> init ->
{
   "sks23".active(false)
}

rule :=
"tg_owcorr01_trap" >> entered("janseth") -> [1]
{	
	pause(2)
	"sks23".active(true)
}
*/

rule :=
"sks24" >> init ->
{
   "sks24".active(false)
}

rule :=
"tg_owcorr01_trap" >> entered("janseth") -> [1]
{	
	pause(2)
	"sks24".active(true)
}

/*timer for the secret room - waiting for dead state for skrittles

rule :=
(L := "owcorr01_tracthead02") >> init ->
{
     L.animation(0, "anim")
}


rule :=
"tg_owcorr01_trap" >> entered("janseth") -> [1]
{

	pause(40)	
	"owcorr01_tracthead02".state(1)
}
*/


/*test dead skrittles*/

rule :=
(L := "owcorr01_tracthead02") >> init ->
{
     L.animation(0, "anim")
}

rule :=
"esk1" >> dead ->
{	
	display ("sk is dead")
}

/*secret room light*/

rule :=
"trigstart" >> entered("janseth") -> [1]
{
   "owcorr01_omnistatue02".color( # [ 0.0, 0.0, 0.0 ], 0.0)
}

/*secret room*/


sk_dead := 0

contains := function(x, list)
{
     for element in list do 
     { 
        if element = x then return true
     }
     return false
}


event_dead := function(sk)
{
  display (sk + "is dead")

  sk_dead:= sk_dead + 1


  if sk_dead = 10
  then
  {    
   display ("statue moves")
   "owcorr01_tracthead02".state(1)
   "owcorr01_omnistatue02".color( # [ 2.0, 2.0, 2.0 ], 4.8)
  } 
}

/*
rule := 
"sks3"  >> dead ->
{
    event_dead("sks3")     
}
*/

rule := 
"sks4"  >> dead ->
{
    event_dead("sks4")     
}

rule := 
"sks8"  >> dead ->
{
    event_dead("sks8")     
}

rule := 
"sks10"  >> dead ->
{
    event_dead("sks10")     
}

rule := 
"sks11"  >> dead ->
{
    event_dead("sks11")     
}

rule := 
"sks12"  >> dead ->
{
    event_dead("sks12")     
}

rule := 
"sks13"  >> dead ->
{
    event_dead("sks13")     
}

rule := 
"sks14"  >> dead ->
{
    event_dead("sks14")     
}

rule := 
"sks15"  >> dead ->
{
    event_dead("sks15")     
}

rule := 
"sks16"  >> dead ->
{
    event_dead("sks16")     
}

rule := 
"sks17"  >> dead ->
{
    event_dead("sks17")     
}


rule := 
"sks20"  >> dead ->
{
    event_dead("sks20")     
}

/*
rule := 
"sks21"  >> dead ->
{
    event_dead("sks21")     
}
*/

rule := 
"sks22"  >> dead ->
{
    event_dead("sks22")     
}

/*
rule := 
"sks23"  >> dead ->
{
    event_dead("sks23")     
}
*/

rule := 
"sks24"  >> dead ->
{
    event_dead("sks24")     
}

rule := 
"esk16"  >> dead ->
{
    event_dead("esk16")     
}

rule := 
"esk17"  >> dead ->
{
    event_dead("esk17")     
}

/*
rule := 
"esk18"  >> dead ->
{
    event_dead("esk18")     
}
*/

rule := 
"esk19"  >> dead ->
{
    event_dead("esk19")     
}

rule := 
"scarysk10"  >> dead ->
{
    event_dead("scarysk10")     
}

/*reset trap*/

rule :=
"owsec01_sym20" >> init ->
{
   "owsec01_sym20".state(0)
}

rule :=
"tg_owcorr01_trap" >> entered("janseth") -> [1]
{
	active("fx_glow_symswitch20", false)
}

rule := 
"owsec01_sym20" >> state(1) ->

{
   active("fx_glow_symswitch20", true)     
   "owcorr01_walltrap02".state(0)
   "owcorr01_floorswitch01".state(0)
   "door05owcorr01".lock(false)
   "door05owlift01".lock(false)
"owcorr01_shadermod".override(Shader("ow_base01_symglass"))
"owcorr01_shadermod_walltrap".override(Shader("ow_base01_symglass"))
   active("fx_doorlock01_01", false)
   "owcorr01_skrit_hatch01".state(0)
}



/*scary skrittles*/

rule :=
"scarysk2" >> init ->
{
   "scarysk2".active(false)
}

rule := 
"owcorr01_switch15" >> state(1) ->

{
   "scarysk2".active(true)
}

rule := 
"owcorr01_switch16" >> state(1) ->

{
   "scarysk2".active(true)
}

rule :=
"scarysk3" >> init ->
{
   "scarysk3".active(false)
}

rule := 
"owcorr01_switch15" >> state(1) ->

{
   "scarysk3".active(true)
}

rule := 
"owcorr01_switch16" >> state(1) ->

{
   "scarysk3".active(true)
}

/* Margoss Room Activations */

/* change of camera*/
rule :=
"trigend" >> entered("janseth") -> [1]
{
	pause(1.0)
	"scene".setCamera("owmaze_camera01")
}

/* Margoss lift comes up*/
rule :=
"trigend" >> entered("janseth") -> [1]
{
	pause(3.0)
	"lift03".state(1)
	sound("create", "", "margoss.wav", false, 1.0, "play")
}

/*sounds*/

rule :=
"trigend" >> entered("janseth") -> [1]
{
	pause(4.4)	
	sound("create", "", "margoss_skrittles.wav", false, 1.0, "play")
}

/* Skrittles */

rule :=
"csk1" >> init ->
{
   "csk1".active(false)
}

rule :=
"trigend" >> entered("janseth") -> [1]
{
	pause(4.4)
	"csk1".active(true)
}


rule :=
"cks2" >> init ->
{
   "csk2".active(false)
}

rule :=
"trigend" >> entered("janseth") -> [1]
{
	pause(4.4)
	"csk2".active(true)
}


rule :=
"csk3" >> init ->
{
   "csk3".active(false)
}

rule :=
"trigend" >> entered("janseth") -> [1]
{
	pause(4.4)
	"csk3".active(true)
}


rule :=
"csk4" >> init ->
{
   "csk4".active(false)
}

rule :=
"trigend" >> entered("janseth") -> [1]
{
	pause(4.4)
	"csk4".active(true)
}

rule :=
"csk5" >> init ->
{
   "csk5".active(false)
}

rule :=
"trigend" >> entered("janseth") -> [1]
{
	pause(4.4)
	"csk5".active(true)
}


rule :=
"csk6" >> init ->
{
   "csk6".active(false)
}

rule :=
"trigend" >> entered("janseth") -> [1]
{
	pause(4.4)
	"csk6".active(true)
}


rule :=
"csk7" >> init ->
{
   "csk7".active(false)
}

rule :=
"trigend" >> entered("janseth") -> [1]
{
	pause(4.4)
	"csk7".active(true)
}


rule :=
"csk8" >> init ->
{
   "csk8".active(false)
}

rule :=
"trigend" >> entered("janseth") -> [1]
{
	pause(4.4)
	"csk8".active(true)
}

rule :=
"csk9" >> init ->
{
   "csk9".active(false)
}

rule :=
"trigend" >> entered("janseth") -> [1]
{
	pause(4.4)
	"csk9".active(true)
}

rule :=
"csk10" >> init ->
{
   "csk10".active(false)
}

rule :=
"trigend" >> entered("janseth") -> [1]
{
	pause(4.4)
	"csk10".active(true)
}


rule :=
"csk11" >> init ->
{
   "csk11".active(false)
}

rule :=
"trigend" >> entered("janseth") -> [1]
{
	pause(4.4)
	"csk11".active(true)
}


rule :=
"csk12" >> init ->
{
   "csk12".active(false)
}

rule :=
"trigend" >> entered("janseth") -> [1]
{
	pause(4.4)
	"csk12".active(true)
}


rule :=
"csk13" >> init ->
{
   "csk13".active(false)
}

rule :=
"trigend" >> entered("janseth") -> [1]
{
	pause(4.4)
	"csk13".active(true)
}

rule :=
"csk14" >> init ->
{
   "csk14".active(false)
}

rule :=
"trigend" >> entered("janseth") -> [1]
{
	pause(4.4)
	"csk14".active(true)
}

rule :=
"csk15" >> init ->
{
   "csk15".active(false)
}

rule :=
"trigend" >> entered("janseth") -> [1]
{
	pause(4.4)
	"csk15".active(true)
}

rule :=
"csk16" >> init ->
{
   "csk16".active(false)
}

rule :=
"trigend" >> entered("janseth") -> [1]
{
	pause(4.4)
	"csk16".active(true)
}


rule :=
"csk17" >> init ->
{
   "csk17".active(false)
}

rule :=
"trigend" >> entered("janseth") -> [1]
{
	pause(4.4)
	"csk17".active(true)
}

rule :=
"csk18" >> init ->
{
   "csk18".active(false)
}

rule :=
"trigend" >> entered("janseth") -> [1]
{
	pause(4.4)
	"csk18".active(true)
}

rule :=
"csk19" >> init ->
{
   "csk19".active(false)
}

rule :=
"trigend" >> entered("janseth") -> [1]
{
	pause(4.4)
	"csk19".active(true)
}

rule :=
"csk20" >> init ->
{
   "csk20".active(false)
}

rule :=
"trigend" >> entered("janseth") -> [1]
{
	pause(4.4)
	"csk20".active(true)
}


rule :=
"csk21" >> init ->
{
   "csk21".active(false)
}

rule :=
"trigend" >> entered("janseth") -> [1]
{
	pause(4.4)
	"csk21".active(true)
}


rule :=
"csk22" >> init ->
{
   "csk22".active(false)
}

rule :=
"trigend" >> entered("janseth") -> [1]
{
	pause(4.4)
	"csk22".active(true)
}


rule :=
"csk23" >> init ->
{
   "csk23".active(false)
}

rule :=
"trigend" >> entered("janseth") -> [1]
{
	pause(4.4)
	"csk23".active(true)
}


rule :=
"csk24" >> init ->
{
   "csk24".active(false)
}

rule :=
"trigend" >> entered("janseth") -> [1]
{
	pause(4.4)
	"csk24".active(true)
}

rule :=
"csk25" >> init ->
{
   "csk25".active(false)
}

rule :=
"trigend" >> entered("janseth") -> [1]
{
	pause(4.4)
	"csk25".active(true)
}


rule :=
"csk26" >> init ->
{
   "csk26".active(false)
}

rule :=
"trigend" >> entered("janseth") -> [1]
{
	pause(4.4)
	"csk26".active(true)
}

/* Margos anims*/
rule :=
"trigend" >> entered("janseth") -> [1]
{
	pause(14)
	"Margoss".animation("specialAttack")
	/* display("margos special attack") */
}

/*cut to black*/
rule :=
"trigend" >> entered("janseth") -> [1]
{
	pause(19.01)	
	"scene".cutToBlack()
}

/* Jan Seth attack */
rule :=
"trigend" >> entered("janseth") -> [1]
{
	pause(20)
	sound("create", "", "margoss_guns.wav", false, 1.0, "play")
}

/* Jan Seth is running to standing point*/
rule :=
"trigend" >> entered("janseth") -> [1]
{
	"janseth".active(false)
	"janseth".gui(false)
	/* display("janseth inactive") */
	"janseth".animation("runForward")	
	"janseth".moveTo("janseth_wp01")
	/* display("janseth move to 01") */
  	"janseth".moveTo("janseth_wp02")
	/* display("janseth move to 02") */
	"janseth".animation("mergeMachines")
	"janseth".animation("breathe")
}

/* Final Margoss room */
rule :=
"trigend" >> entered("janseth") -> [1]
{
pause(26)    
"scene".playMovie("end_01.xmv")
pause(28)
"scene".endDemo()
}
