room level messages, client disconnection
[mudsync.git] / mudsync / player.scm
index 3d1ec7288baf6c83387046b4612436546e1105c3..8b9a22f5c72c5de58370db5843ee11bce20b0035 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
 ;;; ================