X-Git-Url: https://jxself.org/git/?a=blobdiff_plain;ds=inline;f=mudsync%2Fthing.scm;h=a964c50e56aea0cc5233539ce3418d8ae6fdfa3f;hb=bb099f0078b2164b3010aa365a2a5d7ab4b5bb0b;hp=f2e218016ec23e6b09617b4428a18cceaf6a1dcc;hpb=754bd427883ab189433fad90293e05d9aced2f70;p=mudsync.git diff --git a/mudsync/thing.scm b/mudsync/thing.scm index f2e2180..a964c50 100644 --- a/mudsync/thing.scm +++ b/mudsync/thing.scm @@ -26,27 +26,7 @@ #:use-module (oop goops) #:use-module (ice-9 match) #:use-module (ice-9 format) - #:export ( - thing-commands - thing-commands* - thing-contained-commands - thing-contained-commands*)) - -(define thing-commands - (list - (direct-command "take" 'cmd-take))) - -;; Doesn't inherit anything (gameobj has no commands) -;; so it's an alias. -(define thing-commands* thing-commands) - -(define thing-contained-commands - (list - (direct-command "drop" 'cmd-drop))) - -;; Doesn't inherit anything (gameobj has no contained-commands) -;; so it's an alias. -(define thing-contained-commands* thing-contained-commands) + #:export ()) (define-class () ;; Can be a boolean or a procedure accepting two arguments @@ -58,11 +38,15 @@ (dropable #:init-value #t #:init-keyword #:dropable) (commands - #:init-value (wrap thing-commands)) + #:allocation #:each-subclass + #:init-thunk (build-commands + ("take" ((direct-command cmd-take))))) (contained-commands - #:init-value (wrap thing-contained-commands)) + #:allocation #:each-subclass + #:init-value (build-commands + ("drop" ((direct-command cmd-drop))))) (actions #:allocation #:each-subclass - #:init-value + #:init-thunk (build-actions (cmd-take thing-cmd-take) (cmd-drop thing-cmd-drop)))) @@ -70,9 +54,9 @@ (define* (thing-cmd-take thing message #:key direct-obj) (define player (message-from message)) (define player-name - (msg-val (<-wait player 'get-name))) + (mbody-val (<-wait player 'get-name))) (define player-loc - (msg-val (<-wait player 'get-loc))) + (mbody-val (<-wait player 'get-loc))) (define thing-name (slot-ref thing 'name)) (define should-take (slot-ref-maybe-runcheck thing 'takeable player)) @@ -95,9 +79,9 @@ (define* (thing-cmd-drop thing message #:key direct-obj) (define player (message-from message)) (define player-name - (msg-val (<-wait player 'get-name))) + (mbody-val (<-wait player 'get-name))) (define player-loc - (msg-val (<-wait player 'get-loc))) + (mbody-val (<-wait player 'get-loc))) (define thing-name (slot-ref thing 'name)) (define should-drop (slot-ref-maybe-runcheck thing 'dropable player))