#:use-module (oop goops)
#:use-module (ice-9 match)
#:use-module (ice-9 format)
- #:export (<thing>
- 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 (<thing>))
(define-class <thing> (<gameobj>)
;; Can be a boolean or a procedure accepting two arguments
(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))))