-
-;;; player methods
-
-(define (player-look-around player)
- (define room-name
- (message-ref
- (<-wait player (gameobj-loc player) 'get-name)
- 'val))
- (define room-desc
- (message-ref
- (<-wait player (gameobj-loc player) 'get-desc)
- 'val))
- (define message-text
- (format #f "**~a**\n~a\n" room-name room-desc))
-
- (<- player (gameobj-gm player) 'write-home #:text message-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))
+
+(define-mhandler (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))
+ (gameobj-occupants player)))
+ (define text-to-show
+ (if (eq? inv-names '())
+ "You aren't carrying anything.\n"
+ (apply string-append
+ "You are carrying:\n"
+ (map (lambda (item-name)
+ (string-append " * " item-name "\n"))
+ inv-names))))
+ (<- player (actor-id player) 'tell #:text text-to-show))