# HG changeset patch # User Steve Losh # Date 1483822650 0 # Node ID 50624f6d57d7f67e380691c8ced4092ff80245d5 # Parent dd9a7ef86a218133370dc89b45d1b6c22124dce7 Add item pickup diff -r dd9a7ef86a21 -r 50624f6d57d7 src/config.lisp --- a/src/config.lisp Sat Jan 07 20:50:14 2017 +0000 +++ b/src/config.lisp Sat Jan 07 20:57:30 2017 +0000 @@ -7,7 +7,7 @@ (defparameter *noise-seed-x* (random 1000.0)) (defparameter *noise-seed-y* (random 1000.0)) -(defparameter *ruin-density* 1/1000) +(defparameter *ruin-density* 1/20000) (defparameter *ruin-size-mean* 10.0) (defparameter *ruin-size-dev* 2.0) (defparameter *graffiti-chance* 1/10) diff -r dd9a7ef86a21 -r 50624f6d57d7 src/entities/player.lisp --- a/src/entities/player.lisp Sat Jan 07 20:50:14 2017 +0000 +++ b/src/entities/player.lisp Sat Jan 07 20:57:30 2017 +0000 @@ -35,7 +35,10 @@ (defun tick-player (player) (zapf (player/energy player) (clamp 0.0 100.0 (- % 0.1)) - (player/health player) (clamp 0.0 100.0 (+ % 0.1)))) + (player/health player) (clamp 0.0 100.0 + (+ % (if (minusp (player/energy player)) + -0.1 + 0.1))))) (defun player-inventory-full-p (player) diff -r dd9a7ef86a21 -r 50624f6d57d7 src/main.lisp --- a/src/main.lisp Sat Jan 07 20:50:14 2017 +0000 +++ b/src/main.lisp Sat Jan 07 20:57:30 2017 +0000 @@ -375,10 +375,17 @@ (when (passablep (aref *structures* dest-x dest-y)) (coords-move-entity player dest-x dest-y)))) +(defun get-items () + (iterate (for item :in (remove-if-not #'holdable? (coords-nearby *player* 0))) + (until (player-inventory-full-p *player*)) + (player-get *player* item))) + + (defun world-map-input (window) (case (charms:get-char window) (#\q :quit) (#\h :help) + (#\g (get-items) :tick) (:left (move-player -1 0) :tick) (:right (move-player 1 0) :tick) (:up (move-player 0 -1) :tick)