Port to the remove-define-mhandler 8sync branch
[mudsync.git] / mudsync / player.scm
index a07c141fd080456615777b21ae85407df0acd937..844aaf96f031fbf4112a05b602a3bd5e0f4e5813 100644 (file)
 
 ;;; player message handlers
 
-(define-mhandler (player-init player message)
+(define (player-init player message)
   ;; Look around the room we're in
   (<- player (gameobj-loc player) 'look-room))
 
 
-(define-mhandler (player-handle-input player message input)
+(define* (player-handle-input player message #:key input)
   (define split-input (split-verb-and-rest input))
   (define input-verb (car split-input))
   (define input-rest (cdr split-input))
      (<- player (gameobj-gm player) 'write-home
          #:text "Huh?\n"))))
 
-(define-mhandler (player-tell player message text)
+(define* (player-tell player message #:key text)
   (<- player (gameobj-gm player) 'write-home
       #:text text))
 
-(define-mhandler (player-disconnect-self-destruct player message)
+(define (player-disconnect-self-destruct player message)
   "Action routine for being told to disconnect and self destruct."
   (define loc (gameobj-loc player))
   (when loc
                        (slot-ref player 'name))))
   (gameobj-self-destruct player))
 
-(define-mhandler (player-cmd-inventory player message)
+(define (player-cmd-inventory player message)
   "Display the inventory for the player"
   (define inv-names
     (map
      (lambda (inv-item)
-       (message-ref (<-wait player inv-item 'get-name)
-                    'val))
+       (msg-receive (_ #:key val)
+           (<-wait player inv-item 'get-name)
+         val))
      (gameobj-occupants player)))
   (define text-to-show
     (if (eq? inv-names '())
   ;; Ask the room for its commands
   (define room-commands
     ;; TODO: Map room id and sort
-    (message-ref
-     (<-wait player player-loc
+    (msg-receive (_ #:key commands)
+        (<-wait player player-loc
              'get-container-commands
              #:verb verb)
-     'commands))
+      commands))
 
   ;; All the co-occupants of the room (not including ourself)
   (define co-occupants
     (remove
      (lambda (x) (equal? x (actor-id player)))
-     (message-ref
-      (<-wait player player-loc 'get-occupants)
-      'occupants)))
+     (msg-receive (_ #:key occupants)
+         (<-wait player player-loc 'get-occupants)
+       occupants)))
 
   ;; @@: There's a race condition here if someone leaves the room
   ;;   during this, heh...
   (define co-occupant-commands
     (fold
      (lambda (co-occupant prev)
-       (let* ((result (<-wait player co-occupant 'get-commands
-                              #:verb verb))
-              (commands (message-ref result 'commands))
-              (goes-by (message-ref result 'goes-by)))
+       (msg-receive (_ #:key commands goes-by)
+           (<-wait player co-occupant 'get-commands
+                              #:verb verb)
          (append
           (map (lambda (command)
                  (list command goes-by co-occupant))
   (define inv-item-commands
     (fold
      (lambda (inv-item prev)
-       (let* ((result (<-wait player inv-item
-                              'get-contained-commands
-                              #:verb verb))
-              (commands (message-ref result 'commands))
-              (goes-by (message-ref result 'goes-by)))
+       (msg-receive (_ #:key commands goes-by)
+           (<-wait player inv-item
+                   'get-contained-commands
+                   #:verb verb)
          (append
           (map (lambda (command)
                  (list command goes-by inv-item))