+
+(define (room-find-thing-called room called-this)
+ "Find something called CALLED-THIS in the room, if any."
+ (call/ec
+ (lambda (return)
+ (for-each
+ (lambda (occupant)
+ (define goes-by
+ (message-ref (<-wait room occupant 'goes-by)
+ 'goes-by #f))
+ (if (member called-this goes-by)
+ (return occupant)))
+ (hash-map->list (lambda (key val) key)
+ (slot-ref room 'occupants)))
+ #f)))
+
+(define %formless-desc
+ "You don't see anything special.")
+
+(define-mhandler (room-look-at room message direct-obj)
+ "Look at a specific object in the room."
+ (define matching-object
+ (room-find-thing-called room direct-obj))
+
+ (cond
+ (matching-object
+ (let ((obj-desc
+ (message-ref
+ (<-wait room matching-object 'get-desc
+ #:whos-looking (message-from message))
+ 'val)))
+ (if obj-desc
+ (<- room (message-from message) 'tell
+ #:text (string-append obj-desc "\n"))
+ (<- room (message-from message) 'tell
+ #:text (string-append %formless-desc "\n")))))
+ (else
+ (<- room (message-from message) 'tell
+ #:text "You don't see that here, so you can't look at it.\n"))))
+
+
+(define* (room-tell-room room text #:key exclude wait)
+ (define who-to-tell (gameobj-occupants room #:exclude exclude))
+ (for-each
+ (lambda (tell-me)
+ ;; @@: Does anything really care?
+ (define deliver-method
+ (if wait
+ <-wait
+ <-))
+ (deliver-method room tell-me 'tell
+ #:text text))
+ who-to-tell))
+
+(define-mhandler (room-act-tell-room room message text)
+ "Tell the room some messages."
+ (define exclude (message-ref message 'exclude #f))
+ (define wait-delivery (message-ref message 'wait #f))
+ (room-tell-room room text
+ #:exclude exclude
+ #:wait wait-delivery))
+
+(define-mhandler (room-cmd-say room message phrase)
+ "Command: Say something to room participants."
+ (define player-name
+ (message-ref (<-wait room (message-from message)
+ 'get-name) 'val))
+ (define message-to-send
+ (format #f "~a says: ~a\n" player-name phrase))
+ (room-tell-room room message-to-send))
+
+(define-mhandler (room-cmd-emote room message phrase)
+ "Command: Say something to room participants."
+ (define player-name
+ (message-ref (<-wait room (message-from message)
+ 'get-name) 'val))
+ (define message-to-send
+ (format #f "* ~a ~a\n" player-name phrase))
+ (room-tell-room room message-to-send))
+
+(define-mhandler (room-announce-entrance room message who-entered)
+ (define player-name
+ (message-ref (<-wait room who-entered 'get-name)
+ 'val))
+ (define message-to-send
+ (format #f "~a enters the room.\n" player-name))
+ (room-tell-room room message-to-send
+ #:exclude who-entered))