diff options
Diffstat (limited to 'apple-town-fair/place.scm')
-rw-r--r-- | apple-town-fair/place.scm | 28 |
1 files changed, 26 insertions, 2 deletions
diff --git a/apple-town-fair/place.scm b/apple-town-fair/place.scm index 45534a9..2cfb5ed 100644 --- a/apple-town-fair/place.scm +++ b/apple-town-fair/place.scm @@ -14,13 +14,37 @@ ;;; along with this program. If not, see ;;; <http://www.gnu.org/licenses/>. (define-module (apple-town-fair place) + #:use-module (catbird config) #:use-module (catbird node) #:use-module (catbird node-2d) #:use-module (oop goops) - #:export (<place>)) + #:export (<action> + condition + duration + exec + performable? + perform + <place> + title + actions)) + +(define-root-class <action> () + (name #:accessor name #:init-keyword #:name) + (condition #:accessor condition #:init-keyword #:condition + #:init-form (const #t)) + (exec #:accessor exec #:init-keyword #:exec) + (duration #:accessor duration #:init-keyword #:duration #:init-value 1)) + +(define-method (performable? (action <action>) state) + ((condition action) state)) + +(define-method (perform (action <action>) state) + ((exec action) state)) (define-class <place> (<node-2d>) - (background #:accessor background #:init-keyword #:background)) + (title #:accessor title #:init-keyword #:title #:init-value "Unknown") + (background #:accessor background #:init-keyword #:background) + (actions #:accessor actions #:init-keyword #:actions #:init-value '())) (define-method (on-boot (place <place>)) (attach-to place |