Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

[bin/crypt] reading things

  • Loading branch information...
commit e6f9ee6e27f7d97761af8e20c51a73c859c38b36 1 parent 576954e
Carl Mäsak authored July 13, 2012

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

  1. 24  bin/crypt
24  bin/crypt
@@ -283,6 +283,10 @@ class Adventure::ThingMadeAPlatform does Event {
283 283
     has $.thing;
284 284
 }
285 285
 
  286
+class Adventure::PlayerRead does Event {
  287
+    has $.thing;
  288
+}
  289
+
286 290
 class X::Adventure is Exception {
287 291
 }
288 292
 
@@ -518,6 +522,13 @@ class Adventure::Engine {
518 522
         Adventure::PlayerPutOn.new(:$thing, :$on);
519 523
     }
520 524
 
  525
+    method make_thing_readable($thing) {
  526
+    }
  527
+
  528
+    method read($thing) {
  529
+        Adventure::PlayerRead.new(:$thing);
  530
+    }
  531
+
521 532
     method on_try_exit($room, $direction, &hook) {
522 533
         %!try_exit_hooks{$room}{$direction} = &hook;
523 534
     }
@@ -1210,6 +1221,19 @@ multi MAIN('test') {
1210 1221
             };
1211 1222
     }
1212 1223
 
  1224
+    {
  1225
+        my $engine = Adventure::Engine.new();
  1226
+
  1227
+        $engine.place_thing('book', 'library');
  1228
+        $engine.make_thing_readable('book');
  1229
+        $engine.place_player('library');
  1230
+        is $engine.read('book'),
  1231
+            Adventure::PlayerRead.new(
  1232
+                :thing<book>,
  1233
+            ),
  1234
+            'reading a thing (+)';
  1235
+    }
  1236
+
1213 1237
     done;
1214 1238
 }
1215 1239
 

0 notes on commit e6f9ee6

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