Newer
Older
naledi / biome.lisp
;;;;
;;;; 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)))

;; Grasslands biome

(defun update-grasslands (patch-pos)
	;;TODO
	)

(register-biome 'grassland
	(make-biome :name "grassland" :char #\i
		:init-items NIL ;TODO
		:update-fn #'update-grasslands))

;; Forest biome

(defun update-forest (patch-pos)
	;;TODO
	)

(register-biome 'forest
	(make-biome :name "forest" :char #\Y
		:init-items NIL ;TODO
		:update-fn #'update-forest))

;; Stream biome

(defun update-stream (patch-pos)
	;;TODO
	)

(register-biome 'stream
	(make-biome :name "stream" :char #\~
		:init-items NIL ;TODO
		:update-fn #'update-stream))