--- a/antipodes.asd Sun Jan 08 00:03:46 2017 +0000
+++ b/antipodes.asd Sun Jan 08 00:18:52 2017 +0000
@@ -31,6 +31,7 @@
(:module "entities" :serial t
:components ((:file "food")
(:file "clothing")
+ (:file "jewelery")
(:file "ruin")
(:file "player")))
(:file "flavor")
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/data/gemstones.lisp Sun Jan 08 00:18:52 2017 +0000
@@ -0,0 +1,56 @@
+#(
+ ("an" "agate")
+ ("an" "alabaster")
+ ("an" "alexandrite")
+ ("an" "amber")
+ ("an" "amethyst")
+ ("an" "ammolite")
+ ("an" "aquamarine")
+ ("an" "aventurine")
+ ("an" "azurite")
+ ("a" "bauxite")
+ ("a" "beryl")
+ ("a" "blue amber")
+ ("a" "bone")
+ ("a" "calcite")
+ ("a" "carnelian")
+ ("a" "chrysoberyl")
+ ("a" "cinnabar")
+ ("a" "citrine")
+ ("a" "coral")
+ ("a" "diamond")
+ ("a" "dolomite")
+ ("an" "emerald")
+ ("a" "feldspar")
+ ("a" "flint")
+ ("a" "garnet")
+ ("a" "hematite")
+ ("an" "ivory")
+ ("a" "jacinth")
+ ("a" "jade")
+ ("a" "jasper")
+ ("a" "jet")
+ ("a" "lapis lazuli")
+ ("a" "malachite")
+ ("a" "milky quartz")
+ ("a" "moonstone")
+ ("an" "obsidian")
+ ("an" "onyx")
+ ("an" "opal")
+ ("a" "pearl")
+ ("a" "peridot")
+ ("a" "pyrite")
+ ("a" "quartz")
+ ("a" "rose quartz")
+ ("a" "ruby")
+ ("a" "sapphire")
+ ("a" "smoky quartz")
+ ("a" "synthetic diamond")
+ ("a" "synthetic turquoise")
+ ("a" "tanzanite")
+ ("a" "tiger's-eye")
+ ("a" "topaz")
+ ("a" "tourmaline")
+ ("a" "turquoise")
+ ("a" "zircon")
+ )
--- a/package.lisp Sun Jan 08 00:03:46 2017 +0000
+++ b/package.lisp Sun Jan 08 00:18:52 2017 +0000
@@ -60,6 +60,9 @@
:clothing
:make-clothing
+ :jewelery
+ :make-jewelery
+
:trigger
:trigger?
:trigger/text
--- a/src/config.lisp Sun Jan 08 00:03:46 2017 +0000
+++ b/src/config.lisp Sun Jan 08 00:18:52 2017 +0000
@@ -2,6 +2,8 @@
(defparameter *sidebar-width* 30)
(defparameter *food-density* 1/6000)
+(defparameter *clothing-density* 1/20000)
+(defparameter *jewelery-density* 1/20000)
(defparameter *map-size* 2000)
(defparameter *noise-scale* 0.03)
(defparameter *noise-seed-x* (random 1000.0))
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/src/entities/jewelery.lisp Sun Jan 08 00:18:52 2017 +0000
@@ -0,0 +1,33 @@
+(in-package :ap.entities)
+
+(defparameter *gemstones*
+ (read-file-into-form "data/gemstones.lisp"))
+
+(defparameter *jewelery*
+ #("earring"
+ "ring"
+ "bracelet"
+ "necklace"
+ "ankle bracelet"
+ "barette"
+ "pin"
+ "brooch"
+ "hat pin"
+ "cuff link"
+ "locket"
+ "medallion"))
+
+(define-entity jewelery (visible coords holdable))
+
+(defun random-jewelery-description ()
+ (destructuring-bind (article gem)
+ (random-elt *gemstones*)
+ (format nil "~A ~A ~A" article gem (random-elt *jewelery*))))
+
+(defun make-jewelery (x y)
+ (create-entity 'jewelery
+ :coords/x x
+ :coords/y y
+ :visible/glyph "*"
+ :visible/color ap::+green-black+
+ :holdable/description (random-jewelery-description)))
--- a/src/main.lisp Sun Jan 08 00:03:46 2017 +0000
+++ b/src/main.lisp Sun Jan 08 00:18:52 2017 +0000
@@ -220,16 +220,16 @@
(iterate (repeat 2)
(player-get *player* (make-clothing 0 0))))
-(defun place-food ()
+(defun place-things (density constructor)
(iterate
- (with remaining = (round (* *food-density*
+ (with remaining = (round (* density
*map-size*
*map-size*)))
(until (zerop remaining))
(for x = (random-coord))
(for y = (random-coord))
(when (not (underwaterp (aref *terrain* x y)))
- (make-food x y)
+ (funcall constructor x y)
(decf remaining))))
(defun generate-structures ()
@@ -238,7 +238,7 @@
(defun generate-world ()
(clear-entities)
- (with-dims (30 (+ 2 4))
+ (with-dims (30 (+ 2 5))
(with-panel-and-window
(pan win *width* *height*
(center *width* *screen-width*)
@@ -252,8 +252,12 @@
(generate-structures))
(progn (write-string-left win "Placing food..." 1 3)
(redraw)
- (place-food))
- (progn (write-string-left win "Spawning player..." 1 4)
+ (place-things *food-density* #'make-food))
+ (progn (write-string-left win "Placing items..." 1 4)
+ (redraw)
+ (place-things *clothing-density* #'make-clothing)
+ (place-things *jewelery-density* #'make-jewelery))
+ (progn (write-string-left win "Spawning player..." 1 5)
(redraw)
(spawn-player))))
(world-map))