;;;; ;;;; Terra Nostra is a Minecraft-like survival game for the commandline. ;;;; ;;;; This file defines in-game items. ;;;; ;;;; (c) 2018 Daniel Vedder, MIT license ;;;; (defstruct item (name "") (description "") (weight 0) (movable T) (destroy-with '()) (drops '()) (craft-with '())) (let ((item-list NIL)) (defun register-item (symbol-name item-object) (setf item-list (cons (list symbol-name item-object) item-list))) (defun get-item-type (symbol-name) (cassoc symbol-name item-list)) (defun get-item (symbol-name) (copy-item (get-item-type symbol-name)))) ;;; RESOURCE ITEMS (register-item 'wood (make-item :name "wood" :weight 1 :description "A block of wood, just right for working with")) (register-item 'stone (make-item :name "stone" :weight 2 :description "A fist-sized stone. What are you going to do with it?")) (register-item 'iron (make-item :name "iron" :weight 3 :description "An iron ingot, ready for further crafting.")) ;;; NATURE ITEMS (register-item 'oak (make-item :name "oak" :description "An old, majestic oak, gnarled with age." :destroy-with '(stone-axe iron-axe) :drops '(wood) :movable NIL :weight 2000)) (register-item 'rock (make-item :name "rock" :description "A huge lump of grey basalt, sticking out of the ground." :destroy-with '(stone-pickaxe iron-pickaxe) :drops '(stone) :movable NIL :weight 5000)) ;;; TOOL ITEMS ;;TODO Faustkeil? (register-item 'stone-axe (make-item :name "stone axe" :description "An axe, crudely but effectively fashioned out of stone." :weight 2 :craft-with '(stone wood))) (register-item 'iron-axe (make-item :name "iron axe" :description "A finely honed iron axe, just right for chopping wood." :weight 3 :craft-with '(iron wood))) (register-item 'stone-pickaxe (make-item :name "stone pickaxe" :description "A pickaxe, somewhat helplessly made from stone." :weight 3 :craft-with '(stone wood))) (register-item 'iron-pickaxe (make-item :name "iron pickaxe" :description "A solid iron pickaxe. Prepare to split rock!" :weight 4 :craft-with '(iron wood)))