# HG changeset patch # User Steve Losh # Date 1470668790 0 # Node ID 13cffbf1735345df5eca0bd8e1b2580e3bef1ccc # Parent 62acd4bfdc0f02b601e9b996e82f201cd32f0b8b Cleanup diff -r 62acd4bfdc0f -r 13cffbf17353 silt.lisp --- a/silt.lisp Mon Aug 08 15:00:27 2016 +0000 +++ b/silt.lisp Mon Aug 08 15:06:30 2016 +0000 @@ -851,15 +851,39 @@ ;;; Mysteries (define-entity monolith (coords visible sentient flavor) - (countdown :initarg :countdown :accessor monolith-countdown)) + (countdown :initarg :countdown)) (define-entity fountain (coords visible sentient flavor inspectable) - (recent :initform (make-ticklist) :accessor fountain-recent)) + (recent :initform (make-ticklist))) (define-entity colossus (coords visible sentient flavor inspectable) - (counter :initform 1 :accessor colossus-counter) - (next :initform 1000 :accessor colossus-next)) + (counter :initform 1) + (next :initform 1000)) + +(defun monolith-act (m) + (when (zerop *population*) + (with-slots (countdown) m + (case (decf countdown) + (40 (log-message "The monolith begins to glow.")) + (0 (progn + (setf countdown 100) + (-<> (make-creature (coords/x m) (1+ (coords/y m))) + creature-name + (log-message + "The monolith flashes brightly and ~A appears in front of it!" + <>)))))))) + +(defun fountain-act (f) + (with-slots (recent) f + (zapf recent #'ticklist-tick) + (iterate + (for creature :in (remove-if-not #'creature? (nearby f))) + (unless (member creature (ticklist-contents recent)) + (creature-mutate creature) + (ticklist-push recent creature 1000) + (log-message "~A drinks from the fountain and... changes." + (creature-name creature)))))) (defun colossus-act (c) (with-slots (counter next) c @@ -870,28 +894,6 @@ (coords-move-entity c (1+ (coords/x c)) (coords/y c)) (log-message "The colossus takes a step.")))) -(defun monolith-act (m) - (when (zerop *population*) - (case (decf (monolith-countdown m)) - (40 (log-message "The monolith begins to glow.")) - (0 (progn - (setf (monolith-countdown m) 100) - (-<> (make-creature (coords/x m) (1+ (coords/y m))) - creature-name - (log-message - "The monolith flashes brightly and ~A appears in front of it!" - <>))))))) - -(defun fountain-act (f) - (zapf (fountain-recent f) #'ticklist-tick) - (iterate - (for creature :in (remove-if-not #'creature? (nearby f))) - (unless (member creature (ticklist-contents (fountain-recent f))) - (creature-mutate creature) - (ticklist-push (fountain-recent f) creature 1000) - (log-message "~A drinks from the fountain and... changes." - (creature-name creature))))) - (defun make-monolith () (create-entity 'monolith