(:export :attack :take :teleport :examine \r
:go-to \r
:take :put-in :put-on :drop :receive\r
- :wear :strip :enter :climb)\r
+ :wear :strip :enter :climb :drink :eat\r
+ :rub :turn :switch-on :switch-off)\r
(:shadow :listen)\r
(:shadowing-import-from :if-lib :room))\r
\r
'(:noun -> listen)\r
'("to" :noun -> listen))\r
\r
+(verb "drink" "sip" "swallow" '(:noun -> drink))\r
+\r
+(verb "eat" "consume" '(:held -> eat))\r
+\r
+(verb "rub" "clean" "dust" "polish" "scrub" "shine"\r
+ "sweep" "wipe" '(:noun -> rub))\r
+\r
+(verb "switch"\r
+ '(:noun -> switch-on)\r
+ '(:noun "on" -> switch-on)\r
+ '(:noun "off" -> switch-off)\r
+ '("on" :noun -> switch-on)\r
+ '("off" :noun -> switch-off))\r
+\r
+(verb "turn"\r
+ '(:noun -> turn)\r
+ '(:noun "on" -> switch-on)\r
+ '(:noun "off" -> switch-off)\r
+ '("on" :noun -> switch-on)\r
+ '("off" :noun -> switch-off))\r
+\r
+\r
+\r
(defaction attack (obj) "Violence is not the answer.")\r
\r
(defaction teleport (obj) \r
(defaction take (obj)\r
"You can't take that.")\r
\r
-(defmethod take((obj item))\r
+(defmethod take ((obj item))\r
(if (has obj :item)\r
(if (in obj *player*) \r
(progn (sprint "You already have ~A" (the-name obj)) t) \r
"You can't climb that.")\r
\r
(defaction listen (what)\r
- "You hear nothing unexpected.")
\ No newline at end of file
+ "You hear nothing unexpected.")\r
+\r
+(defaction drink (what)\r
+ "You can't drink that.")\r
+\r
+(defaction eat (what)\r
+ "You can't eat that.")\r
+\r
+(defmethod eat ((obj food))\r
+ (if (has obj :edible)\r
+ (progn \r
+ (rmv obj)\r
+ (when (run-action-after obj)\r
+ (format nil "You eat ~a." (the-name obj))))\r
+ (call-next-method)))\r
+\r
+(defaction rub (what)\r
+ "This action achieves nothing.")\r
+\r
+(defaction turn (what)\r
+ "That's fixed in place")\r
+\r
+(defmethod turn ((item item))\r
+ (if (has item :item)\r
+ "This action achieves nothing."\r
+ (call-next-method)))\r
+\r
+(defaction switch-on (what)\r
+ "You can't switch this on")\r
+\r
+(defaction switch-off (what)\r
+ "You can't switch this off")\r
+\r
+(defmethod switch-on ((obj switchable))\r
+ (if (has obj :switchable)\r
+ (progn\r
+ (if (has obj :on)\r
+ (format nil "~a is already on." (the-name obj))\r
+ (progn (give obj :on)\r
+ (when (run-action-after obj) "Done."))))\r
+ (call-next-method)))\r
+\r
+(defmethod switch-off ((obj switchable))\r
+ (if (has obj :switchable)\r
+ (progn\r
+ (if (hasnt obj :on)\r
+ (format nil "~a is already off." (the-name obj))\r
+ (progn (give obj :~on)\r
+ (when (run-action-after obj) "Done."))))\r
+ (call-next-method))) \r
+ \r