Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

[bin/crypt] putting out fuse hooks

  • Loading branch information...
commit f8718d1d2ceec763ef0709476d90ecf927e7c675 1 parent d6f6977
Carl Mäsak authored July 26, 2012

Showing 1 changed file with 21 additions and 0 deletions. Show diff stats Hide diff stats

  1. 21  bin/crypt
21  bin/crypt
@@ -966,6 +966,10 @@ class Adventure::Engine {
966 966
         %!tick_hooks{$name} = { :ticks($n), :&hook };
967 967
     }
968 968
 
  969
+    method put_out_fuse($name) {
  970
+        %!tick_hooks.delete($name);
  971
+    }
  972
+
969 973
     my class Save {
970 974
         has @.events;
971 975
     }
@@ -2717,6 +2721,23 @@ multi MAIN('test') {
2717 2721
             'counting down to a hook auto-activating';
2718 2722
     }
2719 2723
 
  2724
+    {
  2725
+        my $engine = Adventure::Engine.new();
  2726
+
  2727
+        my @rooms = <kitchen veranda>;
  2728
+        $engine.connect(@rooms, my $direction = 'south');
  2729
+        $engine.place_player('kitchen');
  2730
+        $engine.light_fuse(3, 'end_game', { $engine.finish });
  2731
+        $engine.walk('south');
  2732
+        $engine.walk('north');
  2733
+        $engine.put_out_fuse('end_game');
  2734
+        is $engine.walk('south'),
  2735
+            Adventure::PlayerWalked.new(
  2736
+                :to<veranda>,
  2737
+            ),
  2738
+            'putting out a fuse so it does not activate';
  2739
+    }
  2740
+
2720 2741
     done;
2721 2742
 }
2722 2743
 

0 notes on commit f8718d1

Please sign in to comment.
Something went wrong with that request. Please try again.