Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

[bin/crypt] you can put things on things

  • Loading branch information...
commit f125f79284baf33c2696f762115f82404f0e0dad 1 parent 71900d3
Carl Mäsak authored July 12, 2012

Showing 1 changed file with 31 additions and 4 deletions. Show diff stats Hide diff stats

  1. 35  bin/crypt
35  bin/crypt
@@ -265,7 +265,7 @@ class Adventure::PlayerOpened does Event {
265 265
     has $.thing;
266 266
 }
267 267
 
268  
-class Adventure::PlayerPut does Event {
  268
+class Adventure::PlayerPutIn does Event {
269 269
     has $.thing;
270 270
     has $.in;
271 271
 }
@@ -274,6 +274,11 @@ class Adventure::ThingMadeAContainer does Event {
274 274
     has $.thing;
275 275
 }
276 276
 
  277
+class Adventure::PlayerPutOn does Event {
  278
+    has $.thing;
  279
+    has $.on;
  280
+}
  281
+
277 282
 class X::Adventure is Exception {
278 283
 }
279 284
 
@@ -479,10 +484,17 @@ class Adventure::Engine {
479 484
             @events.push(Adventure::PlayerOpened.new(:thing($in)));
480 485
         }
481 486
 
482  
-        @events.push(Adventure::PlayerPut.new(:$thing, :$in));
  487
+        @events.push(Adventure::PlayerPutIn.new(:$thing, :$in));
483 488
         @events;
484 489
     }
485 490
 
  491
+    method make_thing_a_platform($thing) {
  492
+    }
  493
+
  494
+    method put_thing_on($thing, $on) {
  495
+        Adventure::PlayerPutOn.new(:$thing, :$on);
  496
+    }
  497
+
486 498
     method on_try_exit($room, $direction, &hook) {
487 499
         %!try_exit_hooks{$room}{$direction} = &hook;
488 500
     }
@@ -1053,7 +1065,7 @@ multi MAIN('test') {
1053 1065
         $engine.make_thing_a_container('box');
1054 1066
         $engine.place_player('street');
1055 1067
         is $engine.put_thing_in('doll', 'box'),
1056  
-            Adventure::PlayerPut.new(
  1068
+            Adventure::PlayerPutIn.new(
1057 1069
                 :thing<doll>,
1058 1070
                 :in<box>,
1059 1071
             ),
@@ -1092,7 +1104,7 @@ multi MAIN('test') {
1092 1104
                 Adventure::PlayerOpened.new(
1093 1105
                     :thing<crate>,
1094 1106
                 ),
1095  
-                Adventure::PlayerPut.new(
  1107
+                Adventure::PlayerPutIn.new(
1096 1108
                     :thing<doll>,
1097 1109
                     :in<crate>,
1098 1110
                 ),
@@ -1118,6 +1130,21 @@ multi MAIN('test') {
1118 1130
             };
1119 1131
     }
1120 1132
 
  1133
+    {
  1134
+        my $engine = Adventure::Engine.new();
  1135
+
  1136
+        $engine.place_thing('surface', 'street');
  1137
+        $engine.place_thing('doll', 'street');
  1138
+        $engine.make_thing_a_platform('surface');
  1139
+        $engine.place_player('street');
  1140
+        is $engine.put_thing_on('doll', 'surface'),
  1141
+            Adventure::PlayerPutOn.new(
  1142
+                :thing<doll>,
  1143
+                :on<surface>,
  1144
+            ),
  1145
+            'putting a thing on another (+)';
  1146
+    }
  1147
+
1121 1148
     done;
1122 1149
 }
1123 1150
 

0 notes on commit f125f79

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