Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

[bin/crypt] can put things into containers

  • Loading branch information...
commit a9fe2f791bd27ee81d84eb9b66d6ed6849bb8299 1 parent 7132e85
@masak authored
Showing with 27 additions and 0 deletions.
  1. +27 −0 bin/crypt
View
27 bin/crypt
@@ -265,6 +265,11 @@ class Adventure::PlayerOpened does Event {
has $.thing;
}
+class Adventure::PlayerPut does Event {
+ has $.thing;
+ has $.in;
+}
+
class X::Adventure is Exception {
}
@@ -434,6 +439,13 @@ class Adventure::Engine {
@events;
}
+ method make_thing_a_container($thing) {
+ }
+
+ method put_thing_in($thing, $in) {
+ Adventure::PlayerPut.new(:$thing, :$in);
+ }
+
method on_try_exit($room, $direction, &hook) {
%!try_exit_hooks{$room}{$direction} = &hook;
}
@@ -993,6 +1005,21 @@ multi MAIN('test') {
};
}
+ {
+ my $engine = Adventure::Engine.new();
+
+ $engine.place_thing('box', 'street');
+ $engine.place_thing('doll', 'street');
+ $engine.make_thing_a_container('box');
+ $engine.place_player('street');
+ is $engine.put_thing_in('doll', 'box'),
+ Adventure::PlayerPut.new(
+ :thing<doll>,
+ :in<box>,
+ ),
+ 'putting a thing inside another (+)';
+ }
+
done;
}
Please sign in to comment.
Something went wrong with that request. Please try again.