Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

[bin/crypt] putting out fuse hooks

  • Loading branch information...
commit f8718d1d2ceec763ef0709476d90ecf927e7c675 1 parent d6f6977
@masak authored
Showing with 21 additions and 0 deletions.
  1. +21 −0 bin/crypt
View
21 bin/crypt
@@ -966,6 +966,10 @@ class Adventure::Engine {
%!tick_hooks{$name} = { :ticks($n), :&hook };
}
+ method put_out_fuse($name) {
+ %!tick_hooks.delete($name);
+ }
+
my class Save {
has @.events;
}
@@ -2717,6 +2721,23 @@ multi MAIN('test') {
'counting down to a hook auto-activating';
}
+ {
+ my $engine = Adventure::Engine.new();
+
+ my @rooms = <kitchen veranda>;
+ $engine.connect(@rooms, my $direction = 'south');
+ $engine.place_player('kitchen');
+ $engine.light_fuse(3, 'end_game', { $engine.finish });
+ $engine.walk('south');
+ $engine.walk('north');
+ $engine.put_out_fuse('end_game');
+ is $engine.walk('south'),
+ Adventure::PlayerWalked.new(
+ :to<veranda>,
+ ),
+ 'putting out a fuse so it does not activate';
+ }
+
done;
}
Please sign in to comment.
Something went wrong with that request. Please try again.