X-Git-Url: https://jxself.org/git/?a=blobdiff_plain;f=iflib.lisp;h=4ba5b5dfde16d40b7918bf717fd7fcf78a7e8ae0;hb=2d1a6f87c4d559af53eb5e5f0fe571caf14f8b29;hp=cfa4d1e358467ee3334024ef4b4ec904a57b4260;hpb=8797a54fee4de09b6a051388a0ca36bd5ee21dd6;p=lifp.git diff --git a/iflib.lisp b/iflib.lisp index cfa4d1e..4ba5b5d 100644 --- a/iflib.lisp +++ b/iflib.lisp @@ -22,9 +22,9 @@ (defpackage :if-lib (:use :common-lisp :if-basic-lib :if-console) (:export :container :room :item :clothing :capacity - :food :switchable + :food :switchable :door :predoor :n-to :ne-to :e-to :se-to :s-to :sw-to :w-to :nw-to :in-to :out-to - :u-to :d-to :cant-go + :u-to :d-to :cant-go :destination :*intscope* :*outscope* :*location* :*trace-light* :*vowels* :*score* :*gamestate* :*turns* :*dark* :add-to-scope :add-to-outscope :found-in :seen-from :with-keys @@ -91,14 +91,16 @@ ;;SECTION 2: Library-defined classes and objects -(ifclass container () (capacity integer) (has :container)) +(ifclass predoor ()) ;;Can potentially be locked... + +(ifclass container (predoor) (capacity integer) (has :container)) (ifclass supporter () (capacity integer) (has :supporter)) (ifclass room () (description string) (n-to object) (ne-to object) (e-to object) (se-to object) (s-to object) (sw-to object) (w-to object) (nw-to object) (u-to object) (d-to object) (in-to object) (out-to object) - (cant-go string) + ;(cant-go string) <- doesn't provide by default (has :light :enterable)) (ifclass item () (description string) (article string) @@ -118,6 +120,11 @@ (look (look self))) (has :~light)) +(ifclass door (predoor scenery) (destination object) + (has :door :closed :openable)) + + + ;;Compass directions (object compass ()) (object dir-n () "north" (name "north" "n") compass (property 'n-to)) @@ -155,7 +162,7 @@ (defun transparent (obj) "Whether the object is transparent" - (or (has obj :container :open) + (or (and (has obj :container) (hasnt obj :closed)) (has obj :supporter) (has obj :transparent) (eql obj *player*))) @@ -200,7 +207,7 @@ (seep1 actor obj))) (defun passable (obj) - (or (has obj :container :open) + (or (and (has obj :container) (hasnt obj :closed)) (has obj :supporter) (eql obj *player*))) @@ -321,7 +328,7 @@ (defun print-inside (obj stream) "Return the string containing the status of contents of the object" (when (has obj :container) - (if (or (has obj :open) (has obj :transparent)) + (if (or (hasnt obj :closed) (has obj :transparent)) (if (children obj) (progn (princ " (containing " stream) (princ (list-contents obj) stream) @@ -349,7 +356,7 @@ (defun default-glance (obj) "Default initial description of object" - (format t "[Default glance for ~a]~%" obj) + ;;(format t "[Default glance for ~a]~%" obj) (sprint "~a~%" (with-output-to-string (out) (princ "There is " out) (princ (print-name obj) out)