projects
/
mudsync.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
29f9028
)
Announce comings and goings
author
Christopher Allan Webber
<cwebber@dustycloud.org>
Fri, 6 May 2016 17:59:06 +0000
(12:59 -0500)
committer
Christopher Allan Webber
<cwebber@dustycloud.org>
Fri, 6 May 2016 17:59:06 +0000
(12:59 -0500)
mudsync/room.scm
patch
|
blob
|
history
diff --git
a/mudsync/room.scm
b/mudsync/room.scm
index 6baea54ce99daef1d83e8b0440de2fb0ef8a4f5e..594d913b0e0a50991641d93ea854f9371cb42e44 100644
(file)
--- a/
mudsync/room.scm
+++ b/
mudsync/room.scm
@@
-81,6
+81,7
@@
(wire-exits! (wrap-apply room-wire-exits!))
(cmd-go (wrap-apply room-cmd-go))
(cmd-go-where (wrap-apply room-cmd-go-where))
(wire-exits! (wrap-apply room-wire-exits!))
(cmd-go (wrap-apply room-cmd-go))
(cmd-go-where (wrap-apply room-cmd-go-where))
+ (announce-entrance (wrap-apply room-announce-entrance))
(look-room (wrap-apply room-look-room))
(tell-room (wrap-apply room-act-tell-room))
;; in this case the command is the same version as the normal
(look-room (wrap-apply room-look-room))
(tell-room (wrap-apply room-act-tell-room))
;; in this case the command is the same version as the normal
@@
-134,11
+135,22
@@
claim to point to."
(lambda (exit)
(equal? (exit-name exit) direct-obj))
(room-exits room)))
(lambda (exit)
(equal? (exit-name exit) direct-obj))
(room-exits room)))
+ (define to-address (slot-ref exit 'to-address))
+ (define player-name
+ (message-ref (<-wait room (message-from message)
+ 'get-name) 'val))
(cond
(exit
;; Set the player's new location
(<-wait room (message-from message) 'set-loc!
(cond
(exit
;; Set the player's new location
(<-wait room (message-from message) 'set-loc!
- #:loc (slot-ref exit 'to-address))
+ #:loc to-address)
+ ;; Tell everyone else the person walked away
+ (room-tell-room
+ room
+ (format #f "~a wanders ~a.\n"
+ player-name direct-obj))
+ (<- room to-address 'announce-entrance
+ #:who-entered (message-from message))
;; Have the new room update the player to the new location
(<- room (slot-ref exit 'to-address) 'look-room
#:to-id (message-from message)))
;; Have the new room update the player to the new location
(<- room (slot-ref exit 'to-address) 'look-room
#:to-id (message-from message)))
@@
-288,3
+300,12
@@
claim to point to."
(define message-to-send
(format #f "~a says: ~a\n" player-name phrase))
(room-tell-room room message-to-send))
(define message-to-send
(format #f "~a says: ~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))