X-Git-Url: https://jxself.org/git/?p=mudsync.git;a=blobdiff_plain;f=mudsync%2Fplayer.scm;h=172b81072b4e85e98fcf8536f91be5a9a1dccae3;hp=d2fc76dd64d1cbb15a4cf079bb3c9de8317761e9;hb=b2f9a911ac1663fda4dc3cf18ade3334c01327b2;hpb=7e11c67b59dc07a46576b2acaa4657ee533df7d5 diff --git a/mudsync/player.scm b/mudsync/player.scm index d2fc76d..172b810 100644 --- a/mudsync/player.scm +++ b/mudsync/player.scm @@ -165,8 +165,6 @@ ;; Get all the co-occupants' commands (define co-occupant-commands - ;; TODO: Switch this to a fold. Ignore a result if it - ;; returns false for in the command response (fold (lambda (co-occupant prev) (let* ((result (<-wait player co-occupant 'get-commands @@ -189,7 +187,24 @@ (val-or-run (slot-ref player 'self-commands)))) - ;; TODO: Append our inventory's relevant command handlers + ;; Append our inventory's relevant command handlers + (define inv-items + (gameobj-occupants player)) + (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))) + (append + (map (lambda (command) + (list command goes-by inv-item)) + commands) + prev))) + '() + inv-items)) ;; Now return a big ol sorted list of ((actor-id . command)) (append @@ -197,7 +212,8 @@ player-loc '()) ; room doesn't go by anything (sort-commands-multi-actors co-occupant-commands) (sort-commands-append-actor our-commands - (actor-id player) '()))) ; nor does player + (actor-id player) '()) ; nor does player + (sort-commands-multi-actors inv-item-commands))) (define (sort-commands-append-actor commands actor-id goes-by) (sort-commands-multi-actors