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