
#pyramid entrance

dronelaser1_switch -> dronelaser1_a -> dronelaser1_b -> (NOT()) -> drone1 -> drone2 -> drone3;
dronelaser1_switch -> drone_laser_door1;
dronelaser1_switch -> (NOT()) -> laser_drone_jammer_rec;
dronelaser1_a -> (PASS(0)) -> (NOT()) -> (dronelaser1_switch.EnabledState);
dronelaser1_a -> (PASS(0)) -> dronelaser1_switch;
dronelaser1_b -> (PASS(0)) -> (NOT()) -> (dronelaser1_switch.EnabledState);
dronelaser1_b -> (PASS(0)) -> dronelaser1_switch;

laser_drone_jammer_rec -> drone_laser_door1;
laser_drone_jammer_rec:Observe((drone1.Drone));
laser_drone_jammer_rec:Observe((drone2.Drone));
laser_drone_jammer_rec:Observe((drone3.Drone));




#pyramid corridor

switch1_lamp_or = (OR());
switch2_lamp_or = (OR());

switch1_lamp_or -> switch1_lamp;
switch2_lamp_or -> switch2_lamp;


switch1 -> switch1_lamp_or;
switch2 -> switch2_lamp_or;

door_a_and_b_cue = (PROGRESS_CUE(0));

door_switch = (SWITCH(0));
door_and = (AND());

switch1 -> door_and;
switch2 -> door_and;
door_and -> door_switch;

door_switch -> switch1_lamp_or;
door_switch -> switch2_lamp_or;
door_switch -> door_a_and_b_cue;
door_switch -> lower_corridor_door_a -> lower_corridor_door_b;


#pyramid mech room
pyramid_mech_door_switch -> (NOT()) -> pyramid_mech_door;

jammer_rec2 -> jammed_door2;

jammer_rec2:Observe(jammer3_holder);
jammer_rec2:Observe(jammer4_holder);

#morphing checkpoint

morph:SetMask(mask1);
morph:SetMask(mask2);
morph:SetMask(mask3);
morph:BuildBowels();

hive_top_right -> tentacle1 -> tentacle2 -> tentacle3 -> morph;


#cave
jammer_rec4 -> rising_water_floodgate;

jammer_rec4:Observe((jammer6_holder.Drone));

rising_water_switch -> rising_water -> (NOT()) -> rising_water_floodgate;

power_floodgate_switch -> power_floodgate;



#bunker
inner_bunker_door_switch -> inner_bunker_door;

elevator1_switch1 -> (PASS(0)) -> (NOT()) -> elevator1_switch2;
elevator1_switch1 -> (PASS(1)) -> (NOT()) -> elevator1_switch2;
elevator1_switch2 -> (DELAY(0)) -> (PASS(0)) -> (NOT()) -> elevator1_switch1;
elevator1_switch2 -> (DELAY(0)) -> (PASS(1)) -> (NOT()) -> elevator1_switch1;
elevator1_switch1 -> elevator1;

elevator2_switch -> elevator2;


dispenser_sweep = (SWEEP()) -> [dispenser_marker, duration 0] -> [dispenser_marker, duration 3];
dispenser_switch -> (DELAY(0.5)) -> dispenser_sweep;
dispenser_switch -> dispenser -> (NOT()) -> elevator3_switch;

bunker_laser -> bunker_laser_door;
bunker_laser_switch -> (PASS(0)) -> bunker_laser;
bunker_laser_switch -> (PASS(1)) -> bunker_laser;
bunker_laser -> (PASS(0)) -> (NOT()) -> (bunker_laser_switch.EnabledState);
bunker_laser -> (PASS(0)) -> bunker_laser_switch;

elevator3_event = (SWEEP_EVENT());
elevator3_sweep = (SWEEP()) -> [elevator_camera_marker, duration 0] -> [elevator3_event, duration 0] -> [elevator3_floor1, duration 5] -> [elevator3_floor1, duration 3];
elevator3_switch -> (DELAY(0.5)) -> elevator3_sweep;
(WAIT_FOR_EVENT(elevator3_event)) -> elevator3;
elevator3_switch -> elevator3;

