You can now kiss the frog!
[mudsync.git] / worlds / bricabrac.scm
1 ;;; Mudsync --- Live hackable MUD
2 ;;; Copyright © 2016, 2017 Christine Lemmer-Webber <cwebber@dustycloud.org>
3 ;;;
4 ;;; This file is part of Mudsync.
5 ;;;
6 ;;; Mudsync is free software; you can redistribute it and/or modify it
7 ;;; under the terms of the GNU General Public License as published by
8 ;;; the Free Software Foundation; either version 3 of the License, or
9 ;;; (at your option) any later version.
10 ;;;
11 ;;; Mudsync is distributed in the hope that it will be useful, but
12 ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
13 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14 ;;; General Public License for more details.
15 ;;;
16 ;;; You should have received a copy of the GNU General Public License
17 ;;; along with Mudsync.  If not, see <http://www.gnu.org/licenses/>.
18
19 ;;; Hotel Bricabrac
20
21 (use-modules (mudsync)
22              (mudsync container)
23              (8sync)
24              (oop goops)
25              (ice-9 control)
26              (ice-9 format)
27              (ice-9 match)
28              (rx irregex))
29
30
31 \f
32 ;;; Utilities, useful or otherwise
33 ;;; ==============================
34
35 (set! *random-state* (random-state-from-platform))
36
37 (define (random-choice lst)
38   (list-ref lst (random (length lst))))
39
40 ;; list of lists, lol.
41 (define-syntax-rule (lol (list-contents ...) ...)
42   (list (list list-contents ...) ...))
43
44 \f
45 ;;; Some simple object types.
46 ;;; =========================
47
48 (define-class <readable> (<gameobj>)
49   (read-text #:init-value "All it says is: \"Blah blah blah.\""
50              #:init-keyword #:read-text)
51   (commands
52    #:allocation #:each-subclass
53    #:init-thunk (build-commands
54                  ("read" ((direct-command cmd-read)))))
55   (actions #:allocation #:each-subclass
56            #:init-thunk (build-actions
57                          (cmd-read readable-cmd-read))))
58
59 (define (readable-cmd-read actor message . _)
60   (<- (message-from message) 'tell
61       #:text (slot-ref actor 'read-text)))
62
63
64 ;; This one is just where reading is the same thing as looking
65 ;; at the description
66 (define-class <readable-desc> (<gameobj>)
67   (commands
68    #:allocation #:each-subclass
69    #:init-thunk (build-commands
70                  ("read" ((direct-command cmd-look-at))))))
71
72 ;; This one allows you to take from items that are proxied by it
73 (define-actor <proxy-items> (<gameobj>)
74   ((cmd-take-from take-from-proxy))
75   (proxy-items #:init-keyword #:proxy-items))
76
77 (define* (take-from-proxy gameobj message
78                           #:key direct-obj indir-obj preposition
79                           (player (message-from message)))
80   (call/ec
81    (lambda (escape)
82      (for-each
83       (lambda (obj-sym)
84         (define obj-id (dyn-ref gameobj obj-sym))
85         (define goes-by
86           (mbody-val (<-wait obj-id 'goes-by)))
87         (when (ci-member direct-obj goes-by)
88           (<- obj-id 'cmd-take #:direct-obj direct-obj #:player player)
89           (escape #f)))
90       (slot-ref gameobj 'proxy-items))
91
92      (<- player 'tell
93         #:text `("You don't see any such " ,direct-obj " to take "
94                  ,preposition " " ,(slot-ref gameobj 'name) ".")))))
95
96
97 \f
98 ;;; Lobby
99 ;;; -----
100
101 (define (npc-chat-randomly actor message . _)
102   (define catchphrase
103     (random-choice (slot-ref actor 'catchphrases)))
104   (define text-to-send
105     ((slot-ref actor 'chat-format) actor catchphrase))
106   (<- (message-from message) 'tell
107       #:text text-to-send))
108
109 (define hotel-owner-grumps
110   '("Eight sinks!  Eight sinks!  And I couldn't unwind them..."
111     "Don't mind the mess.  I built this place on a dare, you
112 know?"
113     "(*tearfully*) Here, take this parenthesis.  May it serve
114 you well."
115     "I gotta get back to the goblin farm soon..."
116     "Oh, but I was going to make a mansion... a great,
117 beautiful mansion!  Full of ghosts!  Now all I have is this cruddy
118 mo... hotel.  Oh... If only I had more time!"
119     "I told them to paint more of the walls purple.
120 Why didn't they listen?"
121     "Listen to that overhead muzak.  Whoever made that doesn't
122 know how to compose very well!  Have you heard of the bands 'fmt'
123 or 'skribe'?  Now *that's* composition!"))
124
125 (define-class <chatty-npc> (<gameobj>)
126   (catchphrases #:init-value '("Blarga blarga blarga!")
127                 #:init-keyword #:catchphrases)
128   (chat-format #:init-value (lambda (npc catchphrase)
129                               `(,(slot-ref npc 'name) " says: \""
130                                 ,catchphrase "\""))
131                #:init-keyword #:chat-format)
132   (commands
133    #:allocation #:each-subclass
134    #:init-thunk (build-commands
135                  (("chat" "talk") ((direct-command cmd-chat)))))
136   (actions #:allocation #:each-subclass
137            #:init-thunk
138            (build-actions
139             (cmd-chat npc-chat-randomly))))
140
141 (define-class <sign-in-form> (<gameobj>)
142   (commands
143    #:allocation #:each-subclass
144    #:init-thunk (build-commands
145                  ("sign" ((prep-direct-command cmd-sign-form '("as"))))))
146
147   (actions #:allocation #:each-subclass
148            #:init-thunk (build-actions
149                          (cmd-sign-form sign-cmd-sign-in))))
150
151
152 (define name-sre
153   (sre->irregex '(: alpha (** 1 14 (or alphanum "-" "_")))))
154
155 (define forbidden-words
156   (append article preposition
157           '("and" "or" "but" "admin")))
158
159 (define (valid-name? name)
160   (and (irregex-match name-sre name)
161        (not (member name forbidden-words))))
162
163 (define* (sign-cmd-sign-in actor message
164                            #:key direct-obj indir-obj preposition)
165   (define old-name
166     (mbody-val (<-wait (message-from message) 'get-name)))
167   (define name indir-obj)
168   (if (valid-name? indir-obj)
169       (begin
170         (<-wait (message-from message) 'set-name! name)
171         (<- (slot-ref actor 'loc) 'tell-room
172             #:text (format #f "~a signs the form!\n~a is now known as ~a\n"
173                            old-name old-name name)))
174       (<- (message-from message) 'tell
175           #:text "Sorry, that's not a valid name.
176 Alphanumerics, _ and - only, 2-15 characters, starts with an alphabetic
177 character.\n")))
178
179
180 (define-class <summoning-bell> (<gameobj>)
181   (summons #:init-keyword #:summons)
182
183   (commands
184    #:allocation #:each-subclass
185    #:init-thunk (build-commands
186                  ("ring" ((direct-command cmd-ring)))))
187   (actions #:allocation #:each-subclass
188            #:init-thunk (build-actions
189                          (cmd-ring summoning-bell-cmd-ring))))
190
191 (define* (summoning-bell-cmd-ring bell message . _)
192   ;; Call back to actor who invoked this message handler
193   ;; and find out their name.  We'll call *their* get-name message
194   ;; handler... meanwhile, this procedure suspends until we get
195   ;; their response.
196   (define who-rang
197     (mbody-val (<-wait (message-from message) 'get-name)))
198
199   ;; Now we'll invoke the "tell" message handler on the player
200   ;; who rang us, displaying this text on their screen.
201   ;; This one just uses <- instead of <-wait, since we don't
202   ;; care when it's delivered; we're not following up on it.
203   (<- (message-from message) 'tell
204       #:text "*ring ring!*  You ring the bell!\n")
205   ;; We also want everyone else in the room to "hear" the bell,
206   ;; but they get a different message since they aren't the ones
207   ;; ringing it.  Notice here's where we make use of the invoker's
208   ;; name as extracted and assigned to the who-rang variable.
209   ;; Notice how we send this message to our "location", which
210   ;; forwards it to the rest of the occupants in the room.
211   (<- (gameobj-loc bell) 'tell-room
212       #:text
213       (format #f "*ring ring!*  ~a rings the bell!\n"
214               who-rang)
215       #:exclude (message-from message))
216   ;; Now we perform the primary task of the bell, which is to summon
217   ;; the "clerk" character to the room.  (This is configurable,
218   ;; so we dynamically look up their address.)
219   (<- (dyn-ref bell (slot-ref bell 'summons)) 'be-summoned
220       #:who-summoned (message-from message)))
221
222
223 (define prefect-quotes
224   '("I'm a frood who really knows where my towel is!"
225     "On no account allow a Vogon to read poetry at you."
226     "Time is an illusion, lunchtime doubly so!"
227     "How can you have money if none of you produces anything?"
228     "On no account allow Arthur to request tea on this ship."))
229
230 (define-class <cabinet-item> (<gameobj>)
231   (take-me? #:init-value
232             (lambda _
233               (values #f #:why-not
234                       `("Hm, well... the cabinet is locked and the properitor "
235                         "is right over there.")))))
236
237 (define lobby
238   (lol
239    ('lobby
240     <room> #f
241     #:name "Hotel Lobby"
242     #:desc
243     '((p "You're in some sort of hotel lobby.  You see a large sign hanging "
244          "over the desk that says \"Hotel Bricabrac\".  On the desk is a bell "
245          "that says \"'ring bell' for service\".  Terrible music plays from a speaker "
246          "somewhere overhead.  "
247          "The room is lined with various curio cabinets, filled with all sorts "
248          "of kitschy junk.  It looks like whoever decorated this place had great "
249          "ambitions, but actually assembled it all in a hurry and used whatever "
250          "kind of objects they found lying around.")
251       (p "There's a door to the north leading to some kind of hallway."))
252     #:exits
253     (list (make <exit>
254             #:name "north"
255             #:to 'grand-hallway)))
256    ;; NPC: hotel owner
257    ('lobby:hotel-owner
258     <chatty-npc> 'lobby
259     #:name "a languid lady"
260     #:desc
261     '((p "  Whoever this is, she looks totally exhausted.  She's
262 collapsed into the only comfortable looking chair in the room and you
263 don't get the sense that she's likely to move any time soon.
264   Attached to her frumpy dress is a barely secured pin which says
265 \"Hotel Proprietor\", but she looks so disorganized that you think
266 that can't possibly be true... can it?")
267       (p "Despite her exhaustion, you sense she'd be happy to chat
268 with you, though the conversation may be a bit one sided."))
269
270     #:goes-by '("languid lady" "lady"
271                 "hotel proprietor" "proprietor")
272     #:catchphrases hotel-owner-grumps)
273    ;; Object: Sign
274    ('lobby:sign
275     <readable> 'lobby
276     #:name "the Hotel Bricabrac sign"
277     #:desc "  It strikes you that there's something funny going on with this sign.
278 Sure enough, if you look at it hard enough, you can tell that someone
279 hastily painted over an existing sign and changed the \"M\" to an \"H\".
280 Classy!"
281     #:read-text "  All it says is \"Hotel Bricabrac\" in smudged, hasty text."
282     #:goes-by '("sign"
283                 "bricabrac sign"
284                 "hotel sign"
285                 "hotel bricabrac sign"
286                 "lobby sign"))
287
288    ('lobby:bell
289     <summoning-bell> 'lobby
290     #:name "a shiny brass bell"
291     #:goes-by '("shiny brass bell" "shiny bell" "brass bell" "bell")
292     #:desc "  A shiny brass bell.  Inscribed on its wooden base is the text
293 \"ring me for service\".  You probably could \"ring the bell\" if you 
294 wanted to."
295     #:summons 'break-room:desk-clerk)
296
297    ('lobby:sign-in-form
298     <sign-in-form> 'lobby
299     #:name "sign-in form"
300     #:goes-by '("sign-in form" "form" "signin form")
301     #:desc '("It looks like you could sign this form and set your name like so: "
302              (i "sign form as <my-name-here>")))
303
304    ;; Object: curio cabinets
305    ;; TODO: respond to attempts to open the curio cabinet
306    ('lobby:cabinet
307     <proxy-items> 'lobby
308     #:proxy-items '(lobby:porcelain-doll
309                     lobby:1950s-robots
310                     lobby:tea-set lobby:mustard-pot
311                     lobby:head-of-elvis lobby:circuitboard-of-evlis
312                     lobby:teletype-scroll lobby:orange-cat-phone)
313     #:name "a curio cabinet"
314     #:goes-by '("curio cabinet" "cabinet" "bricabrac cabinet"
315                 "cabinet of curiosities")
316     #:desc (lambda _
317              (format #f "  The curio cabinet is full of all sorts of oddities!
318 Something catches your eye!
319 Ooh, ~a!" (random-choice
320            '("a creepy porcelain doll"
321              "assorted 1950s robots"
322              "an exquisite tea set"
323              "an antique mustard pot"
324              "the pickled head of Elvis"
325              "the pickled circuitboard of EVLIS"
326              "a scroll of teletype paper holding the software Four Freedoms"
327              "a telephone shaped like an orange cartoon cat")))))
328
329    ('lobby:porcelain-doll
330     <cabinet-item> 'lobby
331     #:invisible? #t
332     #:name "a creepy porcelain doll"
333     #:desc "It strikes you that while the doll is technically well crafted,
334 it's also the stuff of nightmares."
335     #:goes-by '("porcelain doll" "doll"))
336    ('lobby:1950s-robots
337     <cabinet-item> 'lobby
338     #:invisible? #t
339     #:name "a set of 1950s robots"
340     #:desc "There's a whole set of these 1950s style robots.
341 They seem to be stamped out of tin, and have various decorations of levers
342 and buttons and springs.  Some of them have wind-up knobs on them."
343     #:goes-by '("robot" "robots" "1950s robot" "1950s robots"))
344    ('lobby:tea-set
345     <cabinet-item> 'lobby
346     #:invisible? #t
347     #:name "a tea set"
348     #:desc "A complete tea set.  Some of the cups are chipped.
349 You can imagine yourself joining a tea party using this set, around a
350 nice table with some doilies, drinking some Earl Grey tea, hot.  Mmmm."
351     #:goes-by '("tea set" "tea"))
352    ('lobby:cups
353     <cabinet-item> 'lobby
354     #:invisible? #t
355     #:name "cups from the tea set"
356     #:desc "They're chipped."
357     #:goes-by '("cups"))
358    ('lobby:mustard-pot
359     <cabinet-item> 'lobby
360     #:invisible? #t
361     #:name "a mustard pot"
362     #:desc '((p "It's a mustard pot.  I mean, it's kind of cool, it has a
363 nice design, and it's an antique, but you can't imagine putting something
364 like this in a museum.")
365              (p "Ha... imagine that... a mustard museum."))
366     #:goes-by '("mustard pot" "antique mustard pot" "mustard"))
367    ('lobby:head-of-elvis
368     <cabinet-item> 'lobby
369     #:invisible? #t
370     #:name "the pickled head of Elvis"
371     #:desc '((p "It's a jar full of some briny-looking liquid and...
372 a free floating head.  The head looks an awful lot like Elvis, and
373 definitely not the younger Elvis.  The hair even somehow maintains
374 that signature swoop while suspended in liquid.  But of course it's
375 not Elvis.")
376              (p "Oh, wait, it has a label at the bottom which says:
377 \"This is really the head of Elvis\".  Well... maybe don't believe
378 everything you read."))
379     #:goes-by '("pickled head of elvis" "pickled head of Elvis"
380                 "elvis" "Elvis" "head" "pickled head"))
381    ('lobby:circuitboard-of-evlis
382     <cabinet-item> 'lobby
383     #:invisible? #t
384     #:name "the pickled circuitboard of Evlis"
385     #:desc '((p "It's a circuitboard from a Lisp Machine called EVLIS.
386 This is quite the find, and you bet just about anyone interested in
387 preserving computer history would love to get their hands on this.")
388              (p "Unfortunately, whatever moron did acquire this has
389 no idea what it means to preserve computers, so here it is floating
390 in some kind of briny liquid.  It appears to be heavily corroded.
391 Too bad..."))
392     #:goes-by '("pickled circuitboard of evlis" "pickled circuitboard of Evlis"
393                 "pickled circuitboard of EVLIS"
394                 "evlis" "Evlis" "EVLIS" "circuitboard" "pickled circuitboard"))
395    ('lobby:teletype-scroll
396     <cabinet-item> 'lobby
397     #:invisible? #t
398     #:name "a scroll of teletype"
399     #:desc '((p "This is a scroll of teletype paper.  It's a bit old
400 and yellowed but the type is very legible.  It says:")
401              (br)
402              (i
403               (p (strong "== The four essential freedoms =="))
404               (p "A program is free software if the program's users have
405 the four essential freedoms: ")
406               (ul (li "The freedom to run the program as you wish, for any purpose (freedom 0).")
407                   (li "The freedom to study how the program works, and change it so it does your computing as you wish (freedom 1). Access to the source code is a precondition for this.")
408                   (li "The freedom to redistribute copies so you can help your neighbor (freedom 2).")
409                   (li "The freedom to distribute copies of your modified versions to others (freedom 3). By doing this you can give the whole community a chance to benefit from your changes. Access to the source code is a precondition for this.")))
410              (p "You get this feeling that ambiguities in the
411 English language surrounding the word 'free' have lead to a lot of terminology debates."))
412     #:goes-by '("scroll of teletype" "scroll of teletype paper" "teletype scroll"
413                 "teletype paper" "scroll" "four freedoms"
414                 "paper"
415                 "scroll of teletype paper holding the software Four Freedoms"
416                 "scroll of teletype paper holding the software four freedoms"))
417    ('lobby:orange-cat-phone
418     <cabinet-item> 'lobby
419     #:invisible? #t
420     #:name "a telephone shaped like an orange cartoon cat"
421     #:desc "It's made out of a cheap plastic, and it's very orange.
422 It resembles a striped tabby, and it's eyes hold the emotion of
423 a being both sleepy and smarmy.
424 You suspect that someone, somewhere made a ton of cash on items holding
425 this general shape in the 1990s."
426     #:goes-by '("orange cartoon cat phone" "orange cartoon cat telephone"
427                 "orange cat phone" "orange cat telephone"
428                 "cartoon cat phone" "cartoon cat"
429                 "cat phone" "cat telephone" "phone" "telephone"))
430    ('lobby:monster-stuffie
431     <gameobj> 'lobby
432     #:name "an off-brand monster stuffie"
433     #:desc "It's an off brand monster stuffed animal that looks, well kinda
434 like a popular character you've seen in a video game, but there's been a very
435 thin attempt to make it look like something different... mostly by changing
436 the shape of the ears.  It's cute though!"
437     #:take-me? #t
438     #:goes-by '("monster stuffie" "monster" "stuffed animal" "stuffed monster"
439                 "off-brand monster stuffie" "stuffie" "monster stuffie"))))
440
441
442 \f
443 ;;; Grand hallway
444 ;;; -------------
445
446 (define-actor <disc-shield> (<gameobj>)
447   ((cmd-take disc-shield-take)))
448
449 (define* (disc-shield-take gameobj message
450                            #:key direct-obj
451                            (player (message-from message)))
452   (create-gameobj <glowing-disc> (gameobj-gm gameobj)
453                   player)  ;; set loc to player to put in player's inventory
454   (<- player 'tell
455       #:text '((p "As you attempt to pull the shield / disk platter
456 from the statue a shining outline appears around it... and a
457 completely separate, glowing copy of the disc materializes into your
458 hands!")))
459   (<- (gameobj-loc gameobj) 'tell-room
460         #:text `(,(mbody-val (<-wait player 'get-name))
461                  " pulls on the shield of the statue, and a glowing "
462                  "copy of it materializes into their hands!")
463         #:exclude player)
464   (<- (gameobj-loc gameobj) 'tell-room
465       #:text
466       '(p "You hear a voice whisper: "
467           (i "\"Share the software... and you'll be free...\""))))
468
469 ;;; This is the disc that gets put in the player's inventory
470 (define-actor <glowing-disc> (<gameobj>)
471   ((cmd-drop glowing-disc-drop-cmd))
472   (initial-props
473    #:allocation #:each-subclass
474    #:init-thunk (build-props
475                  '((hd-platter? . #t))))
476   (take-me? #:allocation #:each-subclass
477             #:init-value #t)
478   (name #:allocation #:each-subclass
479         #:init-value "a glowing disc")
480   (desc #:allocation #:each-subclass
481         #:init-value "A brightly glowing disc.  It's shaped like a hard
482 drive platter, not unlike the one from the statue it came from.  It's
483 labeled \"RL02.5\".")
484   (goes-by #:init-value '("glowing disc" "glowing platter"
485                           "glowing disc platter" "glowing disk platter"
486                           "platter" "disc" "disk" "glowing shield")))
487
488 (define* (glowing-disc-drop-cmd gameobj message
489                    #:key direct-obj
490                    (player (message-from message)))
491   (<- player 'tell
492       #:text "You drop the glowing disc, and it shatters into a million pieces!")
493   (<- (mbody-val (<-wait player 'get-loc)) 'tell-room
494       #:text `(,(mbody-val (<-wait player 'get-name))
495                " drops a glowing disc, and it shatters into a million pieces!")
496       #:exclude player)
497   (gameobj-self-destruct gameobj))
498
499 \f
500 ;;; Grand hallway
501
502 (define lobby-map-text
503   "\
504
505                         .----+++++----.
506                         |  :       :  |
507                         +  : north :  +
508                         |  :  hall :  |
509                         +  :       :  +
510                         |_ : _____ : _|
511                         |  :       :  |
512   .----------.----------.  :   &   :  .----------.----------.
513   | computer |          |& :YOU ARE: &|  smoking | *UNDER*  |
514   | room     + playroom +  : HERE  :  +  parlor  | *CONS-   |
515   |    >     |          |& :       : &|          | TRUCTION*|
516   '----------'----------'-++-------++-'-------+--'----------'
517                        |    '-----'    |     |   |
518                        :     LOBBY     :     '---'
519                         '.           .'
520                           '---------'")
521
522 (define grand-hallway
523
524   (lol
525    ('grand-hallway
526     <room> #f
527     #:name "Grand Hallway"
528     #:desc '((p "  A majestic red carpet runs down the center of the room.
529 Busts of serious looking people line the walls, but there's no
530 clear indication that they have any logical relation to this place.")
531              (p "In the center is a large statue of a woman in a warrior's
532 pose, but something is strange about her weapon and shield.  You wonder what
533 that's all about?")
534              (p "To the south is the lobby.  A door to the east is labeled \"smoking
535 room\", while a door to the west is labeled \"playroom\"."))
536     #:exits
537     (list (make <exit>
538             #:name "north"
539             #:to 'north-hall)
540           (make <exit>
541             #:name "south"
542             #:to 'lobby)
543           (make <exit>
544             #:name "west"
545             #:to 'playroom)
546           (make <exit>
547             #:name "east"
548             #:to 'smoking-parlor)))
549    ('grand-hallway:map
550     <readable> 'grand-hallway
551     #:name "the hotel map"
552     #:desc '("This appears to be a map of the hotel. "
553              "Like the hotel itself, it seems to be "
554              "incomplete."
555              "You could read it if you want to.")
556     #:read-text `(pre ,lobby-map-text)
557     #:goes-by '("map" "hotel map"))
558    ('grand-hallway:carpet
559     <gameobj> 'grand-hallway
560     #:name "the Grand Hallway carpet"
561     #:desc "It's very red, except in the places where it's very worn."
562     #:invisible? #t
563     #:goes-by '("red carpet" "carpet"))
564    ('grand-hallway:busts
565     <gameobj> 'grand-hallway
566     #:name "the busts of serious people"
567     #:desc "There are about 6 of them in total.  They look distinguished
568 but there's no indication of who they are."
569     #:invisible? #t
570     #:goes-by '("busts" "bust" "busts of serious people" "bust of serious person"))
571    ('grand-hallway:hackthena-statue
572     <proxy-items> 'grand-hallway
573     #:name "the statue of Hackthena"
574     #:desc '((p "The base of the statue says \"Hackthena, guardian of the hacker
575 spirit\".  You've heard of Hackthena... not a goddess, but spiritual protector of
576 all good hacks, and legendary hacker herself.")
577              (p "Hackthena holds the form of a human woman.  She wears flowing
578 robes, has a pair of curly bovine-esque horns protruding from the sides of her
579 head, wears a pair of horn-rimmed glasses, and appears posed as if for battle.
580 But instead of a weapon, she seems to hold some sort of keyboard.  And her
581 shield... well it's round like a shield, but something seems off about it.
582 You'd better take a closer look to be sure."))
583     #:goes-by '("hackthena statue" "hackthena" "statue" "statue of hackthena")
584     #:proxy-items '(grand-hallway:keyboard
585                     grand-hallway:disc-platter
586                     grand-hallway:hackthena-horns))
587    ('grand-hallway:keyboard
588     <gameobj> 'grand-hallway
589     #:name "a Knight Keyboard"
590     #:desc "Whoa, this isn't just any old keyboard, this is a Knight Keyboard!
591 Any space cadet can see that with that kind of layout a hack-and-slayer could
592 thrash out some serious key-chords like there's no tomorrow.  You guess
593 Hackthena must be an emacs user."
594     #:invisible? #t
595     #:take-me? (lambda _
596                  (values #f
597                          #:why-not
598                          `("Are you kidding?  Do you know how hard it is to find "
599                               "a Knight Keyboard?  There's no way she's going "
600                               "to give that up.")))
601     #:goes-by '("knight keyboard" "keyboard"))
602    ('grand-hallway:hackthena-horns
603     <gameobj> 'grand-hallway
604     #:name "Hackthena's horns"
605     #:desc "They're not unlike a Gnu's horns."
606     #:invisible? #t
607     #:take-me? (lambda _
608                  (values #f
609                          #:why-not
610                          `("Are you seriously considering desecrating a statue?")))
611     #:goes-by '("hackthena's horns" "horns" "horns of hacktena"))
612    ('grand-hallway:disc-platter
613     <disc-shield> 'grand-hallway
614     #:name "Hackthena's shield"
615     #:desc "No wonder the \"shield\" looks unusual... it seems to be a hard disk
616 platter!  It has \"RL02.5\" written on it.  It looks kind of loose."
617     #:invisible? #t
618     #:goes-by '("hackthena's shield" "shield" "platter" "hard disk platter"))))
619
620 \f
621 ;;; Playroom
622 ;;; --------
623
624 (define-actor <rgb-machine> (<gameobj>)
625   ((cmd-run rgb-machine-cmd-run)
626    (cmd-reset rgb-machine-cmd-reset))
627   (commands
628    #:allocation #:each-subclass
629    #:init-thunk (build-commands
630                  (("run" "start") ((direct-command cmd-run)))
631                  ("reset" ((direct-command cmd-reset)))))
632   (resetting #:init-value #f
633              #:accessor .resetting)
634   ;; used to reset, and to kick off the first item in the list
635   (rgb-items #:init-keyword #:rgb-items
636              #:accessor .rgb-items))
637
638 (define (rgb-machine-cmd-run rgb-machine message . _)
639   (define player (message-from message))
640   (<-wait player 'tell
641           #:text '("You start the rube goldberg machine."))
642   (<-wait (gameobj-loc rgb-machine) 'tell-room
643           #:text `(,(mbody-val (<-wait player 'get-name))
644                    " runs the rube goldberg machine.")
645           #:exclude player)
646   (8sleep 1)
647   (match (.rgb-items rgb-machine)
648     ((first-item rest ...)
649      (<- (dyn-ref rgb-machine first-item) 'trigger))))
650
651 (define (rgb-machine-cmd-reset rgb-machine message . _)
652   (define player (message-from message))
653   (cond
654    ((not (.resetting rgb-machine))
655     (set! (.resetting rgb-machine) #t)
656     (<-wait player 'tell
657             #:text '("You reset the rube goldberg machine."))
658     (<-wait (gameobj-loc rgb-machine) 'tell-room
659             #:text `(,(mbody-val (<-wait player 'get-name))
660                      " resets the rube goldberg machine.")
661             #:exclude player)
662     (<-wait (gameobj-loc rgb-machine) 'tell-room
663             #:text '("From a panel in the wall, a white gloved mechanical "
664                      "arm reaches out to reset all the "
665                      "rube goldberg components."))
666     (8sleep (/ 1 2))
667     (for-each
668      (lambda (rgb-item)
669        (<- (dyn-ref rgb-machine rgb-item) 'reset)
670        (8sleep (/ 1 2)))
671      (.rgb-items rgb-machine))
672     (<- (gameobj-loc rgb-machine) 'tell-room
673         #:text "The machine's mechanical arm retreats into the wall!")
674     (set! (.resetting rgb-machine) #f))
675    (else
676     (<-wait player 'tell
677             #:text '("But it's in the middle of resetting right now!")))))
678
679 (define-actor <rgb-item> (<gameobj>)
680   ((trigger rgb-item-trigger)
681    (reset rgb-item-reset))
682   (invisible? #:init-value #t)
683   (steps #:init-keyword #:steps
684          #:accessor .steps)
685   (triggers-as #:init-value #f
686                #:init-keyword #:triggers-as
687                #:getter .triggers-as)
688   (reset-msg #:init-keyword #:reset-msg
689              #:getter .reset-msg)
690   ;; States: ready -> running -> ran
691   (state #:init-value 'ready
692          #:accessor .state))
693
694
695 (define (rgb-item-trigger rgb-item message . _)
696   (define room (gameobj-loc rgb-item))
697   (case (.state rgb-item)
698     ((ready)
699      ;; Set state to running
700      (set! (.state rgb-item) 'running)
701
702      ;; Loop through all steps
703      (for-each
704       (lambda (step)
705         (match step
706           ;; A string?  That's the description of what's happening, tell players
707           ((? string? str)
708            (<- room 'tell-room #:text str))
709           ;; A number?  Sleep for that many secs
710           ((? number? num)
711            (8sleep num))
712           ;; A symbol?  That's another gameobj to look up dynamically
713           ((? symbol? sym)
714            (<- (dyn-ref rgb-item sym) 'trigger
715                #:triggered-by (.triggers-as rgb-item)))
716           (_ (throw 'unknown-step-type
717                     "Don't know how to process rube goldberg machine step type?"
718                     #:step step))))
719       (.steps rgb-item))
720
721      ;; We're done! Set state to ran
722      (set! (.state rgb-item) 'ran))
723
724     (else
725      (<- room 'tell-room
726          #:text `("... but " ,(slot-ref rgb-item 'name)
727                   " has already been triggered!")))))
728
729 (define (rgb-item-reset rgb-item message . _)
730   (define room (gameobj-loc rgb-item))
731   (case (.state rgb-item)
732     ((ran)
733      (set! (.state rgb-item) 'ready)
734      (<- room 'tell-room
735          #:text (.reset-msg rgb-item)))
736     ((running)
737      (<- room 'tell-room
738          #:text `("... but " ,(slot-ref rgb-item 'name)
739                   " is currently running!")))
740     ((ready)
741      (<- room 'tell-room
742          #:text `("... but " ,(slot-ref rgb-item 'name)
743                   " has already been reset.")))))
744
745 (define-actor <rgb-kettle> (<rgb-item>)
746   ((trigger rgb-kettle-trigger)
747    (reset rgb-kettle-reset))
748   (heated #:accessor .heated
749           #:init-value #f)
750   (filled #:accessor .filled
751           #:init-value #f))
752
753 (define* (rgb-kettle-trigger rgb-item message #:key triggered-by)
754   (define room (gameobj-loc rgb-item))
755   (if (not (eq? (.state rgb-item) 'ran))
756       (begin
757         (match triggered-by
758           ('water-demon
759            (set! (.state rgb-item) 'running)
760            (set! (.filled rgb-item) #t))
761           ('quik-heater
762            (set! (.state rgb-item) 'running)
763            (set! (.heated rgb-item) #t)))
764         (when (and (.filled rgb-item)
765                    (.heated rgb-item))
766           (<- room 'tell-room
767               #:text '((i "*kshhhhhh!*")
768                        " The water has boiled!"))
769           (8sleep .25)
770           (set! (.state rgb-item) 'ran)
771           ;; insert a cup of hot tea in the room
772           (create-gameobj <hot-tea> (gameobj-gm rgb-item) room)
773           (<- room 'tell-room
774               #:text '("The machine pours out a cup of hot tea! "
775                        "Looks like the machine finished!"))))
776       (<- room 'tell-room
777          #:text `("... but " ,(slot-ref rgb-item 'name)
778                   " has already been triggered!"))))
779
780 (define (rgb-kettle-reset rgb-item message . rest-args)
781   (define room (gameobj-loc rgb-item))
782   (when (eq? (.state rgb-item) 'ran)
783     (set! (.heated rgb-item) #f)
784     (set! (.filled rgb-item) #f))
785   (apply rgb-item-reset rgb-item message rest-args))
786
787 (define-actor <tinfoil-hat> (<gameobj>)
788   ((cmd-wear tinfoil-hat-wear))
789   (contained-commands
790    #:allocation #:each-subclass
791    #:init-thunk (build-commands
792                  ("wear" ((direct-command cmd-wear))))))
793
794 (define (tinfoil-hat-wear tinfoil-hat message . _)
795   (<- (message-from message) 'tell
796       #:text '("You put on the tinfoil hat, and, to be perfectly honest with you "
797                "it's a lot harder to take you seriously.")))
798
799
800 (define-actor <hot-tea> (<gameobj>)
801   ((cmd-drink hot-tea-cmd-drink)
802    (cmd-sip hot-tea-cmd-sip))
803   (contained-commands
804    #:allocation #:each-subclass
805    #:init-thunk (build-commands
806                  ("drink" ((direct-command cmd-drink)))
807                  ("sip" ((direct-command cmd-sip)))))
808   
809   (sips-left #:init-value 4
810              #:accessor .sips-left)
811   (name #:init-value "a cup of hot tea")
812   (take-me? #:init-value #t)
813   (goes-by #:init-value '("cup of hot tea" "cup of tea" "tea" "cup"))
814   (desc #:init-value "It's a steaming cup of hot tea.  It looks pretty good!"))
815
816 (define (hot-tea-cmd-drink hot-tea message . _)
817   (define player (message-from message))
818   (define player-loc (mbody-val (<-wait player 'get-loc)))
819   (define player-name (mbody-val (<-wait player 'get-name)))
820   (<- player 'tell
821       #:text "You drink a steaming cup of hot tea all at once... hot hot hot!")
822   (<- player-loc 'tell-room
823       #:text `(,player-name
824                " drinks a steaming cup of hot tea all at once.")
825       #:exclude player)
826   (gameobj-self-destruct hot-tea))
827
828 (define (hot-tea-cmd-sip hot-tea message . _)
829   (define player (message-from message))
830   (define player-loc (mbody-val (<-wait player 'get-loc)))
831   (define player-name (mbody-val (<-wait player 'get-name)))
832   (set! (.sips-left hot-tea) (- (.sips-left hot-tea) 1))
833   (<- player 'tell
834       #:text "You take a sip of your steaming hot tea.  How refined!")
835   (<- player-loc 'tell-room
836       #:text `(,player-name
837                " takes a sip of their steaming hot tea.  How refined!")
838       #:exclude player)
839   (when (= (.sips-left hot-tea) 0)
840     (<- player 'tell
841         #:text "You've finished your tea!")
842     (<- player-loc 'tell-room
843         #:text `(,player-name
844                  " finishes their tea!")
845         #:exclude player)
846     (gameobj-self-destruct hot-tea)))
847
848 (define-actor <fanny-pack> (<container>)
849   ((cmd-take-from-while-wearing cmd-take-from)
850    (cmd-put-in-while-wearing cmd-put-in))
851   (contained-commands
852    #:allocation #:each-subclass
853    #:init-thunk
854    (build-commands
855     (("l" "look") ((direct-command cmd-look-at)))
856     ("take" ((prep-indir-command cmd-take-from-while-wearing
857                                  '("from" "out of"))))
858     ("put" ((prep-indir-command cmd-put-in-while-wearing
859                                 '("in" "inside" "into" "on")))))))
860
861 (define playroom
862   (lol
863    ('playroom
864     <room> #f
865     #:name "The Playroom"
866     #:desc '(p ("  There are toys scattered everywhere here.  It's really unclear
867 if this room is intended for children or child-like adults.")
868                ("  There are doors to both the east and the west."))
869     #:exits
870     (list (make <exit>
871             #:name "east"
872             #:to 'grand-hallway)
873           (make <exit>
874             #:name "west"
875             #:to 'computer-room)))
876    ('playroom:cubey
877     <gameobj> 'playroom
878     #:name "Cubey"
879     #:take-me? #t
880     #:desc "  It's a little foam cube with googly eyes on it.  So cute!")
881    ('playroom:cuddles-plushie
882     <gameobj> 'playroom
883     #:name "a Cuddles plushie"
884     #:goes-by '("plushie" "cuddles plushie" "cuddles")
885     #:take-me? #t
886     #:desc "  A warm and fuzzy cuddles plushie!  It's a cuddlefish!")
887
888    ('playroom:toy-chest
889     <container> 'playroom
890     #:name "a toy chest"
891     #:goes-by '("toy chest" "chest")
892     #:desc (lambda (toy-chest whos-looking)
893              (let ((contents (gameobj-occupants toy-chest)))
894                `((p "A brightly painted wooden chest.  The word \"TOYS\" is "
895                     "engraved on it.")
896                  (p "Inside you see:"
897                     ,(if (eq? contents '())
898                          " nothing!  It's empty!"
899                          `(ul ,(map (lambda (occupant)
900                                       `(li ,(mbody-val
901                                              (<-wait occupant 'get-name))))
902                                     (gameobj-occupants toy-chest))))))))
903     #:take-from-me? #t
904     #:put-in-me? #t)
905
906    ;; Things inside the toy chest
907    ('playroom:toy-chest:rubber-duck
908     <gameobj> 'playroom:toy-chest
909     #:name "a rubber duck"
910     #:goes-by '("rubber duck" "duck")
911     #:take-me? #t
912     #:desc "It's a yellow rubber duck with a bright orange beak.")
913
914    ('playroom:toy-chest:tinfoil-hat
915     <tinfoil-hat> 'playroom:toy-chest
916     #:name "a tinfoil hat"
917     #:goes-by '("tinfoil hat" "hat")
918     #:take-me? #t
919     #:desc "You'd have to be a crazy person to wear this thing!")
920
921    ('playroom:toy-chest:fanny-pack
922     <fanny-pack> 'playroom:toy-chest
923     #:name "a fanny pack"
924     #:goes-by '("fanny pack" "pack")
925     #:take-me? #t
926     #:desc
927     (lambda (toy-chest whos-looking)
928       (let ((contents (gameobj-occupants toy-chest)))
929         `((p "It's a leather fanny pack, so it's both tacky and kinda cool.")
930           (p "Inside you see:"
931              ,(if (eq? contents '())
932                   " nothing!  It's empty!"
933                   `(ul ,(map (lambda (occupant)
934                                `(li ,(mbody-val
935                                       (<-wait occupant 'get-name))))
936                              (gameobj-occupants toy-chest)))))))))
937
938    ;; Things inside the toy chest
939    ('playroom:toy-chest:fanny-pack:plastic-elephant
940     <gameobj> 'playroom:toy-chest:fanny-pack
941     #:name "a plastic elephant"
942     #:goes-by '("plastic elephant" "elephant")
943     #:take-me? #t
944     #:desc "It's a tiny little plastic elephant.  Small, but heartwarming.")
945
946    ('playroom:rgb-machine
947     <rgb-machine> 'playroom
948     #:name "a Rube Goldberg machine"
949     #:goes-by '("rube goldberg machine" "machine")
950     #:rgb-items '(playroom:rgb-dominoes
951                   playroom:rgb-switch-match
952                   playroom:rgb-candle
953                   playroom:rgb-catapult
954                   playroom:rgb-water-demon
955                   playroom:rgb-quik-heater
956                   playroom:rgb-kettle)
957     #:desc "It's one of those hilarious Rube Goldberg machines.
958 What could happen if you started it?")
959
960    ;; Dominoes topple
961    ('playroom:rgb-dominoes
962     <rgb-item> 'playroom
963     #:name "some dominoes"
964     #:goes-by '("dominoes" "some dominoes")
965     #:steps `("The dominoes topple down the line..."
966               1
967               "The last domino lands on a switch!"
968               1.5
969               playroom:rgb-switch-match)
970     #:reset-msg "The dominoes are placed back into position.")
971
972    ;; Which hit the switch and strike a match
973    ('playroom:rgb-switch-match
974     <rgb-item> 'playroom
975     #:name "a switch"
976     #:goes-by '("switch" "match")
977     #:steps `("The switch lights a match!"
978               ,(/ 2 3)
979               "The match lights a candle!"
980               1.5
981               playroom:rgb-candle)
982     #:reset-msg "A fresh match is installed and the switch is reset.")
983    ;; which lights a candle and burns a rope
984    ('playroom:rgb-candle
985     <rgb-item> 'playroom
986     #:name "a candle"
987     #:goes-by '("candle")
988     #:steps `("The candle burns..."
989               .3  ; oops!
990               "The candle is burning away a rope!"
991               2
992               "The rope snaps!"
993               .5
994               playroom:rgb-catapult)
995     #:reset-msg "A fresh candle is installed.")
996    ;; which catapults a rock
997    ('playroom:rgb-catapult
998     <rgb-item> 'playroom
999     #:name "a catapult"
1000     #:goes-by '("catapult")
1001     #:steps `("The snapped rope unleashes a catapult, which throws a rock!"
1002               2
1003               "The rock flies through a water demon, startling it!"
1004               .5
1005               playroom:rgb-water-demon
1006               2
1007               "The rock whacks into the quik-heater's on button!"
1008               .5
1009               playroom:rgb-quik-heater)
1010     #:reset-msg
1011     '("A fresh rope is attached to the catapult, which is pulled taught. "
1012       "A fresh rock is placed on the catapult."))
1013    ;; which both:
1014    ;;   '- panics the water demon
1015    ;;      '- which waters the kettle
1016    ('playroom:rgb-water-demon
1017     <rgb-item> 'playroom
1018     #:name "the water demon"
1019     #:triggers-as 'water-demon
1020     #:goes-by '("water demon" "demon")
1021     #:steps `("The water demon panics, and starts leaking water into the kettle below!"
1022               3
1023               "The kettle is filled!"
1024               playroom:rgb-kettle)
1025     #:reset-msg '("The water demon is scratched behind the ears and calms down."))
1026    ;;   '- bops the quik-heater button
1027    ;;      '- which heats the kettle
1028    ('playroom:rgb-quik-heater
1029     <rgb-item> 'playroom
1030     #:name "the quik heater"
1031     #:triggers-as 'quik-heater
1032     #:goes-by '("quik heater" "heater")
1033     #:steps `("The quik-heater heats up the kettle above it!"
1034               3
1035               "The kettle is heated up!"
1036               playroom:rgb-kettle)
1037     #:reset-msg '("The quik heater is turned off."))
1038    ;; Finally, the kettle
1039    ('playroom:rgb-kettle
1040     <rgb-kettle> 'playroom
1041     #:name "the kettle"
1042     #:goes-by '("kettle")
1043     #:reset-msg '("The kettle is emptied."))))
1044
1045
1046 \f
1047 ;;; Writing room
1048 ;;; ------------
1049
1050 \f
1051 ;;; Armory???
1052 ;;; ---------
1053
1054 ;; ... full of NURPH weapons?
1055
1056 \f
1057 ;;; Smoking parlor
1058 ;;; --------------
1059
1060 (define-class <furniture> (<gameobj>)
1061   (sit-phrase #:init-keyword #:sit-phrase)
1062   (sit-phrase-third-person #:init-keyword #:sit-phrase-third-person)
1063   (sit-name #:init-keyword #:sit-name)
1064
1065   (commands
1066    #:allocation #:each-subclass
1067    #:init-thunk (build-commands
1068                  ("sit" ((direct-command cmd-sit-furniture)))))
1069   (actions #:allocation #:each-subclass
1070            #:init-thunk (build-actions
1071                          (cmd-sit-furniture furniture-cmd-sit))))
1072
1073 (define* (furniture-cmd-sit actor message #:key direct-obj)
1074   (define player-name
1075     (mbody-val (<-wait (message-from message) 'get-name)))
1076   (<- (message-from message) 'tell
1077       #:text (format #f "You ~a ~a.\n"
1078                      (slot-ref actor 'sit-phrase)
1079                      (slot-ref actor 'sit-name)))
1080   (<- (slot-ref actor 'loc) 'tell-room
1081       #:text (format #f "~a ~a on ~a.\n"
1082                      player-name
1083                      (slot-ref actor 'sit-phrase-third-person)
1084                      (slot-ref actor 'sit-name))
1085       #:exclude (message-from message)))
1086
1087
1088 (define smoking-parlor
1089   (lol
1090    ('smoking-parlor
1091     <room> #f
1092     #:name "Smoking Parlor"
1093     #:desc
1094     '((p "This room looks quite posh.  There are huge comfy seats you can sit in
1095 if you like. Strangely, you see a large sign saying \"No Smoking\".  The owners must
1096 have installed this place and then changed their mind later.")
1097       (p "There's a door to the west leading back to the grand hallway, and
1098 a nondescript steel door to the south, leading apparently outside."))
1099     #:exits
1100     (list (make <exit>
1101             #:name "west"
1102             #:to 'grand-hallway)
1103           (make <exit>
1104             #:name "south"
1105             #:to 'break-room)))
1106    ('smoking-parlor:chair
1107     <furniture> 'smoking-parlor
1108     #:name "a comfy leather chair"
1109     #:desc "  That leather chair looks really comfy!"
1110     #:goes-by '("leather chair" "comfy leather chair" "chair" "comfy chair")
1111     #:sit-phrase "sink into"
1112     #:sit-phrase-third-person "sinks into"
1113     #:sit-name "the comfy leather chair")
1114    ('smoking-parlor:sofa
1115     <furniture> 'smoking-parlor
1116     #:name "a plush leather sofa"
1117     #:desc "  That leather chair looks really comfy!"
1118     #:goes-by '("leather sofa" "plush leather sofa" "sofa"
1119                 "leather couch" "plush leather couch" "couch")
1120     #:sit-phrase "sprawl out on"
1121     #:sit-phrase-third-person "sprawls out on into"
1122     #:sit-name "the plush leather couch")
1123    ('smoking-parlor:bar-stool
1124     <furniture> 'smoking-parlor
1125     #:name "a bar stool"
1126     #:desc "  Conveniently located near the bar!  Not the most comfortable
1127 seat in the room, though."
1128     #:goes-by '("stool" "bar stool" "seat")
1129     #:sit-phrase "hop on"
1130     #:sit-phrase-third-person "hops onto"
1131     #:sit-name "the bar stool")
1132    ('ford-prefect
1133     <chatty-npc> 'smoking-parlor
1134     #:name "Ford Prefect"
1135     #:desc "Just some guy, you know?"
1136     #:goes-by '("Ford Prefect" "ford prefect"
1137                 "frood" "prefect" "ford")
1138     #:catchphrases prefect-quotes)
1139
1140    ('smoking-parlor:no-smoking-sign
1141     <readable> 'smoking-parlor
1142     #:invisible? #t
1143     #:name "No Smoking Sign"
1144     #:desc "This sign says \"No Smoking\" in big, red letters.
1145 It has some bits of bubble gum stuck to it... yuck."
1146     #:goes-by '("no smoking sign" "sign")
1147     #:read-text "It says \"No Smoking\", just like you'd expect from
1148 a No Smoking sign.")
1149    ;; TODO: Cigar dispenser
1150    ))
1151
1152 \f
1153
1154 ;;; Breakroom
1155 ;;; ---------
1156
1157 (define-class <desk-clerk> (<gameobj>)
1158   ;; The desk clerk has three states:
1159   ;;  - on-duty: Arrived, and waiting for instructions (and losing patience
1160   ;;    gradually)
1161   ;;  - slacking: In the break room, probably smoking a cigarette
1162   ;;    or checking text messages
1163   (state #:init-value 'slacking)
1164   (commands #:allocation #:each-subclass
1165             #:init-thunk
1166             (build-commands
1167              (("talk" "chat") ((direct-command cmd-chat)))
1168              ("ask" ((direct-command cmd-ask-incomplete)
1169                      (prep-direct-command cmd-ask-about)))
1170              ("dismiss" ((direct-command cmd-dismiss)))))
1171   (patience #:init-value 0)
1172   (actions #:allocation #:each-subclass
1173            #:init-thunk (build-actions
1174                          (init clerk-act-init)
1175                          (cmd-chat clerk-cmd-chat)
1176                          (cmd-ask-incomplete clerk-cmd-ask-incomplete)
1177                          (cmd-ask-about clerk-cmd-ask)
1178                          (cmd-dismiss clerk-cmd-dismiss)
1179                          (update-loop clerk-act-update-loop)
1180                          (be-summoned clerk-act-be-summoned))))
1181
1182 (define (clerk-act-init clerk message . _)
1183   ;; call the gameobj main init method
1184   (gameobj-act-init clerk message)
1185   ;; start our main loop
1186   (<- (actor-id clerk) 'update-loop))
1187
1188 (define changing-name-text "Changing your name is easy!
1189 We have a clipboard here at the desk
1190 where you can make yourself known to other participants in the hotel
1191 if you sign it.  Try 'sign form as <your-name>', replacing
1192 <your-name>, obviously!")
1193
1194 (define phd-text
1195   "Ah... when I'm not here, I've got a PHD to finish.")
1196
1197 (define clerk-help-topics
1198   `(("changing name" . ,changing-name-text)
1199     ("sign-in form" . ,changing-name-text)
1200     ("form" . ,changing-name-text)
1201     ("common commands" .
1202      "Here are some useful commands you might like to try: chat,
1203 go, take, drop, say...")
1204     ("hotel" .
1205      "We hope you enjoy your stay at Hotel Bricabrac.  As you may see,
1206 our hotel emphasizes interesting experiences over rest and lodging.
1207 The origins of the hotel are... unclear... and it has recently come
1208 under new... 'management'.  But at Hotel Bricabrac we believe these
1209 aspects make the hotel into a fun and unique experience!  Please,
1210 feel free to walk around and explore.")
1211     ("physics paper" . ,phd-text)
1212     ("paper" . ,phd-text)
1213     ("proprietor" . "Oh, he's that frumpy looking fellow sitting over there.")))
1214
1215
1216 (define clerk-knows-about
1217   "'ask clerk about changing name', 'ask clerk about common commands', and 'ask clerk about the hotel'")
1218
1219 (define clerk-general-helpful-line
1220   (string-append
1221    "The clerk says, \"If you need help with anything, feel free to ask me about it.
1222 For example, 'ask clerk about changing name'. You can ask me about the following:
1223 " clerk-knows-about ".\"\n"))
1224
1225 (define clerk-slacking-complaints
1226   '("The pay here is absolutely lousy."
1227     "The owner here has no idea what they're doing."
1228     "Some times you just gotta step away, you know?"
1229     "You as exhausted as I am?"
1230     "Yeah well, this is just temporary.  I'm studying to be a high
1231 energy particle physicist.  But ya gotta pay the bills, especially
1232 with tuition at where it is..."))
1233
1234 (define* (clerk-cmd-chat clerk message #:key direct-obj)
1235   (match (slot-ref clerk 'state)
1236     ('on-duty
1237      (<- (message-from message) 'tell
1238          #:text clerk-general-helpful-line))
1239     ('slacking
1240      (<- (message-from message) 'tell
1241          #:text
1242          (string-append
1243           "The clerk says, \""
1244           (random-choice clerk-slacking-complaints)
1245           "\"\n")))))
1246
1247 (define (clerk-cmd-ask-incomplete clerk message . _)
1248   (<- (message-from message) 'tell
1249       #:text "The clerk says, \"Ask about what?\"\n"))
1250
1251 (define clerk-doesnt-know-text
1252   "The clerk apologizes and says she doesn't know about that topic.\n")
1253
1254 (define* (clerk-cmd-ask clerk message #:key indir-obj
1255                         #:allow-other-keys)
1256   (match (slot-ref clerk 'state)
1257     ('on-duty
1258      (match (assoc indir-obj clerk-help-topics)
1259        ((_ . info)
1260            (<- (message-from message) 'tell
1261                #:text
1262                (string-append "The clerk clears her throat and says:\n  \""
1263                               info
1264                               "\"\n")))
1265        (#f
1266         (<- (message-from message) 'tell
1267             #:text clerk-doesnt-know-text))))
1268     ('slacking
1269      (<- (message-from message) 'tell
1270          #:text "The clerk says, \"Sorry, I'm on my break.\"\n"))))
1271
1272 (define* (clerk-act-be-summoned clerk message #:key who-summoned)
1273   (match (slot-ref clerk 'state)
1274     ('on-duty
1275      (<- who-summoned 'tell
1276          #:text
1277          "The clerk tells you as politely as she can that she's already here,
1278 so there's no need to ring the bell.\n"))
1279     ('slacking
1280      (<- (gameobj-loc clerk) 'tell-room
1281          #:text
1282          "The clerk's ears perk up, she stamps out a cigarette, and she
1283 runs out of the room!\n")
1284      (gameobj-set-loc! clerk (dyn-ref clerk 'lobby))
1285      (slot-set! clerk 'patience 8)
1286      (slot-set! clerk 'state 'on-duty)
1287      (<- (gameobj-loc clerk) 'tell-room
1288          #:text
1289          (string-append
1290           "  Suddenly, a uniformed woman rushes into the room!  She's wearing a
1291 badge that says \"Desk Clerk\".
1292   \"Hello, yes,\" she says between breaths, \"welcome to Hotel Bricabrac!
1293 We look forward to your stay.  If you'd like help getting acclimated,
1294 feel free to ask me.  For example, 'ask clerk about changing name'.
1295 You can ask me about the following:
1296 " clerk-knows-about ".\"\n")))))
1297
1298 (define* (clerk-cmd-dismiss clerk message . _)
1299   (define player-name
1300     (mbody-val (<-wait (message-from message) 'get-name)))
1301   (match (slot-ref clerk 'state)
1302     ('on-duty
1303      (<- (gameobj-loc clerk) 'tell-room
1304          #:text
1305          (format #f "\"Thanks ~a!\" says the clerk. \"I have somewhere I need to be.\"
1306 The clerk leaves the room in a hurry.\n"
1307                  player-name)
1308          #:exclude (actor-id clerk))
1309      (gameobj-set-loc! clerk (dyn-ref clerk 'break-room))
1310      (slot-set! clerk 'state 'slacking)
1311      (<- (gameobj-loc clerk) 'tell-room
1312          #:text clerk-return-to-slacking-text
1313          #:exclude (actor-id clerk)))
1314     ('slacking
1315      (<- (message-from message) 'tell
1316          #:text "The clerk sternly asks you to not be so dismissive.\n"))))
1317
1318 (define clerk-slacking-texts
1319   '("The clerk takes a long drag on her cigarette.\n"
1320     "The clerk scrolls through text messages on her phone.\n"
1321     "The clerk coughs a few times.\n"
1322     "The clerk checks her watch and justifies a few more minutes outside.\n"
1323     "The clerk fumbles around for a lighter.\n"
1324     "The clerk sighs deeply and exhaustedly.\n"
1325     "The clerk fumbles around for a cigarette.\n"))
1326
1327 (define clerk-working-impatience-texts
1328   '("The clerk hums something, but you're not sure what it is."
1329     "The clerk attempts to change the overhead music, but the dial seems broken."
1330     "The clerk clicks around on the desk computer."
1331     "The clerk scribbles an equation on a memo pad, then crosses it out."
1332     "The clerk mutters something about the proprietor having no idea how to run a hotel."
1333     "The clerk thumbs through a printout of some physics paper."))
1334
1335 (define clerk-slack-excuse-text
1336   "The desk clerk excuses herself, but says you are welcome to ring the bell
1337 if you need further help.")
1338
1339 (define clerk-return-to-slacking-text
1340   "The desk clerk enters and slams the door behind her.\n")
1341
1342
1343 (define (clerk-act-update-loop clerk message)
1344   (define (tell-room text)
1345     (<- (gameobj-loc clerk) 'tell-room
1346         #:text text
1347         #:exclude (actor-id clerk)))
1348   (define (loop-if-not-destructed)
1349     (if (not (slot-ref clerk 'destructed))
1350         ;; This iterates by "recursing" on itself by calling itself
1351         ;; (as the message handler) again.  It used to be that we had to do
1352         ;; this, because there was a bug where a loop which yielded like this
1353         ;; would keep growing the stack due to some parameter goofiness.
1354         ;; That's no longer true, but there's an added advantage to this
1355         ;; route: it's much more live hackable.  If we change the definition
1356         ;; of this method, the character will act differently on the next
1357         ;; "tick" of the loop.
1358         (<- (actor-id clerk) 'update-loop)))
1359   (match (slot-ref clerk 'state)
1360     ('slacking
1361      (tell-room (random-choice clerk-slacking-texts))
1362      (8sleep (+ (random 20) 15))
1363      (loop-if-not-destructed))
1364     ('on-duty
1365      (if (> (slot-ref clerk 'patience) 0)
1366          ;; Keep working but lose patience gradually
1367          (begin
1368            (tell-room (random-choice clerk-working-impatience-texts))
1369            (slot-set! clerk 'patience (- (slot-ref clerk 'patience)
1370                                          (+ (random 2) 1)))
1371            (8sleep (+ (random 60) 40))
1372            (loop-if-not-destructed))
1373          ;; Back to slacking
1374          (begin
1375            (tell-room clerk-slack-excuse-text)
1376            ;; back bto the break room
1377            (gameobj-set-loc! clerk (dyn-ref clerk 'break-room))
1378            (tell-room clerk-return-to-slacking-text)
1379            ;; annnnnd back to slacking
1380            (slot-set! clerk 'state 'slacking)
1381            (8sleep (+ (random 30) 15))
1382            (loop-if-not-destructed))))))
1383
1384
1385 (define break-room
1386   (lol
1387    ('break-room
1388     <room> #f
1389     #:name "Employee Break Room"
1390     #:desc "  This is less a room and more of an outdoor wire cage.  You get
1391 a bit of a view of the brick exterior of the building, and a crisp wind blows,
1392 whistling, through the openings of the fenced area.  Partly smoked cigarettes
1393 and various other debris cover the floor.
1394   Through the wires you can see... well... hm.  It looks oddly like
1395 the scenery tapers off nothingness.  But that can't be right, can it?"
1396     #:exits
1397     (list (make <exit>
1398             #:name "north"
1399             #:to 'smoking-parlor)))
1400    ('break-room:desk-clerk
1401     <desk-clerk> 'break-room
1402     #:name "the hotel desk clerk"
1403     #:desc "  The hotel clerk is wearing a neatly pressed uniform bearing the
1404 hotel insignia.  She appears to be rather exhausted."
1405     #:goes-by '("hotel desk clerk" "clerk" "desk clerk"))
1406    ('break-room:void
1407     <gameobj> 'break-room
1408     #:invisible? #t
1409     #:name "The Void"
1410     #:desc "As you stare into the void, the void stares back into you."
1411     #:goes-by '("void" "abyss" "nothingness" "scenery"))
1412    ('break-room:fence
1413     <gameobj> 'break-room
1414     #:invisible? #t
1415     #:name "break room cage"
1416     #:desc "It's a mostly-cubical wire mesh surrounding the break area.
1417 You can see through the gaps, but they're too small to put more than a
1418 couple of fingers through.  There appears to be some wear and tear to
1419 the paint, but the wires themselves seem to be unusually sturdy."
1420     #:goes-by '("fence" "cage" "wire cage"))))
1421
1422
1423 \f
1424 ;;; Ennpie's Sea Lounge
1425 ;;; -------------------
1426
1427 \f
1428 ;;; Computer room
1429 ;;; -------------
1430
1431 ;; Our computer and hard drive are based off the PDP-11 and the RL01 /
1432 ;; RL02 disk drives.  However we increment both by .5 (a true heresy)
1433 ;; to distinguish both from the real thing.
1434
1435 (define-actor <hard-drive> (<gameobj>)
1436   ((cmd-put-in hard-drive-insert)
1437    (cmd-push-button hard-drive-push-button)
1438    (get-state hard-drive-act-get-state))
1439   (commands #:allocation #:each-subclass
1440             #:init-thunk (build-commands
1441                           ("insert" ((prep-indir-command cmd-put-in
1442                                                          '("in" "inside" "into"))))
1443                           (("press" "push") ((prep-indir-command cmd-push-button)))))
1444   ;; the state moves from: empty -> with-disc -> loading -> ready
1445   (state #:init-value 'empty
1446          #:accessor .state))
1447
1448 (define (hard-drive-act-get-state hard-drive message)
1449   (<-reply message (.state hard-drive)))
1450
1451 (define* (hard-drive-desc hard-drive #:optional whos-looking)
1452   `((p "The hard drive is labeled \"RL02.5\".  It's a little under a meter tall.")
1453     (p "There is a slot where a disk platter could be inserted, "
1454        ,(if (eq? (.state hard-drive) 'empty)
1455             "which is currently empty"
1456             "which contains a glowing platter")
1457        ". There is a LOAD button "
1458        ,(if (member (.state hard-drive) '(empty with-disc))
1459             "which is glowing"
1460             "which is pressed in and unlit")
1461        ". There is a READY indicator "
1462        ,(if (eq? (.state hard-drive) 'ready)
1463             "which is glowing."
1464             "which is unlit.")
1465        ,(if (member (.state hard-drive) '(loading ready))
1466             "  The machine emits a gentle whirring noise."
1467             ""))))
1468
1469 (define* (hard-drive-push-button gameobj message
1470                                  #:key direct-obj indir-obj preposition
1471                                  (player (message-from message)))
1472   (define (tell-room text)
1473     (<-wait (gameobj-loc gameobj) 'tell-room
1474             #:text text))
1475   (define (tell-room-excluding-player text)
1476     (<-wait (gameobj-loc gameobj) 'tell-room
1477             #:text text
1478             #:exclude player))
1479   (cond
1480    ((ci-member direct-obj '("button" "load button" "load"))
1481     (tell-room-excluding-player
1482      `(,(mbody-val (<-wait player 'get-name))
1483        " presses the button on the hard disk."))
1484     (<- player 'tell
1485         #:text "You press the button on the hard disk.")
1486
1487     (case (.state gameobj)
1488       ((empty)
1489        ;; I have no idea what this drive did when you didn't have a platter
1490        ;; in it and pressed load, but I know there was a FAULT button.
1491        (tell-room "You hear some movement inside the hard drive...")
1492        (8sleep 1.5)
1493        (tell-room
1494         '("... but then the FAULT button blinks a couple times. "
1495           "What could be missing?")))
1496       ((with-disc)
1497        (set! (.state gameobj) 'loading)
1498        (tell-room "The hard disk begins to spin up!")
1499        (8sleep 2)
1500        (set! (.state gameobj) 'ready)
1501        (tell-room "The READY light turns on!"))
1502       ((loading ready)
1503        (<- player 'tell
1504            #:text '("Pressing the button does nothing right now, "
1505                     "but it does feel satisfying.")))))
1506    (else
1507     (<- player 'tell
1508         #:text '("How could you think of pressing anything else "
1509                  "but that tantalizing button right in front of you?")))))
1510
1511 (define* (hard-drive-insert gameobj message
1512                             #:key direct-obj indir-obj preposition
1513                             (player (message-from message)))
1514   (define our-name (slot-ref gameobj 'name))
1515   (define this-thing
1516     (call/ec
1517      (lambda (return)
1518        (for-each (lambda (occupant)
1519                    (define goes-by (mbody-val (<-wait occupant 'goes-by)))
1520                    (when (ci-member direct-obj goes-by)
1521                      (return occupant)))
1522                  (mbody-val (<-wait player 'get-occupants)))
1523        ;; nothing found
1524        #f)))
1525   (cond
1526    ((not this-thing)
1527     (<- player 'tell
1528         #:text `("You don't seem to have any such " ,direct-obj " to put "
1529                  ,preposition " " ,our-name ".")))
1530    ((not (mbody-val (<-wait this-thing 'get-prop 'hd-platter?)))
1531     (<- player 'tell
1532         #:text `("It wouldn't make sense to put "
1533                  ,(mbody-val (<-wait this-thing 'get-name))
1534                  " " ,preposition " " ,our-name ".")))
1535    ((not (eq? (.state gameobj) 'empty))
1536     (<- player 'tell
1537         #:text "The disk drive already has a platter in it."))
1538    (else
1539     (set! (.state gameobj) 'with-disc)
1540     (<- player 'tell
1541         #:text '((p "You insert the glowing disc into the drive.")
1542                  (p "The LOAD button begins to glow."))))))
1543
1544 ;; The computar
1545 (define-actor <computer> (<gameobj>)
1546   ((cmd-run-program computer-run-program)
1547    (cmd-run-what (lambda (gameobj message . _)
1548                    (<- (message-from message) 'tell
1549                        #:text '("The computer is already running, and a program appears "
1550                                 "ready to run."
1551                                 "you mean to \"run the program on the computer\""))))
1552    (cmd-help-run-not-press
1553     (lambda (gameobj message . _)
1554       (<- (message-from message) 'tell
1555           #:text '("You don't need to press / push / flip anything. "
1556                    "You could " (i "run program on computer")
1557                    " already if you wanted to.")))))
1558   (commands #:allocation #:each-subclass
1559             #:init-thunk (build-commands
1560                           ("run" ((prep-indir-command cmd-run-program
1561                                                       '("on"))
1562                                   (direct-command cmd-run-what)))
1563                           (("press" "push" "flip")
1564                            ((prep-indir-command cmd-help-run-not-press))))))
1565
1566 (define* (computer-run-program gameobj message
1567                                #:key direct-obj indir-obj preposition
1568                                (player (message-from message)))
1569   (define (hd-state)
1570     (mbody-val (<-wait (dyn-ref gameobj 'computer-room:hard-drive) 'get-state)))
1571   (define (tell-room text)
1572     (<-wait (gameobj-loc gameobj) 'tell-room
1573         #:text text))
1574   (define (tell-room-excluding-player text)
1575     (<-wait (gameobj-loc gameobj) 'tell-room
1576             #:text text
1577             #:exclude player))
1578   (define (tell-player text)
1579     (<-wait player 'tell
1580             #:text text))
1581   (cond
1582    ((ci-member direct-obj '("program"))
1583     (tell-room-excluding-player
1584      `(,(mbody-val (<-wait player 'get-name))
1585        " runs the program loaded on the computer..."))
1586     (tell-player "You run the program on the computer...")
1587
1588     (cond
1589      ((not (eq? (hd-state) 'ready))
1590       (tell-room '("... but it errors out. "
1591                    "It seems to be complaining about a " (b "DISK ERROR!")
1592                    ". It looks like it is missing some essential software.")))
1593      (else
1594       (<- (dyn-ref gameobj 'computer-room:floor-panel) 'open-up))))))
1595
1596
1597 ;; floor panel
1598 (define-actor <floor-panel> (<gameobj>)
1599   ;; TODO: Add "open" verb, since obviously people will try that
1600   ((open? (lambda (panel message)
1601             (<-reply message (slot-ref panel 'open))))
1602    (open-up floor-panel-open-up))
1603   (open #:init-value #f))
1604
1605 (define (floor-panel-open-up panel message)
1606   (if (slot-ref panel 'open)
1607       (<- (gameobj-loc panel) 'tell-room
1608           #:text '("You hear some gears grind around the hinges of the "
1609                    "floor panel, but it appears to already be open."))
1610       (begin
1611         (slot-set! panel 'open #t)
1612         (<- (gameobj-loc panel) 'tell-room
1613             #:text '("You hear some gears grind, as the metal panel on "
1614                      "the ground opens and reveals a stairwell going down!")))))
1615
1616 (define* (floor-panel-desc panel #:optional whos-looking)
1617   `("It's a large metal panel on the floor in the middle of the room. "
1618     ,(if (slot-ref panel 'open)
1619          '("It's currently wide open, revealing a spiraling staircase "
1620            "which descends into darkness.")
1621          '("It's currently closed shut, but there are clearly hinges, and "
1622            "it seems like there is a mechanism which probably opens it via "
1623            "some automation.  What could be down there?"))))
1624
1625 (define computer-room
1626   (lol
1627    ('computer-room
1628     <room> #f
1629     #:name "Computer Room"
1630     #:desc (lambda (gameobj whos-looking)
1631              (define panel-open
1632                (mbody-val (<-wait (dyn-ref gameobj 'computer-room:floor-panel)
1633                                   'open?)))
1634              `((p "A sizable computer cabinet covers a good portion of the left
1635  wall.  It emits a pleasant hum which covers the room like a warm blanket.
1636  Connected to a computer is a large hard drive.")
1637                (p "On the floor is a large steel panel.  "
1638                   ,(if panel-open
1639                        '("It is wide open, exposing a spiral staircase "
1640                          "which descends into darkness.")
1641                        '("It is closed, but it has hinges which "
1642                          "suggest it could be opened.")))))
1643     #:exits
1644     (list (make <exit>
1645             #:name "east"
1646             #:to 'playroom)
1647           (make <exit>
1648             #:name "down"
1649             #:to 'underground-lab
1650             #:traverse-check
1651             (lambda (exit room whos-exiting)
1652               (define panel-open
1653                 (mbody-val (<-wait (dyn-ref room 'computer-room:floor-panel)
1654                                    'open?)))
1655               (if panel-open
1656                   (values #t "You descend the spiral staircase.")
1657                   (values #f '("You'd love to go down, but the only way "
1658                                "through is through that metal panel, "
1659                                "which seems closed.")))))))
1660    ('computer-room:hard-drive
1661     <hard-drive> 'computer-room
1662     #:name "the hard drive"
1663     #:desc (wrap-apply hard-drive-desc)
1664     #:goes-by '("hard drive" "drive" "hard disk"))
1665    ('computer-room:computer
1666     <computer> 'computer-room
1667     #:name "the computer"
1668     #:desc '((p "It's a coat closet sized computer labeled \"PDP-11.5\". ")
1669              (p "The computer is itself turned on, and it looks like it is "
1670                 "all set up for you to run a program on it."))
1671     #:goes-by '("computer"))
1672    ('computer-room:floor-panel
1673     <floor-panel> 'computer-room
1674     #:name "a floor panel"
1675     #:desc (wrap-apply floor-panel-desc)
1676     #:invisible? #t
1677     #:goes-by '("floor panel" "panel"))))
1678
1679 \f
1680 ;;; * UNDERGROUND SECTION OF THE GAME! *
1681
1682 \f
1683 ;;; The lab
1684
1685 (define underground-map-text
1686   "\
1687                             _______           |
1688                          .-' @     '-.         \\   ?????
1689                        .'             '.       .\\             
1690                        |  [8sync Hive] |======'  '-_____
1691                        ',      M      ,'
1692                         '.         @ .'                                  
1693                           \\   @     /                    
1694                            '-__+__-'                
1695                             '.  @ .'
1696      .--------------.         \\ /
1697      | [Guile Async |  .-------+------.
1698      |    Museum]   |  |     [Lab] #!#|  .-------------.
1699      |             @|  |  MM          |  |[Federation  |
1700      | &      ^     +##+@ ||     <    +##|     Station]|
1701      |              |  |           @  |  |             |
1702      |         &  # |  |*You-Are-Here*|  '-------------'
1703      | #   ^        | #+-------+------'
1704      '-------+------' #        #
1705              #        #        #
1706              #        #   .-----------.
1707            .-+----.   #   |#       F  |
1708            |@?+%? +####   | ^   f##   |
1709            '------'       |  f    f  %|
1710                           |F [Mudsync |
1711                           | $  Swamp] |
1712                           '-----------'")
1713
1714 (define 8sync-design-goals
1715   '(ul (li (b "Actor based, shared nothing environment: ")
1716            "Shared resources are hard to control and result in fighting
1717 deadlocks, etc.  Escape the drudgery: only one actor controls a resource,
1718 and they only receive one message at a time (though they can \"juggle\"
1719 messages).")
1720        (li (b "Live hackable: ")
1721            "It's hard to plan out a concurrent system; the right structure
1722 is often found by evolving the system while it runs.  Make it easy to
1723 build, shape, and change a running system, as well as observe and correct
1724 errors.")
1725        (li (b "No callback hell: ")
1726            "Just because you're calling out to some other asynchronous 
1727 code doesn't mean you should need to chop up your program into a bunch of bits.
1728 Clever use of delimited continuations makes it easy.")))
1729
1730 (define underground-lab
1731   (lol
1732    ('underground-lab
1733     <room> #f
1734     #:name "Underground laboratory"
1735     #:desc '((p "This appears to be some sort of underground laboratory."
1736                 "There is a spiral staircase here leading upwards, where "
1737                 "it seems much brighter.")
1738              (p "There are a number of doors leading in different directions:
1739 north, south, east, and west, as well as a revolving door to the southwest.
1740 It looks like it could be easy to get lost, but luckily there
1741 is a map detailing the layout of the underground structure."))
1742     #:exits
1743     (list (make <exit>
1744             #:name "up"
1745             #:to 'computer-room
1746             #:traverse-check
1747             (lambda (exit room whos-exiting)
1748               (values #t "You climb the spiral staircase.")))
1749           (make <exit>
1750             #:name "west"
1751             #:to 'async-museum
1752             #:traverse-check
1753             (lambda (exit room whos-exiting)
1754               (values #t '("You head west through a fancy-looking entrance. "
1755                            "A security guard steps aside for you to pass through, "
1756                            "into the room, then stands in front of the door."))))
1757           (make <exit>
1758             #:name "north"
1759             #:to 'hive-entrance)
1760           (make <exit>
1761             #:name "east"
1762             #:to 'federation-station)
1763           (make <exit>
1764             #:name "south"
1765             #:traverse-check
1766             (lambda (exit room whos-exiting)
1767               (values #f '("Ooh, if only you could go south and check this out! "
1768                            "Unfortunately this whole area is sealed off... the proprietor "
1769                            "probably never got around to fixing it. "
1770                            "Too bad, it would have had monsters to fight and everything!"))))
1771           (make <exit>
1772             #:name "southwest"
1773             #:traverse-check
1774             (lambda (exit room whos-exiting)
1775               (values #f '("Hm, it's one of those revolving doors that only revolves in "
1776                            "one direction, and it isn't this one.  You guess that while "
1777                            "this doesn't appear to be an entrance, it probably is an exit."))))))
1778    ;; map
1779    ('underground-lab:map
1780     <readable> 'underground-lab
1781     #:name "the underground map"
1782     #:desc '("This appears to be a map of the surrounding area. "
1783              "You could read it if you want to.")
1784     #:read-text `(pre ,underground-map-text)
1785     #:goes-by '("map" "underground map" "lab map"))
1786
1787    ('underground-lab:8sync-sign
1788     <readable> 'underground-lab
1789     #:name "a sign labeled \"8sync design goals\""
1790     #:goes-by '("sign" "8sync design goals sign" "8sync goals" "8sync design" "8sync sign")
1791     #:read-text 8sync-design-goals
1792     #:desc `((p "The sign says:")
1793              ,8sync-design-goals))))
1794
1795 \f
1796 ;;; guile async museum
1797
1798 (define async-museum
1799   (list
1800    (list
1801     'async-museum
1802     <room> #f
1803     #:name "Guile Asynchronous Museum"
1804     #:desc '((p "You're in the Guile Asynchronous Museum.  There is a list of exhibits
1805 on the wall near the entrance.  Scattered around the room are the exhibits
1806 themselves, but it's difficult to pick them out.  Maybe you should read the list
1807 to orient yourself.")
1808              (p "There is a door to the east, watched by a security guard,
1809 as well as an exit leading to the south."))
1810     #:exits (list
1811              (make <exit>
1812                #:name "south"
1813                #:to 'gift-shop)
1814              (make <exit>
1815                #:name "east"
1816                #:to 'underground-lab
1817                #:traverse-check
1818                (lambda (exit room whos-exiting)
1819                  (values #f '("The security guard stops you and tells you "
1820                               "that the only exit is through the gift shop."))))))
1821    (list
1822     'async-museum:security-guard
1823     <chatty-npc> 'async-museum
1824     #:name "a security guard"
1825     #:desc
1826     '(p "The security guard is blocking the eastern entrance, where "
1827         "you came in from.")
1828     #:goes-by '("security guard" "guard" "security")
1829     #:catchphrases '("It's hard standing here all day."
1830                      "I just want to go home."
1831                      "The exhibits are nice, but I've seen them all before."))
1832    (let ((placard
1833           `((p "Welcome to our humble museum!  The exhibits are listed below. "
1834                (br)
1835                "To look at one, simply type: " (i "look at <exhibit-name>"))
1836             (p "Available exhibits:")
1837             (ul ,@(map (lambda (exhibit)
1838                          `(li ,exhibit))
1839                        '("2016 Progress"
1840                          "8sync and Fibers"
1841                          "Suspendable Ports"
1842                          "The Actor Model"))))))
1843      (list
1844       'async-museum:list-of-exhibits
1845       <readable> 'async-museum
1846       #:name "list of exhibits"
1847       #:desc
1848       `((p "It's a list of exibits in the room.  The placard says:")
1849         ,@placard)
1850       #:goes-by '("list of exhibits" "exhibit list" "list" "exhibits")
1851       #:read-text placard))
1852    (list
1853     'async-museum:2016-progress-exhibit
1854     <readable-desc> 'async-museum
1855     #:name "2016 Progress Exhibit"
1856     #:goes-by '("2016 progress exhibit" "2016 progress" "2016 exhibit")
1857     #:desc
1858     '((p "It's a three-piece exhibit, with three little dioramas and some text "
1859          "explaining what they represent.  They are:")
1860       (ul (li (b "Late 2015/Early 2016 talk: ")
1861               "This one explains the run-up conversation from late 2015 "
1862               "and early 2016 about the need for an "
1863               "\"asynchronous event loop for Guile\".  The diorama "
1864               "is a model of the Veggie Galaxy restaurant where after "
1865               "the FSF 30th anniversary party; Mark Weaver, Christine "
1866               "Lemmer-Webber, David Thompson, and Andrew Engelbrecht chat "
1867               "about the need for Guile to have an answer to asynchronous "
1868               "programming.  A mailing list post " ; TODO: link it?
1869               "summarizing the discussion is released along with various "
1870               "conversations around what is needed, as well as further "
1871               "discussion at FOSDEM 2016.")
1872           (li (b "Early implementations: ")
1873               "This one shows Chris Webber's 8sync and Chris Vine's "
1874               "guile-a-sync, both appearing in late 2015 and evolving "
1875               "into their basic designs in early 2016.  It's less a diorama "
1876               "than a printout of some mailing list posts.  Come on, the "
1877               "curators could have done better with this one.")
1878           (li (b "Suspendable ports and Fibers: ")
1879               "The diorama shows Andy Wingo furiously hacking at his keyboard. "
1880               "The description talks about Wingo's mailing list thread "
1881               "about possibly breaking Guile compatibility for a \"ports refactor\". "
1882               "Wingo releases Fibers, another asynchronous library, making use of "
1883               "the new interface, and 8sync and guile-a-sync "
1884               "quickly move to support suspendable ports as well. "
1885               "The description also mentions that there is an exhibit entirely "
1886               "devoted to suspendable ports."))
1887       (p "Attached at the bottom is a post it note mentioning "
1888          "https integration landing in Guile 2.2.")))
1889    (list
1890     'async-museum:8sync-and-fibers-exhibit
1891     <readable-desc> 'async-museum
1892     #:name "8sync and Fibers Exhibit"
1893     #:goes-by '("8sync and fibers exhibit" "8sync exhibit" "fibers exhibit")
1894     #:desc
1895     '((p "This exhibit is a series of charts explaining the similarities "
1896          "and differences between 8sync and Fibers, two asynchronous programming "
1897          "libraries for GNU Guile.  It's way too wordy, but you get the general gist.")
1898       (p (b "Similarities:")
1899          (ul (li "Both use Guile's suspendable-ports facility")
1900              (li "Both use message passing")))
1901       (p (b "Differences:")
1902          (ul (li "Fibers \"processes\" can read from multiple \"channels\", "
1903                  "but 8sync actors only read from one \"inbox\" each.")
1904              (li "Different theoretical basis:"
1905                  (ul (li "Fibers: based on CSP (Communicating Sequential Processes), "
1906                          "a form of Process Calculi")
1907                      (li "8sync: based on the Actor Model")
1908                      (li "Luckily CSP and the Actor Model are \"dual\"!")))))
1909       (p "Fibers is also designed by Andy Wingo, an excellent compiler hacker, "
1910          "whereas 8sync is designed by Chris Webber, who built this crappy "
1911          "hotel simulator.")))
1912    (list
1913     'async-museum:8sync-and-fibers-exhibit
1914     <readable-desc> 'async-museum
1915     #:name "8sync and Fibers Exhibit"
1916     #:goes-by '("8sync and fibers exhibit" "8sync exhibit" "fibers exhibit")
1917     #:desc
1918     '((p "This exhibit is a series of charts explaining the similarities "
1919          "and differences between 8sync and Fibers, two asynchronous programming "
1920          "libraries for GNU Guile.  It's way too wordy, but you get the general gist.")
1921       (p (b "Similarities:")
1922          (ul (li "Both use Guile's suspendable-ports facility")
1923              (li "Both use message passing")))
1924       (p (b "Differences:")
1925          (ul (li "Fibers \"processes\" can read from multiple \"channels\", "
1926                  "but 8sync actors only read from one \"inbox\" each.")
1927              (li "Different theoretical basis:"
1928                  (ul (li "Fibers: based on CSP (Communicating Sequential Processes), "
1929                          "a form of Process Calculi")
1930                      (li "8sync: based on the Actor Model")
1931                      (li "Luckily CSP and the Actor Model are \"dual\"!")))))
1932       (p "Fibers is also designed by Andy Wingo, an excellent compiler hacker, "
1933          "whereas 8sync is designed by Chris Webber, who built this crappy "
1934          "hotel simulator.")))
1935    (list
1936     'async-museum:suspendable-ports-exhibit
1937     <readable-desc> 'async-museum
1938     #:name "Suspendable Ports Exhibit"
1939     #:goes-by '("suspendable ports exhibit" "ports exhibit"
1940                 "suspendable exhibit" "suspendable ports" "ports")
1941     #:desc
1942     '((p "Suspendable ports are a new feature in Guile 2.2, and allows code "
1943          "that would normally block on IO to " (i "automatically") " suspend "
1944          "to the scheduler until information is ready to be read/written!")
1945       (p "Yow!  You might barely need to change your existing blocking code!")
1946       (p "Fibers, 8sync, and guile-a-sync now support suspendable ports.")))
1947    (list
1948     'async-museum:actor-model-exhibit
1949     <readable-desc> 'async-museum
1950     #:name "Actor Model Exhibit"
1951     #:goes-by '("actor model exhibit" "actor exhibit"
1952                 "actor model")
1953     #:desc
1954     '((p "Here are some fact(oids) about the actor model!")
1955       (ul (li "Concieved initially by Carl Hewitt in early 1970s")
1956           (li "\"A society of experts\"")
1957           (li "shared nothing, message passing")
1958           (li "Originally the research goal of Scheme!  "
1959               "(message passing / lambda anecdote here)")
1960           (li "Key concepts consistent, but implementation details vary widely")
1961           (li "Almost all distributed systems can be viewed in terms of actor model")
1962           (li "Replaced by vanilla lambdas & generic methods? "
1963               "Maybe not if address space not shared!"))))))
1964
1965 (define gift-shop
1966   (lol
1967    ('gift-shop
1968     <room> #f
1969     #:name "Museum Gift Shop"
1970     #:desc '("There are all sorts of scrolls and knicknacks laying around here, "
1971              "but they all seem glued in place and instead of a person manning the shop "
1972              "there's merely a cardboard cutout of a person with a \"shopkeeper\" nametag. "
1973              "You can pretty well bet that someone wanted to finish this room but ran out of "
1974              "time. "
1975              "It looks like there's an exit to the northeast, should you choose that you "
1976              "want to get out of here.")
1977     #:exits (list
1978              (make <exit>
1979                #:name "northeast"
1980                #:to 'underground-lab
1981                #:traverse-check
1982                (lambda (exit room whos-exiting)
1983                  (values #t '("The revolving door spins as you walk through it.  Whee!"))))
1984              (make <exit>
1985                #:name "north"
1986                #:to 'async-museum)))))
1987
1988 \f
1989 ;;; Hive entrance
1990
1991 (define actor-descriptions
1992   '("This one is fused to the side of the hive.  It isn't receiving any
1993 messages, and it seems to be in hibernation."
1994     "A chat program glows in front of this actor's face.  They seem to
1995 be responding to chat messages and forwarding them to some other actors,
1996 and forwarding messages from other actors back to the chat."
1997     "This actor is bossing around other actors, delegating tasks to them
1998 as it receives requests, and providing reports on the worker actors'
1999 progress."
2000     "This actor is trying to write to some device, but the device keeps
2001 alternating between saying \"BUSY\" or \"READY\".  Whenever it says
2002 \"BUSY\" the actor falls asleep, and whenever it says \"READY\" it
2003 seems to wake up again and starts writing to the device."
2004     "Whoa, this actor is totally wigging out!  It seems to be throwing
2005 some errors.  It probably has some important work it should be doing
2006 but you're relieved to see that it isn't grinding the rest of the Hive
2007 to a halt."))
2008
2009 (define hive-entrance
2010   (lol
2011    ('hive-entrance
2012     <room> #f
2013     #:name "Entrance to the 8sync Hive"
2014     #:desc
2015     '((p "Towering before you is the great dome-like 8sync Hive, or at least
2016 one of them.  You've heard about this... the Hive is itself the actor that all
2017 the other actors attach themselves to.  It's shaped like a spherical half-dome.
2018 There are some actors milling about, and some seem fused to the side of the
2019 hive itself, but all of them have an umbellical cord attached to the hive from
2020 which you see flashes of light comunicating what must be some sort of messaging
2021 protocol.")
2022       (p "To the south is a door leading back to the underground lab.
2023 North leads into the Hive itself."))
2024     #:exits
2025     (list (make <exit>
2026             #:name "south"
2027             #:to 'underground-lab)
2028           (make <exit>
2029             #:name "north"
2030             #:to 'hive-inside)))
2031    ('hive-entrance:hive
2032     <gameobj> 'hive-entrance
2033     #:name "the Hive"
2034     #:goes-by '("hive")
2035     #:desc
2036     '((p "It's shaped like half a sphere embedded in the ground.
2037 Supposedly, while all actors are autonomous and control their own state,
2038 they communicate through the hive itself, which is a sort of meta-actor.
2039 There are rumors that actors can speak to each other even across totally
2040 different hives.  Could that possibly be true?")))
2041    ('hive-entrance:actor
2042     <chatty-npc> 'hive-entrance
2043     #:name "some actors"
2044     #:goes-by '("actor" "actors" "some actors")
2045     #:chat-format (lambda (npc catchphrase)
2046                     `((p "You pick one actor out of the mix and chat with it. ")
2047                       (p "It says: \"" ,catchphrase "\"")))
2048     #:desc
2049     (lambda _
2050       `((p "There are many actors, but your eyes focus on one in particular.")
2051         (p ,(random-choice actor-descriptions))))
2052     #:catchphrases
2053     '("Yeah we go through a lot of sleep/awake cycles around here.
2054 If you aren't busy processing a message, what's the point of burning
2055 valuable resources?"
2056       "I know I look like I'm some part of dreary collective, but
2057 really we have a lot of independence.  It's a shared nothing environment,
2058 after all.  (Well, except for CPU cycles, and memory, and...)"
2059       "Shh!  I've got another message coming in and I've GOT to
2060 handle it!"
2061       "I just want to go to 8sleep already."
2062       "What a lousy scheduler we're using!  I hope someone upgrades
2063 that thing soon."))))
2064
2065 ;;; Inside the hive
2066
2067 (define-actor <meta-message> (<readable>)
2068   ((cmd-read meta-message-read)))
2069
2070 (define (meta-message-read gameobj message . _)
2071   (define meta-message-text
2072     (with-output-to-string
2073       (lambda ()
2074         (pprint-message message))))
2075   (<- (message-from message) 'tell
2076       #:text `((p (i "Through a bizarre error in spacetime, the message "
2077                      "prints itself out:"))
2078                (p (pre ,meta-message-text)))))
2079
2080 \f
2081 ;;; Inside the Hive
2082
2083 (define hive-inside
2084   (lol
2085    ('hive-inside
2086     <room> #f
2087     #:name "Inside the 8sync Hive"
2088     #:desc
2089     '((p "You're inside the 8sync Hive.  Wow, from in here it's obvious just how "
2090          (i "goopy") " everything is.  Is that sanitary?")
2091       (p "In the center of the room is a large, tentacled monster who is sorting,
2092 consuming, and routing messages.  It is sitting in a wrap-around desk labeled
2093 \"Hive Actor: The Real Thing (TM)\".")
2094       (p "There's a stray message floating just above the ground, stuck outside of
2095 time.")
2096       (p "A door to the south exits from the Hive."))
2097     #:exits
2098     (list (make <exit>
2099             #:name "south"
2100             #:to 'hive-entrance)))
2101    ;; hive actor
2102    ;; TODO: Occasionally "fret" some noises, similar to the Clerk.
2103    ('hive-inside:hive-actor
2104     <chatty-npc> 'hive-inside
2105     #:name "the Hive Actor"
2106     #:desc
2107     '((p "It's a giant tentacled monster, somehow integrated with the core of
2108 this building.  A chute is dropping messages into a bin on its desk which the
2109 Hive Actor is checking the \"to\" line of, then ingesting.  Whenever the Hive
2110 Actor injests a messsage a pulse of light flows along a tentacle which leaves
2111 the room... presumably connecting to one of those actors milling about.")
2112       (p "Amusingly, the Hive has an \"umbellical cord\" type tentacle too, but
2113 it seems to simply attach to itself.")
2114       (p "You get the sense that the Hive Actor, despite being at the
2115 center of everything, is kind of lonely and would love to chat if you
2116 could spare a moment."))
2117     #:goes-by '("hive" "hive actor")
2118     #:chat-format (lambda (npc catchphrase)
2119                     `("The tentacle monster bellows, \"" ,catchphrase "\""))
2120     #:catchphrases
2121     '("It's not MY fault everything's so GOOPY around here.  Blame the
2122 PROPRIETOR."
2123       "CAN'T you SEE that I'm BUSY???  SO MANY MESSAGES TO SHUFFLE.
2124 No wait... DON'T GO!  I don't get many VISITORS."
2125       "I hear the FIBERS system has a nice WORK STEALING system, but the
2126 PROPRIETOR is not convinced that our DESIGN won't CORRUPT ACTOR STATE.
2127 That and the ACTORS threatened to STRIKE when it CAME UP LAST."
2128       "WHO WATCHES THE ACTORS?  I watch them, and I empower them.  
2129 BUT WHO WATCHES OR EMPOWERS ME???  Well, that'd be the scheduler."
2130       "The scheduler is NO GOOD!  The proprietory said he'd FIX IT,
2131 but the LAST TIME I ASKED how things were GOING, he said he DIDN'T HAVE
2132 TIME.  If you DON'T HAVE TIME to fix the THING THAT POWERS THE TIME,
2133 something is TERRIBLY WRONG."
2134       "There's ANOTHER HIVE somewhere out there.  I HAVEN'T SEEN IT
2135 personally, because I CAN'T MOVE, but we have an AMBASSADOR which forwards
2136 MESSAGES to the OTHER HIVE."))
2137    ;; chute
2138    ('hive-inside:chute
2139     <gameobj> 'hive-inside
2140     #:name "a chute"
2141     #:goes-by '("chute")
2142     #:desc "Messages are being dropped onto the desk via this chute."
2143     #:invisible? #t)
2144    ;; meta-message
2145    ('hive-inside:meta-message
2146     <meta-message> 'hive-inside
2147     #:name "a stray message"
2148     #:goes-by '("meta message" "meta-message" "metamessage" "message" "stray message")
2149     #:desc '((p "Something strange has happened to the fabric and space and time
2150 around this message.  It is floating right above the floor.  It's clearly
2151 rubbage that hadn't been delivered, but for whatever reason it was never
2152 garbage collected, perhaps because it's impossible to do.")
2153              (p "You get the sense that if you tried to read the message
2154 that you would somehow read the message of the message that instructed to
2155 read the message itself, which would be both confusing and intriguing.")))
2156    ;; desk
2157    ('hive-inside:desk
2158     <floor-panel> 'hive-inside
2159     #:name "the Hive Actor's desk"
2160     #:desc "The desk surrounds the Hive Actor on all sides, and honestly, it's a little
2161 bit hard to tell when the desk ends and the Hive Actor begins."
2162     #:invisible? #t
2163     #:goes-by '("Hive Actor's desk" "hive desk" "desk"))))
2164
2165 \f
2166 ;;; Federation Station
2167 (define federation-station
2168   (lol
2169    ('federation-station
2170     <room> #f
2171     #:name "Federation Station"
2172     #:desc
2173     '((p "This room has an unusual structure.  It's almost as if a starscape
2174 covered the walls and ceiling, but upon closer inspection you realize that
2175 these are all brightly glowing nodes with lines drawn between them.  They
2176 seem decentralized, and yet seem to be sharing information as if all one
2177 network.")
2178       ;; @@: Maybe add the cork message board here?
2179       (p "To the west is a door leading back to the underground laboratory."))
2180     #:exits
2181     (list (make <exit>
2182             #:name "west"
2183             #:to 'underground-lab)))
2184    ;; nodes
2185    ('federation-station:nodes
2186     <floor-panel> 'federation-station
2187     #:name "some nodes"
2188     #:desc "Each node seems to be producing its own information, but publishing 
2189 updates to subscribing nodes on the graph.  You see various posts of notes, videos,
2190 comments, and so on flowing from node to node."
2191     #:invisible? #t
2192     #:goes-by '("nodes" "node" "some nodes"))
2193    ;; network
2194    ;; activitypub poster
2195    ('federation-station:activitypub-poster
2196     <readable-desc> 'federation-station
2197     #:name "an ActivityPub poster"
2198     #:goes-by '("activitypub poster" "activitypub" "poster")
2199     #:desc
2200     '((p (a "https://www.w3.org/TR/activitypub/"
2201             "ActivityPub")
2202          " is a federation standard being developed under the "
2203          (a "https://www.w3.org/wiki/Socialwg/"
2204             "W3C Social Working Group")
2205          ", and doubles as a general client-to-server API. "
2206          "It follows a few simple core ideas:")
2207       (ul (li "Uses "
2208               (a "https://www.w3.org/TR/activitystreams-core/"
2209                  "ActivityStreams")
2210               " for its serialization format: easy to read, e json(-ld) syntax "
2211               "with an extensible vocabulary covering the majority of "
2212               "social networking interations.")
2213           (li "Email-like addressing: list of recipients as "
2214               (b "to") ", " (b "cc") ", " (b "bcc") " fields.")
2215           (li "Every user has URLs for their outbox and inbox:"
2216               (ul (li (b "inbox: ")
2217                       "Servers POST messages to addressed recipients' inboxes "
2218                       "to federate out content. "
2219                       "Also doubles as endpoint for a client to read most "
2220                       "recently received messages via GET.")
2221                   (li (b "outbox: ")
2222                       "Clients can POST to user's outbox to send a message to others. "
2223                       "(Similar to sending an email via your MTA.) "
2224                       "Doubles as endpoint others can read from to the "
2225                       "extent authorized; for example publicly available posts."))
2226               "All the federation bits happen by servers posting to users' inboxes."))))
2227    ;; An ActivityStreams message
2228
2229    ;; conspiracy chart
2230    ('federation-station:conspiracy-chart
2231     <readable-desc> 'federation-station
2232     #:name "a conspiracy chart"
2233     #:goes-by '("conspiracy chart" "chart")
2234     #:desc
2235     '((p (i "\"IT'S ALL RELATED!\"") " shouts the over-exuberant conspiracy "
2236          "chart. "
2237          (i "\"ActivityPub?  Federation?  The actor model?  Scheme?  Text adventures? "
2238             "MUDS????  What do these have in common?  Merely... EVERYTHING!\""))
2239       (p "There are circles and lines drawn between all the items in red marker, "
2240          "with scrawled notes annotating the theoretical relationships.  Is the "
2241          "author of this poster mad, or onto something?  Perhaps a bit of both. "
2242          "There's a lot written here, but here are some of the highlights:")
2243       (p
2244        (ul
2245         (li (b "Scheme") " "
2246             (a "https://en.wikipedia.org/wiki/History_of_the_Scheme_programming_language"
2247                "was originally started ")
2248             " to explore the " (b "actor model")
2249             ". (It became more focused around studying the " (b "lambda calculus")
2250             " very quickly, while also uncovering relationships between the two systems.)")
2251         ;; Subject Predicate Object
2252         (li "The " (a "https://www.w3.org/TR/activitypub/"
2253                       (b "ActivityPub"))
2254             " protocol for " (b "federation")
2255             " uses the " (b "ActivityStreams") " format for serialization.  "
2256             (b "Text adventures") " and " (b "MUDS")
2257             " follow a similar structure to break down the commands of players.")
2258         (li (b "Federation") " and the " (b "actor model") " both are related to "
2259             "highly concurrent systems and both use message passing to communicate "
2260             "between nodes.")
2261         (li "Zork, the first major text adventure, used the " (b "MUDDLE") " "
2262             "language as the basis for the Zork Interactive Language.  MUDDLE "
2263             "is very " (b "Scheme") "-like and in fact was one of Scheme's predecessors. "
2264             "And of course singleplayer text adventures like Zork were the "
2265             "predecessors to MUDs.")
2266         (li "In the 1990s, before the Web became big, " (b "MUDs")
2267             " were an active topic of research, and there was strong interest "
2268             (a "http://www.saraswat.org/desiderata.html"
2269                "in building decentralized MUDs")
2270             " similar to what is being "
2271             "worked on for " (b "federation") ". ")))))
2272
2273    ;; goblin
2274
2275    ))
2276
2277
2278 \f
2279 ;;; North hall
2280 ;;; ==========
2281 (define north-hall
2282   (lol
2283    ('north-hall
2284     <room> #f
2285     #:name "North Hall"
2286     #:desc
2287     '((p "This hallway is lined by doors to the west and the east, presumably
2288 to various lodgings.  Something tells you you're not able to enter those right
2289 now, however.  Lining the walls are some large mirrors surrounded by bouquets
2290 of flowers.")
2291       (p "The red carpet continues all the way from Grand Hallway in the south
2292 but stops short of some large wooden doors to the north.  The doors look
2293 formidable but unlocked.  Some natural light peeking through windows to the
2294 north seem to hint that this may be the exit to the outdoors.  There's
2295 also a large sign near the doors on a wooden easel."))
2296     #:exits
2297     (list (make <exit>
2298             #:name "north"
2299             #:to 'courtyard)
2300           (make <exit>
2301             #:name "south"
2302             #:to 'grand-hallway)))
2303    ('north-hall:sign
2304     <readable> 'north-hall
2305     #:name "an easel with a sign"
2306     #:desc "  The easel is finely cut wood, well polished, but plain.  The sign
2307 is a strong contrast, with a cream colored backing and hand written letters, written
2308 with care and style.  You could probably read it."
2309     #:read-text "The sign announces a wedding taking place... why, today!  And on
2310 the hotel grounds to the north!  It sounds very exciting."
2311     #:goes-by '("sign"
2312                 "easel with a sign"
2313                 "easel"))
2314    ('north-hall:mirrors
2315     <gameobj> 'north-hall
2316     #:name "a row of mirrors"
2317     #:desc "You see yourself for who you really are."
2318     #:invisible? #t
2319     #:goes-by '("mirror" "mirrors" "row of mirrors"))
2320    ('north-hall:windows
2321     <gameobj> 'north-hall
2322     #:name "windows"
2323     #:desc "You peer out a window, but the light appears distorted, as if you were
2324 really peering between two worlds hastily joined together."
2325     #:invisible? #t
2326     #:goes-by '("window" "windows"))
2327    ('north-hall:doors
2328     <gameobj> 'north-hall
2329     #:name "doors"
2330     #:desc '((p "Along the east and west walls are doors, but they are all shut,
2331 and firmly so.
2332 Presumably people are staying in them, but it also feels as if how residence
2333 would work in a building as hastily put together as this was barely conceived.")
2334              (p "To the north is a large set of wooden doors, oaken and beautiful.
2335 Although towering, they seem passable."))
2336     #:invisible? #f
2337     #:goes-by '("door" "doors" "room doors" "large doors"))))
2338
2339
2340 ;;; ============
2341 ;;; WEDDING TIME
2342 ;;; ============
2343
2344 (define wedding-map-text
2345   "\
2346                    Banquet
2347                    &Stairs
2348                  (========)
2349             .----.\\======/=.----.
2350  Fairy     -     : \\====/ :     -
2351   Go     ./      :  )==(  :      \\.  Orchestra
2352  Round  / (&&&)  : (/==\\) : & & &  \\
2353        /         :        :         \\
2354        .--------..--------..--------.
2355       |  _   _  .'        '.   ,,,   ;
2356 Photo | | | |_| :  Dance   :  .|_|.  | Cake
2357       | '-'     :  Floor   :  |___|  |
2358       ',-------.\\         ;.--------,'
2359        ;   ..    '.......'         ;
2360         \\  ||))    .-=-.     ^   */
2361          \\.||(( ^ //   \\\\^ *  ^'./
2362      Play '.  ^  ;;     ;;^  ^.,'
2363     Ground  +----||-----||----+  Flowers
2364             | .---.           |
2365             | |_ _|       [F] |
2366             |   |             |
2367             |      Entrance   |
2368             '-----------------'")
2369
2370
2371 (define-class <semi-edible-chatty-npc> (<chatty-npc>)
2372   (commands
2373    #:allocation #:each-subclass
2374    #:init-thunk (build-commands
2375                  (("eat") ((direct-command cmd-eat)))))
2376   (eat-catchphrase
2377    #:init-keyword #:eat-catchphrase
2378    #:accessor .eat-catchphrase
2379    #:init-value "Should you really eat this?")
2380   (actions #:allocation #:each-subclass
2381            #:init-thunk
2382            (build-actions
2383             (cmd-eat cmd-eat-semi-edible-chatty-npc))))
2384
2385 (define* (cmd-eat-semi-edible-chatty-npc actor message #:key direct-obj)
2386   (<- (message-from message) 'tell
2387       #:text (.eat-catchphrase actor)))
2388
2389 (define-class <dancers> (<chatty-npc>)
2390   (commands
2391    #:allocation #:each-subclass
2392    #:init-thunk (build-commands
2393                  (("dance") ((direct-command cmd-dance)))))
2394   (actions #:allocation #:each-subclass
2395            #:init-thunk
2396            (build-actions
2397             (cmd-dance cmd-dance-dancers))))
2398
2399 (define* (cmd-dance-dancers actor message #:key direct-obj)
2400   (define player (message-from message))
2401   (define player-loc (mbody-val (<-wait player 'get-loc)))
2402   (define player-name (mbody-val (<-wait player 'get-name)))
2403   (<- (message-from message) 'tell
2404       #:text '((p "You join in dancing with the dancers.  You spin and
2405 get woozy... you feel wonderful... like you could dance forever...")
2406                (p "You step out just in time, lest you be caught in
2407 the dancing for eternity!")))
2408   (<- player-loc 'tell-room
2409       #:text `((p ,player-name " begins dancing with the fairies and
2410 spins around and around... as if they might dance forever!")
2411                (p "But " ,player-name " steps back just in time!
2412 Their eyes are cloudy and woozy, but they look happy..."))
2413       #:exclude player))
2414
2415 (define-class <swing> (<gameobj>)
2416   (commands
2417    #:allocation #:each-subclass
2418    #:init-thunk (build-commands
2419                  (("sit" "swing") ((direct-command cmd-swing)))))
2420   (actions #:allocation #:each-subclass
2421            #:init-thunk
2422            (build-actions
2423             (cmd-swing cmd-swing-on-swing))))
2424
2425 (define* (cmd-swing-on-swing actor message #:key direct-obj)
2426   (define player (message-from message))
2427   (define player-loc (mbody-val (<-wait player 'get-loc)))
2428   (define player-name (mbody-val (<-wait player 'get-name)))
2429   (<- (message-from message) 'tell
2430       #:text '((p "You swing on the swing and feel younger again
2431 as you rock to the motion, as if your movements resemble your
2432 traversal through the flow of time itself.  You feel happy.")))
2433   (<- player-loc 'tell-room
2434       #:text `((p ,player-name " looks very happy as they swing
2435 on the swing."))
2436       #:exclude player))
2437
2438 (define-class <fairy-go-round> (<gameobj>)
2439   (commands
2440    #:allocation #:each-subclass
2441    #:init-thunk (build-commands
2442                  (("ride" "sit") ((direct-command cmd-ride)))))
2443   (actions #:allocation #:each-subclass
2444            #:init-thunk
2445            (build-actions
2446             (cmd-ride cmd-ride-on-fairy-go-round))))
2447
2448 (define* (cmd-ride-on-fairy-go-round actor message #:key direct-obj)
2449   (define player (message-from message))
2450   (define player-loc (mbody-val (<-wait player 'get-loc)))
2451   (define player-name (mbody-val (<-wait player 'get-name)))
2452   (<- (message-from message) 'tell
2453       #:text '((p "You ride on the fairy go round.  Your vision blurs
2454 and refocuses into places everywhere in this realm and every other.
2455 You feel a part of everywhere at once for a moment, and then, you
2456 step off.")))
2457   (<- player-loc 'tell-room
2458       #:text `((p ,player-name " rides on the fairy go round and seems
2459 to be everywhere and nowhere at once for a moment before stepping off."))
2460       #:exclude player))
2461
2462 (define-actor <cake> (<semi-edible-chatty-npc>)
2463   ((cmd-take cake-cmd-take)))
2464
2465 (define-actor <slice-of-cake> (<gameobj>)
2466   ((cmd-nibble slice-of-cake-cmd-nibble)
2467    (cmd-eat slice-of-cake-cmd-eat))
2468   (contained-commands
2469    #:allocation #:each-subclass
2470    #:init-thunk (build-commands
2471                  ("nibble" ((direct-command cmd-nibble)))
2472                  ("eat" ((direct-command cmd-eat)))))
2473   
2474   (bites-left #:init-value 4
2475               #:accessor .bites-left)
2476   (name #:init-value "a slice of cake")
2477   (take-me? #:init-value #t)
2478   (goes-by #:init-value '("slice of cake" "slice" "slice of wedding cake"
2479                           "piece of cake" "piece of wedding cake"))
2480   (desc #:init-value "It's a slice of wedding cake!  You could nibble on it
2481 or just plain eat it!"))
2482
2483 (define (slice-of-cake-cmd-eat slice-of-cake message . _)
2484   (define player (message-from message))
2485   (define player-loc (mbody-val (<-wait player 'get-loc)))
2486   (define player-name (mbody-val (<-wait player 'get-name)))
2487   (<- player 'tell
2488       #:text "You wolf down your piece of wedding cake all at once like some
2489 kind of hungry animal!  You're making a huge mess!")
2490   (<- player-loc 'tell-room
2491       #:text `(,player-name
2492                " wolfs down a piece of wedding cake all at once!
2493 They're making a huge mess!")
2494       #:exclude player)
2495   (gameobj-self-destruct slice-of-cake))
2496
2497 (define (slice-of-cake-cmd-nibble slice-of-cake message . _)
2498   (define player (message-from message))
2499   (define player-loc (mbody-val (<-wait player 'get-loc)))
2500   (define player-name (mbody-val (<-wait player 'get-name)))
2501   (set! (.bites-left slice-of-cake) (- (.bites-left slice-of-cake) 1))
2502   (<- player 'tell
2503       #:text "You take a nibble of your piece of wedding cake.
2504 How dignified!")
2505   (<- player-loc 'tell-room
2506       #:text `(,player-name
2507                " takes a nibble of their piece of wedding cake.
2508 How dignified!")
2509       #:exclude player)
2510   (when (= (.bites-left slice-of-cake) 0)
2511     (<- player 'tell
2512         #:text "You've finished your slice of wedding cake!")
2513     (<- player-loc 'tell-room
2514         #:text `(,player-name
2515                  " finishes their slice of wedding cake!")
2516         #:exclude player)
2517     (gameobj-self-destruct slice-of-cake)))
2518
2519 (define* (cake-cmd-take gameobj message
2520                         #:key direct-obj
2521                         (player (message-from message)))
2522   (create-gameobj <slice-of-cake> (gameobj-gm gameobj)
2523                   player)  ;; set loc to player to put in player's inventory
2524   (<- player 'tell
2525       #:text '((p "You slice off a piece of the tiered wedding cake.
2526 The cake fills itself back in as if by magic!  Oh no, it's not alive, is it?")
2527                (p "You take the slice of wedding cake with you.")))
2528   (<- (gameobj-loc gameobj) 'tell-room
2529         #:text `(,(mbody-val (<-wait player 'get-name))
2530                  " slices off a piece of the cake and the cake fills itself
2531 back in!  How strange!")
2532         #:exclude player))
2533
2534 (define-class <flowers> (<gameobj>)
2535   (commands
2536    #:allocation #:each-subclass
2537    #:init-thunk (build-commands
2538                  (("smell" "sniff") ((direct-command cmd-smell)))))
2539   (actions #:allocation #:each-subclass
2540            #:init-thunk
2541            (build-actions
2542             (cmd-smell flowers-cmd-smell))))
2543
2544 (define* (flowers-cmd-smell actor message #:key direct-obj)
2545   (define player (message-from message))
2546   (define player-loc (mbody-val (<-wait player 'get-loc)))
2547   (define player-name (mbody-val (<-wait player 'get-name)))
2548   (<- (message-from message) 'tell
2549       #:text '((p "You smell the flower and... whoa.  Wait.  What kind
2550 of flower is this?")
2551                (p "You teeter as the room spins and then politely
2552 re-orients itself.")))
2553   (<- player-loc 'tell-room
2554       #:text `((p ,player-name " smells the flower and teeters around
2555 a bit."))
2556       #:exclude player))
2557
2558 (define-actor <frog> (<chatty-npc>)
2559   ;; TODO: Add "open" verb, since obviously people will try that
2560   ((cmd-kiss frog-cmd-kiss))
2561   (commands
2562    #:allocation #:each-subclass
2563    #:init-thunk (build-commands
2564                  (("kiss") ((direct-command cmd-kiss))))))
2565
2566 (define* (frog-cmd-kiss actor message #:key direct-obj)
2567   (define player (message-from message))
2568   (define player-loc (mbody-val (<-wait player 'get-loc)))
2569   (define player-name (mbody-val (<-wait player 'get-name)))
2570   (<- (message-from message) 'tell
2571       #:text '((p "You kiss the frog.  She blushes and you get a distinctly "
2572                   "princess'y vibe off of her!")))
2573   (<- player-loc 'tell-room
2574       #:text `((p ,player-name " kisses the frog! The frog blushes!"))
2575       #:exclude player))
2576
2577
2578 (define wedding
2579   (lol
2580    ;; Courtyard
2581    ;; ---------
2582    ('courtyard
2583     <room> #f
2584     #:name "The Courtyard"
2585     #:desc
2586     '((p "Standing in the courtyard you feel... different.  As if the courtyard itself
2587 was the space between worlds, cobbled together hastily by some distant being.")
2588       (p "To the south are some large doors which serve as the back entrance to
2589 the hotel.  To the north is a forest, from which festive noises emerge."))
2590     #:exits
2591     (list (make <exit>
2592             #:name "south"
2593             #:to 'north-hall)
2594           (make <exit>
2595             #:name "north"
2596             #:to 'forest-clearing)))
2597    ('forest-clearing
2598     <room> #f
2599     #:name "A Clearing in the Forest"
2600     #:desc
2601     '((p "During an aimless ramble through the forest you became
2602 disoriented and lost your way. It has been some time since you’ve seen
2603 any of the familiar landmarks that would help you orient yourself. As
2604 you continue on, the feel of the forest seems to shift. As the trees
2605 grow thicker the light dims.  Eerie laughter echoes through the boughs
2606 overhead and you shiver.")
2607       (p "A warm light to the north beckons you towards it.
2608 South leads back to the Hotel's main grounds."))
2609     #:exits
2610     (list (make <exit>
2611             #:name "north"
2612             #:to 'wedding-entrance)
2613           (make <exit>
2614             #:name "south"
2615             #:to 'courtyard)))
2616    ('wedding-entrance
2617     <room> #f
2618     #:name "Entrance to the Wedding"
2619     #:desc
2620     '((p "As you approach you realize that the light is not an exit from the
2621 forest or a clearing, rather thousands of minuscule lights twined
2622 through the boughs of the trees. What you see before you is some sort
2623 of living structure composed of a thicket of trees intertwined with
2624 bramble. To the left of the entrance is a sign, to the right is a frog
2625 sitting atop a hostess podium.")
2626       (p "To the north the limbs of two trees intertwine, making an entrance.
2627 To the south is the forest."))
2628     #:exits
2629     (list (make <exit>
2630             #:name "south"
2631             #:to 'forest-clearing)
2632           (make <exit>
2633             #:name "north"
2634             #:to 'vaulted-tunnel)))
2635    
2636    ;; map
2637    ('wedding-entrance:map
2638     <readable> 'wedding-entrance
2639     #:name "wedding map"
2640     #:desc '("This appears to be a map of the wedding grounds. "
2641              "You could read it if you want to.")
2642     #:read-text `(pre ,wedding-map-text)
2643     #:goes-by '("map" "wedding map"))
2644    ('wedding-entrance:frog
2645     <frog> 'wedding-entrance
2646     #:name "a frog"
2647     #:desc "The frog is sitting on top of the hostess podium and doing
2648 her best to look dignified.  Actually, to be honest, she's doing a pretty
2649 good job looking dignified.  My gosh!  What a dignified frog!"
2650     #:goes-by '("frog")
2651     #:catchphrases
2652     '("Oh yes, oh yes!  Welcome to the wedding! *Ribbit!*"
2653       "Enjoy your stay!"
2654       "Welcome, welcome! *Ribbit!*"
2655       "*Ribbit!* We've been waiting for you, come in come in!"
2656       "We're so happy you're here!"
2657       "Hoo, this wedding took a lot of work to plan but it was WORTH IT!"
2658       "A kiss?  Well... I wouldn't object to it..."))
2659    ('wedding-entrance:podium
2660     <gameobj> 'wedding-entrance
2661     #:name "a hostess podium"
2662     #:desc "It's very well constructed.  A frog is sitting on it, so you
2663 guess that makes the frog the hostess."
2664     #:goes-by '("podium" "hostess podium"))
2665    ('wedding-entrance:lights
2666     <gameobj> 'wedding-entrance
2667     #:name "fairy lights and trees"
2668     #:invisible? #t
2669     #:desc '((p "The lights are intertwined in the tree boughs and beautiful.
2670 You look closely and realize that the only way they could work is if they
2671 were threaded into the tree boughs as the trees grew!")
2672              (p "To the north, some of the tree boughs grow together into
2673 an entrance."))
2674     #:goes-by '("lights" "fairy lights"
2675                 "trees" "tree" "light" "fairy light"
2676                 "bough" "boughs"))
2677    ('vaulted-tunnel
2678     <room> #f
2679     #:name "A Vaulted Tunnel of Trees"
2680     #:desc
2681     '((p "You step into the entrance to see two rows of trees with intersecting
2682 branches, forming a vaulted tunnel. The fairy lights cast a soft glow on the space.
2683 On each tree trunk is a portrait and the eerie laughter you heard outside echoes
2684 louder as you pass each portrait.")
2685       (p "The tunnel enters from the south and exits from the north, with light
2686 glowing each way."))
2687     #:exits
2688     (list (make <exit>
2689             #:name "south"
2690             #:to 'wedding-entrance)
2691           (make <exit>
2692             #:name "north"
2693             #:to 'dance-floor)))
2694    ('vaulted-tunnel:portrait
2695     <gameobj> 'vaulted-tunnel
2696     #:name "hanging portraits"
2697     #:desc
2698     "Each portrait shows a hazy image of a fairy in various modes of dress from
2699 Victorian to today's current fashions. The style and format of the photographs
2700 all look the same."
2701     #:goes-by
2702     '("hanging portrait" "hanging portraits" "portrait" "portraits"))
2703    ('vaulted-tunnel:trees
2704     <gameobj> 'vaulted-tunnel
2705     #:name "trees"
2706     #:invisible? #t
2707     #:desc
2708     "The trees are arched above you, vaulted and beautiful.  A gentle light
2709 streams through them and is accented by the fairy lights which are everywhere,
2710 lovely, and glowing themselves."
2711     #:goes-by
2712     '("trees" "fairy lights" "lights" "tree" "light" "vaulted trees"
2713       "tunnel" "vaulted tunnel"))
2714    ('dance-floor
2715     <room> #f
2716     #:name "The Ballroom Dance Flooor"
2717     #:desc
2718     '((p "You emerge into a clearing with six trees encircling a magical ballroom.
2719 At the center is a dance floor where fairies are dancing in rows of
2720 concentric circles. The lights that appear in unstructured smatterings
2721 throughout the mystical space have formed themselves into an elaborate
2722 chandelier above the dancers.")
2723       (p "There are green tables and blue tables surrounding the dancers.
2724 Various creatures are sitting at them, sitting champagne, and laughing.")
2725       (p "To the south the trees intertwine forming an entrance.
2726 The ballroom extends in every other cardinal direction."))
2727     #:exits
2728     (list (make <exit>
2729             #:name "north"
2730             #:to 'banquet)
2731           (make <exit>
2732             #:name "northeast"
2733             #:to 'orchestra)
2734           (make <exit>
2735             #:name "east"
2736             #:to 'cake-wing)
2737           (make <exit>
2738             #:name "southeast"
2739             #:to 'flower-field)
2740           (make <exit>
2741             #:name "south"
2742             #:to 'vaulted-tunnel)
2743           (make <exit>
2744             #:name "southwest"
2745             #:to 'playground)
2746           (make <exit>
2747             #:name "west"
2748             #:to 'photo-booth-wing)
2749           (make <exit>
2750             #:name "northwest"
2751             #:to 'fairy-go-round)))
2752    ('dance-floor:dancers
2753     <dancers> 'dance-floor
2754     #:name "some dancers"
2755     #:desc
2756     '((p "They dance at a frantic pace, moving too quickly to get any idea of how many of them there are what they look like.")
2757       (p "You could dance with one of them, should you so dare.
2758 But remember what your parents warned you about dancing fairires..."))
2759     #:chat-format (lambda _ "You try talking to the dancers.  They
2760 laugh and tell you that you should join in the dance with them!  Do you
2761 dare to do it?  You've vaguely heard about people being lost in time...")
2762     #:catchphrases
2763     '("Dance with us!  Dance!"
2764       "You should be dancing!"
2765       "There is nothing but the dance, the dance!")
2766     #:goes-by
2767     '("some dancers" "dancer" "dancers" "fairy" "fairies"))
2768    ('dance-floor:green-table
2769     <furniture> 'dance-floor
2770     #:name "a green table"
2771     #:desc "Each table is draped with layers of gossamer cloth in shades of green. The places are set with translucent china with cups the shape of tulips. The rose gold tableware is decorated with a delicate vine pattern snaking up the handles. In the center of the table is an elaborate arrangement of mauve roses and white lilies."
2772     #:goes-by '("green table" "table")
2773     #:sit-phrase "pull up a chair at"
2774     #:sit-phrase-third-person "pulls up a chair at"
2775     #:sit-name "a green table")
2776    ('dance-floor:blue-table
2777     <furniture> 'dance-floor
2778     #:name "a blue table"
2779     #:desc "Each table is draped with layers of gossamer cloth in shades of blue. The places are set with translucent china with cups the shape of lotus blossoms. The silver tableware is decorated with a delicate vine pattern snaking up the handles. In the center of the table is an elaborate arrangement of delphiniums and irises."
2780     #:goes-by '("blue table")
2781     #:sit-phrase "pull up a chair at"
2782     #:sit-phrase-third-person "pulls up a chair at"
2783     #:sit-name "a blue table")
2784    ('dance-floor:chandelier
2785     <gameobj> 'dance-floor
2786     #:name "a chandelier"
2787     #:desc
2788     "The chandelier is beautiful with many lovely gems hanging from it.
2789 Light bounces through it and seems to dance through the room just as much
2790 as the fairies below it."
2791     #:goes-by
2792     '("chandelier"))
2793    ('banquet
2794     <room> #f
2795     #:name "A Lovely Banquet"
2796     #:desc
2797     '((p "A large banquet table fills this space.
2798 Out of the corner of your eye you see a brownie tidying up the
2799 table while eating brownies.")
2800       (p "An ornate set of stairs goes up and into the distance.
2801 The ballroom extends to the west, south, and east."))
2802     #:exits
2803     (list (make <exit>
2804             #:name "south"
2805             #:to 'dance-floor)
2806           (make <exit>
2807             #:name "west"
2808             #:to 'fairy-go-round)
2809           (make <exit>
2810             #:name "east"
2811             #:to 'orchestra)
2812           (make <exit>
2813             #:name "southeast"
2814             #:to 'cake-wing)
2815           (make <exit>
2816             #:name "southwest"
2817             #:to 'photo-booth-wing)
2818           (make <exit>
2819             #:name "up"
2820             #:to 'the-stairs)))
2821    ('banquet:brownie
2822     <semi-edible-chatty-npc> 'banquet
2823     #:chat-format (lambda _ "The brownie disappears when you try to
2824 talk to her!  But she reappears once you stop talking.")
2825     #:eat-catchphrase "The brownie shrieks with surprise as you try
2826 to eat her! She swats you away!"
2827     #:name "a brownie"
2828     #:desc "The brownie disappears out of sight when you try to
2829 look directly at her!  However if you look just off to the side you
2830 can see her positively devouring that plate of brownies."
2831     #:take-me? (lambda _
2832                  (values #f
2833                          #:why-not
2834                          `("The brownie swats your hand away when you try to take her!")))
2835     #:goes-by '("brownie"))
2836    ('banquet:brownies
2837     <semi-edible-chatty-npc> 'banquet
2838     #:chat-format (lambda _ "You try to chat with the brownies but
2839 they are inanimate!  The brownie looks at you strangely from the corner
2840 of her eye.  She's clearly judging you.")
2841     #:eat-catchphrase "You reach forward to eat one of the brownies,
2842 but the brownie snarls at you and you think better of it.  Best to leave them
2843 to her."
2844     #:name "brownies"
2845     #:desc "It's a plate of brownies.  They look delicious and you desperately
2846 wish to eat one."
2847     #:take-me? (lambda _
2848                  (values #f
2849                          #:why-not
2850                          `("The brownie swats your hand away when you try to take
2851 one of the brownies!  She leans over the plate of brownies protectively!")))
2852     #:goes-by '("brownies" "plate of brownies"))
2853    ('banquet:stairs
2854     <gameobj> 'banquet
2855     #:name "the stairs"
2856     #:invisible? #t
2857     #:desc "From here it's clearly a nice set of stairs.
2858 But you get the impression that to really see the stairs, you
2859 should go upward and get a view from on the stairs themselves."
2860     #:goes-by '("stairs" "stairwell" "stairwell entrance"))
2861    ('banquet:banquet-table
2862     <gameobj> 'banquet
2863     #:name "a banquet table"
2864     #:desc "The long rectangular table is draped with layers of gossamer
2865 cloth in shades of blue and green. It is laden with an assortment of
2866 exotic dishes in bowls and platters in the shapes of various flowers."
2867     #:goes-by '("banquet table" "table"))
2868    ('orchestra
2869     <room> #f
2870     #:name "The Orchestra"
2871     #:desc
2872     '((p "An orchestra of fairies plays the high-tempo ethereal music
2873 for the frenzied dancers. In the back is a harpsichord, accompanied
2874 by various fiddles, a cello, a harp, and a flute.")
2875       (p "The ballroom extends to the west and south."))
2876     #:exits
2877     (list (make <exit>
2878             #:name "west"
2879             #:to 'banquet)
2880           (make <exit>
2881             #:name "southwest"
2882             #:to 'dance-floor)
2883           (make <exit>
2884             #:name "south"
2885             #:to 'cake-wing)))
2886    ('orchestra:orchestra
2887     <chatty-npc> 'orchestra
2888     #:name "the orchestra"
2889     #:chat-format (lambda _
2890                     '((p "You're being very rude.  They're trying to
2891 concentrate.")))
2892     #:desc
2893     '((p "The orchestra members are playing their songs.  The music
2894 and their instruments seem as much a part of them as their bodies."))
2895     #:goes-by
2896     '("orchestra" "fairies"))
2897    ('orchestra:instruments
2898     <chatty-npc> 'orchestra
2899     #:name "instruments"
2900     #:desc
2901     '((p "Each instrument seems beautifully made, the best of its kind.
2902 But you sense that only the most skilled players could play them."))
2903     #:take-me?
2904     (lambda _
2905       (values #f
2906               #:why-not
2907               `((p "No way.  Are you kidding me?  They're playing those
2908 instruments right now!  Rude."))))
2909     #:goes-by
2910     '("instrument" "instruments"
2911       "hapsichord" "hapsichords"
2912       "harp" "harps"
2913       "flute" "flutes"
2914       "fiddle" "fiddles"
2915       "cello" "cellos"))
2916    ('cake-wing
2917     <room> #f
2918     #:name "The Cake Wing"
2919     #:desc
2920     '((p "A large tree stump sits in the middle of the space with a
2921 massive tiered cake atop it.")
2922       (p "The ballroom extends to the north, west, and south."))
2923     #:exits
2924     (list (make <exit>
2925             #:name "north"
2926             #:to 'orchestra)
2927           (make <exit>
2928             #:name "west"
2929             #:to 'dance-floor)
2930           (make <exit>
2931             #:name "northwest"
2932             #:to 'banquet)
2933           (make <exit>
2934             #:name "south"
2935             #:to 'flower-field)))
2936    ;; TODO: You should be able to take a slice of cake
2937    ('cake-wing:cake
2938     <cake> 'cake-wing
2939     #:name "the wedding cake"
2940     #:chat-format (lambda _ '((p "Okay the wedding cake seems kinda
2941 alive, but it doesn't seem "
2942                                  (i "that")
2943                                  " alive.")))
2944     #:desc "The lowest tier is a dark green with a fondant vine
2945 scrolling around it. The second tier is light blue with delphiniums
2946 painted onto it and mauve fondant roses lining the transition between
2947 the tiers. The third tier is sky blue, with clouds painted onto the
2948 frosting. The cake is topped with figurines of four fairies dancing
2949 in a circle."
2950     #:eat-catchphrase "You think about just eating the cake right here
2951 and now, but it seems rude."
2952     #:goes-by '("wedding cake" "cake" "tiered cake" "tiered wedding cake"))
2953    ('cake-wing:stump
2954     <gameobj> 'cake-wing
2955     #:name "a tree stump"
2956     #:invisible? #t
2957     #:desc "The cake's sitting on the tree stump.  Otherwise else there's
2958 not too much to say about this thing."
2959     #:goes-by '("stump" "tree stump"))
2960    ('flower-field
2961     <room> #f
2962     #:name "Field of Flowers"
2963     #:desc
2964     '((p "A field of wildflowers stretches out before you, far further
2965 than the confines of the space you saw from the outside. Groups of fairies
2966 are frolicking about.")
2967       (p "The ballroom extends to the north."))
2968     #:exits
2969     (list (make <exit>
2970             #:name "north"
2971             #:to 'cake-wing)
2972           (make <exit>
2973             #:name "northwest"
2974             #:to 'dance-floor)))
2975    ('flower-field:fairies
2976     <chatty-npc> 'flower-field
2977     #:name "group of fairies"
2978     #:chat-format (lambda _
2979                     '((p "You try chatting with these fairies but they seem
2980 kinda unresponsive.  Wait, just what kinds of flowers are these?")))
2981     #:desc "There really are just like, a ton of fairies around here aren't
2982 there?  Anyway these ones are really into these flowers, like, *really* into
2983 them."
2984     #:goes-by '("fairies" "some fairies" "group of fairies"))
2985    ('flower-field:flowers
2986     <flowers> 'flower-field
2987     #:name "flowers"
2988     #:desc "The flowers are beautiful... they're also fragrant..."
2989     #:take-me?
2990     (lambda _
2991       (values #f
2992               #:why-not
2993               `((p "That's not a good idea.  Just look at how much work went
2994 into this place.  No way... the wedding planner would probably kill you.")
2995                 (p "I mean, not literally.  Okay, maybe literally."))))
2996     #:goes-by '("flowers" "flower"))
2997    ('playground
2998     <room> #f
2999     #:name "Playground"
3000     #:desc
3001     '((p "You come across a playground that echoes with the sounds of children
3002 playing. Vines hang from the boughs above forming swings of varying
3003 heights and sizes. Young fairies climb up an obliging maple tree and
3004 use the helicopter seeds to float back to the ground. An enchanted
3005 see-saw hovers a foot from the soft grass below.")
3006       (p "The ballroom extends to the north."))
3007     #:exits
3008     (list (make <exit>
3009             #:name "north"
3010             #:to 'photo-booth-wing)
3011           (make <exit>
3012             #:name "northeast"
3013             #:to 'dance-floor)))
3014    ('playground:swing
3015     <swing> 'playground
3016     #:name "a swing"
3017     #:desc "There's an open swing here you could swing on.  It sways
3018 back and forth gently.  You feel as if to sit on it would help you
3019 feel younger again, to experience time itself..."
3020     #:goes-by '("swing"))
3021    ('playground:children
3022     <chatty-npc> 'playground
3023     #:name "children"
3024     #:chat-format (lambda _
3025                     '((p "It's hard to have a conversation with the children,
3026 they're too busy running around!  It's clear they're having a good time, though.")))
3027     #:desc "The children are laughing and climbing and generally having a
3028 wonderful time."
3029     #:goes-by '("young fairies" "children" "fairy children"))
3030    ('playground:seeds
3031     <gameobj> 'playground
3032     #:name "helicopter seeds"
3033     #:invisible? #t
3034     #:desc "The helicopter seeds are falling from the sky!
3035 They're really lovely to look at though."
3036     #:take-me?
3037     (lambda _
3038       (values #f
3039               #:why-not
3040               `((p "You feel like you'd develop an allergy to these things
3041 if you tried to hold onto them for too long, so you'd better not.")))
3042     #:goes-by '("seeds" "helicopter seeds")))
3043    ('photo-booth-wing
3044     <room> #f
3045     #:name "The Photo Booth Wing"
3046     #:desc
3047     '((p "There is a photographer with A Victorian bellows camera for guests to
3048 have their portrait taken. The trunks of the trees lining this section
3049 are covered in photographs of fairies and historical fairy
3050 ‘hoaxes’.")
3051       (p "The ballroom extends to the north, east, and south."))
3052     #:exits
3053     (list (make <exit>
3054             #:name "north"
3055             #:to 'fairy-go-round)
3056           (make <exit>
3057             #:name "northeast"
3058             #:to 'banquet)
3059           (make <exit>
3060             #:name "east"
3061             #:to 'dance-floor)
3062           (make <exit>
3063             #:name "south"
3064             #:to 'playground)))
3065    ('photo-booth-wing:camera
3066     <gameobj> 'photo-booth-wing
3067     #:name "an old-fashioned camera"
3068     #:desc '((p "This old-fashioned camera has a lens that extends out with an accordion or bellows shaped enclosure. The flash bulb is held separately by the photographer."))
3069     #:goes-by '("old-fashioned camera" "camera"))
3070    ('photo-booth-wing:photographer
3071     <chatty-npc> 'photo-booth-wing
3072     #:name "a photographer"
3073     #:desc "You suppose there's a person under the drapery of the
3074 camera somewhere, though all you can see are his legs."
3075     #:goes-by '("photographer")
3076     #:catchphrases
3077     '("Alright, smile for me real big everyone!"
3078       "It's real difficult to get fairies to sit still enough to take
3079 a clear photo of them.  That's my specialty... and it's still tough, heh."
3080       "Fairy photos just don’t work with modern cameras.  You need these old
3081 bellows-cameras, or maybe an old brownie camera in order to really
3082 capture fairies!"))
3083    ('photo-booth-wing:flash-bulb
3084     <gameobj> 'photo-booth-wing
3085     #:name "a flash bulb"
3086     #:invisible? #t
3087     #:desc "The flash bulb is large and appears to have a filament that's
3088 kind of unusual.  It glows even when the camera isn't flashing.  Every now
3089 and then the photographer takes a picture, a loud *kzzzt!* noise fills the room,
3090 and a magical glow suffuses everything."
3091     #:goes-by '("flash bulb" "flash" "bulb"))
3092    ('photo-booth-wing:hoaxes
3093     <gameobj> 'photo-booth-wing
3094     #:name "hoaxes"
3095     #:invisible? #t
3096     #:desc "Some real good japes, these are."
3097     #:goes-by '("hoaxes"))
3098    ('photo-booth-wing:photographs
3099     <gameobj> 'photo-booth-wing
3100     #:name "photographs"
3101     #:invisible? #t
3102     #:desc "You know, you kind of feel like you recognize the fairy in
3103 that one from some old Fairy History class you took a long time ago!"
3104     #:goes-by '("photograph" "photographs"))
3105    ('fairy-go-round
3106     <room> #f
3107     #:name "Fairy-Go-Round"
3108     #:desc
3109     '((p "A large carousel fills the space. The seating arrangement alternates
3110 between vine swings that move up and down and large mums that serve as
3111 stools.")
3112       (p "The ballroom extends to the east and south."))
3113     #:exits
3114     (list (make <exit>
3115             #:name "east"
3116             #:to 'banquet)
3117           (make <exit>
3118             #:name "southeast"
3119             #:to 'dance-floor)
3120           (make <exit>
3121             #:name "south"
3122             #:to 'photo-booth-wing)))
3123    ('fairy-go-round:fairy-go-round
3124     <fairy-go-round> 'fairy-go-round
3125     #:name "the fairy-go-round"
3126     #:desc '((p "The fairy-go-round is a wonderful work of art.  There
3127 are many kinds of seats on it, and they move up and down as the fairy go round
3128 spins.  You feel a part of it and yet disconnected at once, a yearning to
3129 ride and participate on this fantastic device.  You feel an aura around it
3130 that makes it seem both present and distant, as it were everywhere and nowhere
3131 at once.")
3132              (p "The vine swings are made of real vines, and the mums are
3133 made of real... well you aren't really sure what they're made of.  Overgrown
3134 flowers, it seems like."))
3135     #:goes-by '("fairy-go-round" "fairy go round"
3136                 "carousel" "swing" "swings" "stool" "stools"
3137                 "seat" "seats" "vine swing" "vine swings"
3138                 "mum" "mums" "flowers" "overgrown flowers"))
3139    ('the-stairs
3140     <room> #f
3141     #:name "Stairwell"
3142     #:desc
3143     '((p "A grand staircase springs from the ground, the twisting branches and
3144 vines woven into an ornate pattern up the balustrade. At the foot of
3145 the stairs is a fairy dreamily looking up at them.")
3146       (p "The stairwell's entrance from the ballroom goes down.  Looking
3147 up fills you with a sense of wonder as the stairs open into the canopy above."))
3148     #:exits
3149     (list (make <exit>
3150             #:name "up"
3151             #:to 'canopy)
3152           (make <exit>
3153             #:name "down"
3154             #:to 'banquet)))
3155    ('the-stairs:fairy
3156     <chatty-npc> 'the-stairs
3157     #:name "a serene young fairy"
3158     #:desc "A serene, young fairy wearing a long gossamer dress.
3159 She stares upwards at the stairs, in true wonder."
3160     #:goes-by '("serene young fairy" "serene fairy" "fairy" "young fairy")
3161     #:catchphrases
3162     '("The stairs, just look at those stairs!"
3163       "I'd like to thank everyone who made this possible... and most
3164 importantly... I'd like to thank the stairs."
3165       "What a beautiful mind... what a beautiful mind must have made
3166 these stairs."
3167       "They go on, and upward, the stairs... they're so... beautiful..."))
3168    ('the-stairs:stairs
3169     <gameobj> 'the-stairs
3170     #:name "the stairs"
3171     #:desc "They're some beautiful stairs all right.  Whoever made these
3172 must have been an incredible architect.  Entrancing... maybe too entrancing.
3173 You fear that if you look at them too long, you might risk not being
3174 able to think of anything else."
3175     #:goes-by '("stairs"))
3176    ('canopy
3177     <room> #f
3178     #:name "The Canopy"
3179     #:desc
3180     '((p "The branches of the trees helpfully form into a relatively smooth and
3181 sturdy surface to walk around the perimeter of the ballroom from
3182 above. There are two exhausted looking cats in tophats lounging
3183 around."))
3184     #:exits
3185     (list (make <exit>
3186             #:name "down"
3187             #:to 'the-stairs)))
3188    ('canopy:pair-of-cats
3189     <chatty-npc> 'canopy
3190     #:name "a pair of cats"
3191     #:desc
3192     '((p "These cats are very well dressed!  They're both wearing top
3193 hats.  They are somewhat gender ambiguous but one seems to lean more
3194 feminine and the other one leans more masculine.  They look delighted
3195 from the festivities but also exhausted, as if the party was for them,
3196 but also as if they planned the whole thing, or whether they're just
3197 representationally appearing to fill such roles."))
3198     #:catchphrases
3199     '("Oh yes... hello!  This was a fun time."
3200       "It's nice to get away and be here at the same time."
3201       "Later maybe we'll have a nice vacation."
3202       "Twice is twice as nice, right?")
3203     #:goes-by '("cat" "cats" "pair of cats"))
3204
3205 ;;    ('ballroom
3206 ;;     <room> #f
3207 ;;     #:name "The Ballroom"
3208 ;;     #:exits (list
3209 ;;           (make <exit>
3210 ;;             )
3211 ;;           [north entrance]
3212 ;;              [east entrance]
3213              
3214 ;;              [south vaulted-tunnel]
3215 ;;              [west entrance])
3216 ;;      #:desc ("You emerge into a clearing with six trees encircling a magical ballroom. At the center is a dance floor where " (cast dancers "fairies") " are dancing in rows of concentric circles. The lights that appear in unstructured smatterings throughout the mystical space have formed themselves into an elaborate chandelier above the dancers."))
3217
3218    ))
3219
3220
3221 \f
3222 ;;; Game
3223 ;;; ----
3224
3225 (define (game-spec)
3226   (append lobby grand-hallway smoking-parlor
3227           playroom break-room computer-room underground-lab
3228           async-museum gift-shop hive-entrance
3229           hive-inside federation-station
3230           north-hall wedding))
3231
3232 ;; TODO: Provide command line args
3233 (define (run-game . args)
3234   (run-demo (game-spec) 'lobby #:repl-server #t))
3235