Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

[bin/crypt] reading things

  • Loading branch information...
commit e6f9ee6e27f7d97761af8e20c51a73c859c38b36 1 parent 576954e
@masak authored
Showing with 24 additions and 0 deletions.
  1. +24 −0 bin/crypt
View
24 bin/crypt
@@ -283,6 +283,10 @@ class Adventure::ThingMadeAPlatform does Event {
has $.thing;
}
+class Adventure::PlayerRead does Event {
+ has $.thing;
+}
+
class X::Adventure is Exception {
}
@@ -518,6 +522,13 @@ class Adventure::Engine {
Adventure::PlayerPutOn.new(:$thing, :$on);
}
+ method make_thing_readable($thing) {
+ }
+
+ method read($thing) {
+ Adventure::PlayerRead.new(:$thing);
+ }
+
method on_try_exit($room, $direction, &hook) {
%!try_exit_hooks{$room}{$direction} = &hook;
}
@@ -1210,6 +1221,19 @@ multi MAIN('test') {
};
}
+ {
+ my $engine = Adventure::Engine.new();
+
+ $engine.place_thing('book', 'library');
+ $engine.make_thing_readable('book');
+ $engine.place_player('library');
+ is $engine.read('book'),
+ Adventure::PlayerRead.new(
+ :thing<book>,
+ ),
+ 'reading a thing (+)';
+ }
+
done;
}
Please sign in to comment.
Something went wrong with that request. Please try again.