added dynamic linking approach to exits. live hacking rooms works! :D :D
[mudsync.git] / mudsync / player.scm
index 09fc6d7aad49de4c282672ed05d5bfeecaec4f9a..6e4be5738b2f289ed93decb95a258f2df22f0073 100644 (file)
@@ -39,7 +39,8 @@
   (build-actions
    (init (wrap-apply player-init))
    (handle-input (wrap-apply player-handle-input))
-   (tell (wrap-apply player-tell))))
+   (tell (wrap-apply player-tell))
+   (disconnect-self-destruct (wrap-apply player-disconnect-self-destruct))))
 
 (define player-actions*
   (append player-actions
   (<- player (gameobj-gm player) 'write-home
       #:text text))
 
+(define-mhandler (player-disconnect-self-destruct player message)
+  "Action routine for being told to disconnect and self destruct."
+  (define loc (gameobj-loc player))
+  (when loc
+    (<- player loc 'tell-room
+        #:exclude (actor-id player)
+        #:text (format #f "~a disappears in a puff of entropy!\n"
+                       (slot-ref player 'name))))
+  (gameobj-self-destruct player))
+
 
 ;;; Command handling
 ;;; ================
     ;;   returns false for in the command response
     (fold
      (lambda (co-occupant prev)
-       (display "pre-message\n")
        (let* ((result (<-wait player co-occupant 'get-commands
                               #:verb verb))
               (commands (message-ref result 'commands))
               (goes-by (message-ref result 'goes-by)))
-         (display "post-message\n")
          (append
           (map (lambda (command)
                  (list command goes-by co-occupant))
 (define (find-command-winner sorted-candidates line)
   "Find a command winner from a sorted list of candidates"
   ;; A cache of results from matchers we've already seen
-  ;; TODO: fill this in
+  ;; TODO: fill in this cache.  This is a *critical* optimization!
   (define matcher-cache '())
   (call/ec
    (lambda (return)