#(elevator3.OperatingState) -> (NOT()) -> (elevator3_switch.EnabledState);

door_top_left_event = (SWEEP_EVENT());
shortcut_event = (SWEEP_EVENT());
door_top_left_sweep = (SWEEP()) -> [door_top_left_marker, duration 0] -> [door_top_left_event, duration 0] -> [door_top_left_marker, duration 1]
 -> [door_bottom_left_marker, duration 0] -> [door_bottom_left_marker, duration 2]
 -> [door_top_right_marker, duration 0] -> [door_top_right_marker, duration 3] 
 -> [shortcut_marker, duration 0] -> [shortcut_event, duration 0] -> [shortcut_marker, duration 3];

master_switch -> (THRESHOLD(0.4)) -> door_top_left_sweep;

(WAIT_FOR_EVENT(door_top_left_event)) -> door_top_left -> lamp_top_left;
(WAIT_FOR_EVENT(door_top_left_event)) -> (DELAY(2)) -> door_bottom_left -> lamp_bottom_left;
(WAIT_FOR_EVENT(door_top_left_event)) -> (DELAY(6)) -> door_top_right -> lamp_top_right;
(WAIT_FOR_EVENT(door_top_left_event)) -> (DELAY(6)) -> door_bottom_right -> lamp_bottom_right;
(WAIT_FOR_EVENT(shortcut_event)) -> bunker_shortcut;

master_switch -> (DELAY(0.5))  -> (NOT()) -> bunker_laser;
master_switch -> (DELAY(0.55)) -> (NOT()) -> (bunker_laser_switch.EnabledState);
master_switch -> (DELAY(0.55)) -> bunker_laser_door;

#cove

bomb_sweep = (SWEEP()) -> [bomb_marker, duration 0] -> [bomb_marker, duration 0.5];

bomb1_switch -> (DELAY(0.25)) -> bomb_sweep;
bomb1_switch -> (NOT()) -> (DELAY(0.25)) -> bomb_sweep;
bomb1_switch -> (DELAY(1)) -> bomb1;

bomb2_switch -> (DELAY(0.25)) -> bomb_sweep;
bomb2_switch -> (NOT()) -> (DELAY(0.25)) -> bomb_sweep;
bomb2_switch -> (DELAY(1)) -> bomb2;

jammer_rec3 -> cove_exit_door1 -> cove_exit_door2 -> cove_exit_door3 -> cove_exit_door4;

jammer_rec3:Observe(jammer5_holder);

turret_event = (SWEEP_EVENT());
turret_sweep = (SWEEP()) -> [turret_marker, duration 0] -> [turret_event, duration 0] -> [turret_marker, duration 3];
cove_switch -> (DELAY(0.5)) -> turret_sweep;
(WAIT_FOR_EVENT(turret_event)) -> (cove_drone2.LockCircuitNode) -> (cove_drone1.LockCircuitNode) -> (DELAY(2)) -> (NOT()) -> cove_turret;


#outpost

rivet_door_switch -> rivet_door;

(jammer2_holder.ActiveState) -> (NOT()) -> jammed_door1b;
jammer_rec1 -> jammed_door1 -> jammed_door1b -> jammed_door1c;

jammer_rec1:Observe(jammer1_holder);
jammer_rec1:Observe(jammer2_holder);



#lamps
hive_top_left -> (NOT()) -> lamp_top_left;
hive_bottom_left -> (NOT()) -> lamp_bottom_left;
hive_top_right -> (NOT()) -> lamp_top_right;
hive_bottom_right -> (NOT()) -> lamp_bottom_right;

#tentacles

hive1 -> hive1_tentacle1 -> hive1_tentacle2 -> hive1_tentacle3;
hive2 -> hive2_tentacle1 -> hive2_tentacle2 -> hive2_tentacle3;
hive_bottom_right -> hive4_tentacle1 -> hive4_tentacle2 -> hive4_tentacle3;
hive_bottom_left -> hive5_tentacle1 -> hive5_tentacle2 -> hive5_tentacle3;
hive_top_left -> hive6_tentacle1 -> hive6_tentacle2 -> hive6_tentacle3;

secret_jar -> secret_lamp0;
secret_jar -> secret_lamp1;