X-Git-Url: https://jxself.org/git/?p=mudsync.git;a=blobdiff_plain;f=mudsync%2Fplayer.scm;fp=mudsync%2Fplayer.scm;h=844aaf96f031fbf4112a05b602a3bd5e0f4e5813;hp=a07c141fd080456615777b21ae85407df0acd937;hb=6cff5b0062ef928204295ab4327bf2d417070421;hpb=cd40c01c4ac301e7d991e4df4d17d2c693d11d05 diff --git a/mudsync/player.scm b/mudsync/player.scm index a07c141..844aaf9 100644 --- a/mudsync/player.scm +++ b/mudsync/player.scm @@ -71,12 +71,12 @@ ;;; player message handlers -(define-mhandler (player-init player message) +(define (player-init player message) ;; Look around the room we're in (<- player (gameobj-loc player) 'look-room)) -(define-mhandler (player-handle-input player message input) +(define* (player-handle-input player message #:key input) (define split-input (split-verb-and-rest input)) (define input-verb (car split-input)) (define input-rest (cdr split-input)) @@ -94,11 +94,11 @@ (<- player (gameobj-gm player) 'write-home #:text "Huh?\n")))) -(define-mhandler (player-tell player message text) +(define* (player-tell player message #:key text) (<- player (gameobj-gm player) 'write-home #:text text)) -(define-mhandler (player-disconnect-self-destruct player message) +(define (player-disconnect-self-destruct player message) "Action routine for being told to disconnect and self destruct." (define loc (gameobj-loc player)) (when loc @@ -108,13 +108,14 @@ (slot-ref player 'name)))) (gameobj-self-destruct player)) -(define-mhandler (player-cmd-inventory player message) +(define (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)) + (msg-receive (_ #:key val) + (<-wait player inv-item 'get-name) + val)) (gameobj-occupants player))) (define text-to-show (if (eq? inv-names '()) @@ -144,19 +145,19 @@ ;; Ask the room for its commands (define room-commands ;; TODO: Map room id and sort - (message-ref - (<-wait player player-loc + (msg-receive (_ #:key commands) + (<-wait player player-loc 'get-container-commands #:verb verb) - 'commands)) + commands)) ;; All the co-occupants of the room (not including ourself) (define co-occupants (remove (lambda (x) (equal? x (actor-id player))) - (message-ref - (<-wait player player-loc 'get-occupants) - 'occupants))) + (msg-receive (_ #:key occupants) + (<-wait player player-loc 'get-occupants) + occupants))) ;; @@: There's a race condition here if someone leaves the room ;; during this, heh... @@ -167,10 +168,9 @@ (define co-occupant-commands (fold (lambda (co-occupant prev) - (let* ((result (<-wait player co-occupant 'get-commands - #:verb verb)) - (commands (message-ref result 'commands)) - (goes-by (message-ref result 'goes-by))) + (msg-receive (_ #:key commands goes-by) + (<-wait player co-occupant 'get-commands + #:verb verb) (append (map (lambda (command) (list command goes-by co-occupant)) @@ -193,11 +193,10 @@ (define inv-item-commands (fold (lambda (inv-item prev) - (let* ((result (<-wait player inv-item - 'get-contained-commands - #:verb verb)) - (commands (message-ref result 'commands)) - (goes-by (message-ref result 'goes-by))) + (msg-receive (_ #:key commands goes-by) + (<-wait player inv-item + 'get-contained-commands + #:verb verb) (append (map (lambda (command) (list command goes-by inv-item))