From: Christopher Allan Webber Date: Sun, 29 Jan 2017 04:20:20 +0000 (-0600) Subject: distinguish container-sub-commands and container-dom-commands X-Git-Tag: fosdem-2017~50 X-Git-Url: https://jxself.org/git/?p=mudsync.git;a=commitdiff_plain;h=f22e3b3e60031ebb8ef6260692bf8c03dcce1c60 distinguish container-sub-commands and container-dom-commands --- diff --git a/mudsync/gameobj.scm b/mudsync/gameobj.scm index 64c79f1..ebd4db7 100644 --- a/mudsync/gameobj.scm +++ b/mudsync/gameobj.scm @@ -88,8 +88,12 @@ '("in" "inside" "on")))))) ;; Commands we can handle by being something's container - (container-commands #:allocation #:each-subclass - #:init-thunk (build-commands)) + ;; dominant version (goes before everything) + (container-dom-commands #:allocation #:each-subclass + #:init-thunk (build-commands)) + ;; subordinate version (goes after everything) + (container-sub-commands #:allocation #:each-subclass + #:init-thunk (build-commands)) ;; Commands we can handle by being contained by something else (contained-commands #:allocation #:each-subclass @@ -127,7 +131,8 @@ ;; Commands for co-occupants (get-commands gameobj-get-commands) ;; Commands for participants in a room - (get-container-commands gameobj-get-container-commands) + (get-container-dom-commands gameobj-get-container-dom-commands) + (get-container-sub-commands gameobj-get-container-sub-commands) ;; Commands for inventory items, etc (occupants of the gameobj commanding) (get-contained-commands gameobj-get-contained-commands) @@ -224,10 +229,16 @@ Assists in its replacement of occupants if necessary and nothing else." #:commands candidate-commands #:goes-by (gameobj-goes-by actor))) -(define* (gameobj-get-container-commands actor message #:key verb) - "Get commands as the container / room of message's sender" +(define* (gameobj-get-container-dom-commands actor message #:key verb) + "Get (dominant) commands as the container / room of message's sender" (define candidate-commands - (get-candidate-commands actor 'container-commands verb)) + (get-candidate-commands actor 'container-dom-commands verb)) + (<-reply message #:commands candidate-commands)) + +(define* (gameobj-get-container-sub-commands actor message #:key verb) + "Get (subordinate) commands as the container / room of message's sender" + (define candidate-commands + (get-candidate-commands actor 'container-sub-commands verb)) (<-reply message #:commands candidate-commands)) (define* (gameobj-get-contained-commands actor message #:key verb) diff --git a/mudsync/player.scm b/mudsync/player.scm index f04c2fe..78d9a01 100644 --- a/mudsync/player.scm +++ b/mudsync/player.scm @@ -148,10 +148,17 @@ #:player-id (actor-id player))))) ;; Ask the room for its commands - (define room-commands + (define room-dom-commands ;; TODO: Map room id and sort (mbody-receive (_ #:key commands) - (<-wait player-loc 'get-container-commands + (<-wait player-loc 'get-container-dom-commands + #:verb verb) + commands)) + + (define room-sub-commands + ;; TODO: Map room id and sort + (mbody-receive (_ #:key commands) + (<-wait player-loc 'get-container-sub-commands #:verb verb) commands)) @@ -205,12 +212,14 @@ ;; Now return a big ol sorted list of ((actor-id . command)) (append - (sort-commands-append-actor room-commands + (sort-commands-append-actor room-dom-commands 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 - (sort-commands-multi-actors inv-item-commands))) + (sort-commands-multi-actors inv-item-commands) + (sort-commands-append-actor room-sub-commands + player-loc '()))) (define (sort-commands-append-actor commands actor-id goes-by) (sort-commands-multi-actors diff --git a/mudsync/room.scm b/mudsync/room.scm index 3d86049..5c76977 100644 --- a/mudsync/room.scm +++ b/mudsync/room.scm @@ -67,7 +67,7 @@ #:init-keyword #:exits #:getter room-exits) - (container-commands + (container-dom-commands #:allocation #:each-subclass #:init-thunk (build-commands