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