;;;; ;;;; Terra Nostra is a Minecraft-like survival game for the commandline. ;;;; ;;;; Biomes are habitat types, that provide default functions for patches. ;;;; This file defines the biome struct and the inbuilt biomes. ;;;; ;;;; (c) 2018 Daniel Vedder, MIT license ;;;; ;; Biome struct and register (defstruct biome (name "") (char #\.) ;map display character (init-items '()) ;initial items for patches with this biome (update-fn #'(lambda (patch-pos) NIL))) ;needs a patch position argument (let ((biome-list NIL)) (defun register-biome (symbol-name biome-object) (setf biome-list (cons (list symbol-name biome-object) biome-list))) (defun get-biome (symbol-name) (cassoc symbol-name biome-list))) (defmacro new-biome (name &body body) `(register-biome ,name (make-biome ,@body))) ;; Grasslands biome (defun update-grasslands (patch-pos) ;;TODO ) (new-biome 'grassland :name "grassland" :char #\i :init-items NIL ;TODO :update-fn #'update-grasslands) ;; Forest biome (defun update-forest (patch-pos) ;;TODO ) (new-biome 'forest :name "forest" :char #\Y :init-items NIL ;TODO :update-fn #'update-forest) ;; Stream biome (defun update-stream (patch-pos) ;;TODO ) (new-biome 'stream :name "stream" :char #\~ :init-items NIL ;TODO :update-fn #'update-stream) ;; Hill biome (defun update-hill (patch-pos) ;;TODO ) (new-biome 'hill :name "hill" :char #\m :init-items NIL ;TODO :update-fn #'update-hill)