Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

[bin/crypt] you can put things on things

  • Loading branch information...
commit f125f79284baf33c2696f762115f82404f0e0dad 1 parent 71900d3
@masak authored
Showing with 31 additions and 4 deletions.
  1. +31 −4 bin/crypt
View
35 bin/crypt
@@ -265,7 +265,7 @@ class Adventure::PlayerOpened does Event {
has $.thing;
}
-class Adventure::PlayerPut does Event {
+class Adventure::PlayerPutIn does Event {
has $.thing;
has $.in;
}
@@ -274,6 +274,11 @@ class Adventure::ThingMadeAContainer does Event {
has $.thing;
}
+class Adventure::PlayerPutOn does Event {
+ has $.thing;
+ has $.on;
+}
+
class X::Adventure is Exception {
}
@@ -479,10 +484,17 @@ class Adventure::Engine {
@events.push(Adventure::PlayerOpened.new(:thing($in)));
}
- @events.push(Adventure::PlayerPut.new(:$thing, :$in));
+ @events.push(Adventure::PlayerPutIn.new(:$thing, :$in));
@events;
}
+ method make_thing_a_platform($thing) {
+ }
+
+ method put_thing_on($thing, $on) {
+ Adventure::PlayerPutOn.new(:$thing, :$on);
+ }
+
method on_try_exit($room, $direction, &hook) {
%!try_exit_hooks{$room}{$direction} = &hook;
}
@@ -1053,7 +1065,7 @@ multi MAIN('test') {
$engine.make_thing_a_container('box');
$engine.place_player('street');
is $engine.put_thing_in('doll', 'box'),
- Adventure::PlayerPut.new(
+ Adventure::PlayerPutIn.new(
:thing<doll>,
:in<box>,
),
@@ -1092,7 +1104,7 @@ multi MAIN('test') {
Adventure::PlayerOpened.new(
:thing<crate>,
),
- Adventure::PlayerPut.new(
+ Adventure::PlayerPutIn.new(
:thing<doll>,
:in<crate>,
),
@@ -1118,6 +1130,21 @@ multi MAIN('test') {
};
}
+ {
+ my $engine = Adventure::Engine.new();
+
+ $engine.place_thing('surface', 'street');
+ $engine.place_thing('doll', 'street');
+ $engine.make_thing_a_platform('surface');
+ $engine.place_player('street');
+ is $engine.put_thing_on('doll', 'surface'),
+ Adventure::PlayerPutOn.new(
+ :thing<doll>,
+ :on<surface>,
+ ),
+ 'putting a thing on another (+)';
+ }
+
done;
}
Please sign in to comment.
Something went wrong with that request. Please try again.