distinguish container-sub-commands and container-dom-commands
authorChristopher Allan Webber <cwebber@dustycloud.org>
Sun, 29 Jan 2017 04:20:20 +0000 (22:20 -0600)
committerChristopher Allan Webber <cwebber@dustycloud.org>
Sun, 29 Jan 2017 04:20:20 +0000 (22:20 -0600)
mudsync/gameobj.scm
mudsync/player.scm
mudsync/room.scm

index 64c79f1397b67e34175dd6d6798261401786b49c..ebd4db7276c44aecd5b307c10a43edc5f7b48486 100644 (file)
                                                       '("in" "inside" "on"))))))
 
   ;; Commands we can handle by being something's container
-  (container-commands #:allocation #:each-subclass
-                      #:init-thunk (build-commands))
+  ;;   dominant version (goes before everything)
+  (container-dom-commands #:allocation #:each-subclass
+                          #:init-thunk (build-commands))
+  ;;   subordinate version (goes after everything)
+  (container-sub-commands #:allocation #:each-subclass
+                          #:init-thunk (build-commands))
 
   ;; Commands we can handle by being contained by something else
   (contained-commands #:allocation #:each-subclass
             ;; Commands for co-occupants
             (get-commands gameobj-get-commands)
             ;; Commands for participants in a room
-            (get-container-commands gameobj-get-container-commands)
+            (get-container-dom-commands gameobj-get-container-dom-commands)
+            (get-container-sub-commands gameobj-get-container-sub-commands)
             ;; Commands for inventory items, etc (occupants of the gameobj commanding)
             (get-contained-commands gameobj-get-contained-commands)
 
@@ -224,10 +229,16 @@ Assists in its replacement of occupants if necessary and nothing else."
            #:commands candidate-commands
            #:goes-by (gameobj-goes-by actor)))
 
-(define* (gameobj-get-container-commands actor message #:key verb)
-  "Get commands as the container / room of message's sender"
+(define* (gameobj-get-container-dom-commands actor message #:key verb)
+  "Get (dominant) commands as the container / room of message's sender"
   (define candidate-commands
-    (get-candidate-commands actor 'container-commands verb))
+    (get-candidate-commands actor 'container-dom-commands verb))
+  (<-reply message #:commands candidate-commands))
+
+(define* (gameobj-get-container-sub-commands actor message #:key verb)
+  "Get (subordinate) commands as the container / room of message's sender"
+  (define candidate-commands
+    (get-candidate-commands actor 'container-sub-commands verb))
   (<-reply message #:commands candidate-commands))
 
 (define* (gameobj-get-contained-commands actor message #:key verb)
index f04c2feea3e6870326d4b2e5b32da951e7e19b04..78d9a01574efbed2f113f8e9f18fbd1d1e53cf63 100644 (file)
                  #:player-id (actor-id player)))))
 
   ;; Ask the room for its commands
-  (define room-commands
+  (define room-dom-commands
     ;; TODO: Map room id and sort
     (mbody-receive (_ #:key commands)
-        (<-wait player-loc 'get-container-commands
+        (<-wait player-loc 'get-container-dom-commands
+                #:verb verb)
+      commands))
+
+  (define room-sub-commands
+    ;; TODO: Map room id and sort
+    (mbody-receive (_ #:key commands)
+        (<-wait player-loc 'get-container-sub-commands
                 #:verb verb)
       commands))
 
 
   ;; Now return a big ol sorted list of ((actor-id . command))
   (append
-   (sort-commands-append-actor room-commands
+   (sort-commands-append-actor room-dom-commands
                                player-loc '()) ; room doesn't go by anything
    (sort-commands-multi-actors co-occupant-commands)
    (sort-commands-append-actor our-commands
                                (actor-id player) '()) ; nor does player
-   (sort-commands-multi-actors inv-item-commands)))
+   (sort-commands-multi-actors inv-item-commands)
+   (sort-commands-append-actor room-sub-commands
+                               player-loc '())))
 
 (define (sort-commands-append-actor commands actor-id goes-by)
   (sort-commands-multi-actors
index 3d860496e2fc4113e410f9c45483bb06f999057c..5c76977dac5106b35a4abd7cdf3ad5c9ebf56bbc 100644 (file)
@@ -67,7 +67,7 @@
          #:init-keyword #:exits
          #:getter room-exits)
 
-  (container-commands
+  (container-dom-commands
    #:allocation #:each-subclass
    #:init-thunk
    (build-commands