+ #:init-thunk
+ (build-commands
+ ("look" ((loose-direct-command cmd-look-at)
+ (empty-command cmd-look-room)))
+ ("go" ((empty-command cmd-go-where)
+ (loose-direct-command cmd-go)))
+ (("say" "\"" "'") ((greedy-command cmd-say)))
+ (("emote" "/me") ((greedy-command cmd-emote)))))
+
+ (actions #:allocation #:each-subclass
+ #:init-thunk
+ (build-actions
+ (cmd-go room-cmd-go)
+ (cmd-go-where room-cmd-go-where)
+ (announce-entrance room-announce-entrance)
+ (look-room room-look-room)
+ (tell-room room-act-tell-room)
+ ;; in this case the command is the same version as the normal
+ ;; look-room version
+ (cmd-look-room room-look-room)
+ (cmd-look-at room-look-at)
+ (cmd-say room-cmd-say)
+ (cmd-emote room-cmd-emote))))
+
+(define* (room-cmd-go room message #:key direct-obj)
+ (define exit
+ (find
+ (lambda (exit)
+ (equal? (exit-name exit) direct-obj))
+ (room-exits room)))
+ (define to-address (if exit
+ ;; Get the exit, but resolve it dynamically
+ ;; in case it's a special
+ (dyn-ref room (slot-ref exit 'to))
+ #f))
+ (define player-name
+ (mbody-val (<-wait (message-from message) 'get-name)))
+ (cond
+ (exit
+ ;; Set the player's new location
+ (<-wait (message-from message) 'set-loc!
+ #:loc to-address)
+ ;; Tell everyone else the person walked away
+ (room-tell-room
+ room
+ (format #f "~a wanders ~a.\n"
+ player-name direct-obj))
+ (<- to-address 'announce-entrance
+ #:who-entered (message-from message))
+ ;; Have the new room update the player to the new location
+ (<- to-address 'look-room
+ #:to-id (message-from message)))
+ (else
+ (<- (message-from message) 'tell
+ #:text "You don't see any way to go there.\n"))))
+
+(define (room-cmd-go-where room message)
+ (<- (message-from message) 'tell
+ #:text "Go where?\n"))
+
+;;; look commands