Added emote!
authorChristopher Allan Webber <cwebber@dustycloud.org>
Fri, 6 May 2016 20:12:28 +0000 (15:12 -0500)
committerChristopher Allan Webber <cwebber@dustycloud.org>
Fri, 6 May 2016 20:12:28 +0000 (15:12 -0500)
mudsync/room.scm

index 11920e2d04100b2420226eae915893a519725d24..0b0e85262f5f878b54bfbce6ca84a42dd49f3adb 100644 (file)
@@ -72,7 +72,8 @@
    (empty-command "look" 'cmd-look-room)
    (empty-command "go" 'cmd-go-where)
    (loose-direct-command "go" 'cmd-go)
-   (greedy-command "say" 'cmd-say)))
+   (greedy-command "say" 'cmd-say)
+   (greedy-command "emote" 'cmd-emote)))
 
 (define room-actions
   (build-actions
@@ -88,7 +89,8 @@
    ;; look-room version
    (cmd-look-room (wrap-apply room-look-room))
    (cmd-look-at (wrap-apply room-look-at))
-   (cmd-say (wrap-apply room-cmd-say))))
+   (cmd-say (wrap-apply room-cmd-say))
+   (cmd-emote (wrap-apply room-cmd-emote))))
 
 (define room-actions*
   (append room-actions gameobj-actions))
@@ -301,6 +303,15 @@ claim to point to."
     (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)