Update codebase to use 8sync-fibers
[mudsync.git] / mudsync / player.scm
index f04c2feea3e6870326d4b2e5b32da951e7e19b04..feea1ef5bbbf5454c8a1cd2deb05b7995e6cc728 100644 (file)
@@ -21,6 +21,7 @@
   #:use-module (mudsync gameobj)
   #:use-module (mudsync game-master)
   #:use-module (mudsync parser)
+  #:use-module (mudsync receive-star)
   #:use-module (8sync actors)
   #:use-module (8sync agenda)
   #:use-module (8sync rmeta-slot)
   (define inv-names
     (map
      (lambda (inv-item)
-       (mbody-val (<-wait inv-item 'get-name)))
+       (<-wait inv-item 'get-name))
      (gameobj-occupants player)))
   (define text-to-show
     (if (eq? inv-names '())
                  #: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
+    (receive* (#:key commands)
+        (<-wait player-loc 'get-container-dom-commands
+                #:verb verb)
+      commands))
+
+  (define room-sub-commands
+    ;; TODO: Map room id and sort
+    (receive* (#:key commands)
+        (<-wait player-loc 'get-container-sub-commands
                 #:verb verb)
       commands))
 
   (define co-occupants
     (remove
      (lambda (x) (equal? x (actor-id player)))
-     (mbody-val (<-wait player-loc 'get-occupants))))
+     (<-wait player-loc 'get-occupants)))
 
   ;; @@: There's a race condition here if someone leaves the room
   ;;   during this, heh...
   (define co-occupant-commands
     (fold
      (lambda (co-occupant prev)
-       (mbody-receive (_ #:key commands goes-by)
+       (receive* (#:key commands goes-by)
            (<-wait co-occupant 'get-commands
                    #:verb verb)
          (append
   (define inv-item-commands
     (fold
      (lambda (inv-item prev)
-       (mbody-receive (_ #:key commands goes-by)
+       (receive* (#:key commands goes-by)
            (<-wait inv-item 'get-contained-commands
                    #:verb verb)
          (append
 
   ;; 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