Wedding grounds
[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   Despite her exhaustion, you sense she'd be happy to chat with you,
268 though the conversation may be a bit one sided."))
269     #:goes-by '("languid lady" "lady"
270                 "hotel proprietor" "proprietor")
271     #:catchphrases hotel-owner-grumps)
272    ;; Object: Sign
273    ('lobby:sign
274     <readable> 'lobby
275     #:name "the Hotel Bricabrac sign"
276     #:desc "  It strikes you that there's something funny going on with this sign.
277 Sure enough, if you look at it hard enough, you can tell that someone
278 hastily painted over an existing sign and changed the \"M\" to an \"H\".
279 Classy!"
280     #:read-text "  All it says is \"Hotel Bricabrac\" in smudged, hasty text."
281     #:goes-by '("sign"
282                 "bricabrac sign"
283                 "hotel sign"
284                 "hotel bricabrac sign"
285                 "lobby sign"))
286
287    ('lobby:bell
288     <summoning-bell> 'lobby
289     #:name "a shiny brass bell"
290     #:goes-by '("shiny brass bell" "shiny bell" "brass bell" "bell")
291     #:desc "  A shiny brass bell.  Inscribed on its wooden base is the text
292 \"ring me for service\".  You probably could \"ring the bell\" if you 
293 wanted to."
294     #:summons 'break-room:desk-clerk)
295
296    ('lobby:sign-in-form
297     <sign-in-form> 'lobby
298     #:name "sign-in form"
299     #:goes-by '("sign-in form" "form" "signin form")
300     #:desc '("It looks like you could sign this form and set your name like so: "
301              (i "sign form as <my-name-here>")))
302
303    ;; Object: curio cabinets
304    ;; TODO: respond to attempts to open the curio cabinet
305    ('lobby:cabinet
306     <proxy-items> 'lobby
307     #:proxy-items '(lobby:porcelain-doll
308                     lobby:1950s-robots
309                     lobby:tea-set lobby:mustard-pot
310                     lobby:head-of-elvis lobby:circuitboard-of-evlis
311                     lobby:teletype-scroll lobby:orange-cat-phone)
312     #:name "a curio cabinet"
313     #:goes-by '("curio cabinet" "cabinet" "bricabrac cabinet"
314                 "cabinet of curiosities")
315     #:desc (lambda _
316              (format #f "  The curio cabinet is full of all sorts of oddities!
317 Something catches your eye!
318 Ooh, ~a!" (random-choice
319            '("a creepy porcelain doll"
320              "assorted 1950s robots"
321              "an exquisite tea set"
322              "an antique mustard pot"
323              "the pickled head of Elvis"
324              "the pickled circuitboard of EVLIS"
325              "a scroll of teletype paper holding the software Four Freedoms"
326              "a telephone shaped like an orange cartoon cat")))))
327
328    ('lobby:porcelain-doll
329     <cabinet-item> 'lobby
330     #:invisible? #t
331     #:name "a creepy porcelain doll"
332     #:desc "It strikes you that while the doll is technically well crafted,
333 it's also the stuff of nightmares."
334     #:goes-by '("porcelain doll" "doll"))
335    ('lobby:1950s-robots
336     <cabinet-item> 'lobby
337     #:invisible? #t
338     #:name "a set of 1950s robots"
339     #:desc "There's a whole set of these 1950s style robots.
340 They seem to be stamped out of tin, and have various decorations of levers
341 and buttons and springs.  Some of them have wind-up knobs on them."
342     #:goes-by '("robot" "robots" "1950s robot" "1950s robots"))
343    ('lobby:tea-set
344     <cabinet-item> 'lobby
345     #:invisible? #t
346     #:name "a tea set"
347     #:desc "A complete tea set.  Some of the cups are chipped.
348 You can imagine yourself joining a tea party using this set, around a
349 nice table with some doilies, drinking some Earl Grey tea, hot.  Mmmm."
350     #:goes-by '("tea set" "tea"))
351    ('lobby:cups
352     <cabinet-item> 'lobby
353     #:invisible? #t
354     #:name "cups from the tea set"
355     #:desc "They're chipped."
356     #:goes-by '("cups"))
357    ('lobby:mustard-pot
358     <cabinet-item> 'lobby
359     #:invisible? #t
360     #:name "a mustard pot"
361     #:desc '((p "It's a mustard pot.  I mean, it's kind of cool, it has a
362 nice design, and it's an antique, but you can't imagine putting something
363 like this in a museum.")
364              (p "Ha... imagine that... a mustard museum."))
365     #:goes-by '("mustard pot" "antique mustard pot" "mustard"))
366    ('lobby:head-of-elvis
367     <cabinet-item> 'lobby
368     #:invisible? #t
369     #:name "the pickled head of Elvis"
370     #:desc '((p "It's a jar full of some briny-looking liquid and...
371 a free floating head.  The head looks an awful lot like Elvis, and
372 definitely not the younger Elvis.  The hair even somehow maintains
373 that signature swoop while suspended in liquid.  But of course it's
374 not Elvis.")
375              (p "Oh, wait, it has a label at the bottom which says:
376 \"This is really the head of Elvis\".  Well... maybe don't believe
377 everything you read."))
378     #:goes-by '("pickled head of elvis" "pickled head of Elvis"
379                 "elvis" "Elvis" "head" "pickled head"))
380    ('lobby:circuitboard-of-evlis
381     <cabinet-item> 'lobby
382     #:invisible? #t
383     #:name "the pickled circuitboard of Evlis"
384     #:desc '((p "It's a circuitboard from a Lisp Machine called EVLIS.
385 This is quite the find, and you bet just about anyone interested in
386 preserving computer history would love to get their hands on this.")
387              (p "Unfortunately, whatever moron did acquire this has
388 no idea what it means to preserve computers, so here it is floating
389 in some kind of briny liquid.  It appears to be heavily corroded.
390 Too bad..."))
391     #:goes-by '("pickled circuitboard of evlis" "pickled circuitboard of Evlis"
392                 "pickled circuitboard of EVLIS"
393                 "evlis" "Evlis" "EVLIS" "circuitboard" "pickled circuitboard"))
394    ('lobby:teletype-scroll
395     <cabinet-item> 'lobby
396     #:invisible? #t
397     #:name "a scroll of teletype"
398     #:desc '((p "This is a scroll of teletype paper.  It's a bit old
399 and yellowed but the type is very legible.  It says:")
400              (br)
401              (i
402               (p (strong "== The four essential freedoms =="))
403               (p "A program is free software if the program's users have
404 the four essential freedoms: ")
405               (ul (li "The freedom to run the program as you wish, for any purpose (freedom 0).")
406                   (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.")
407                   (li "The freedom to redistribute copies so you can help your neighbor (freedom 2).")
408                   (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.")))
409              (p "You get this feeling that ambiguities in the
410 English language surrounding the word 'free' have lead to a lot of terminology debates."))
411     #:goes-by '("scroll of teletype" "scroll of teletype paper" "teletype scroll"
412                 "teletype paper" "scroll" "four freedoms"
413                 "scroll of teletype paper holding the software Four Freedoms"
414                 "scroll of teletype paper holding the software four freedoms"))
415    ('lobby:orange-cat-phone
416     <cabinet-item> 'lobby
417     #:invisible? #t
418     #:name "a telephone shaped like an orange cartoon cat"
419     #:desc "It's made out of a cheap plastic, and it's very orange.
420 It resembles a striped tabby, and it's eyes hold the emotion of
421 a being both sleepy and smarmy.
422 You suspect that someone, somewhere made a ton of cash on items holding
423 this general shape in the 1990s."
424     #:goes-by '("orange cartoon cat phone" "orange cartoon cat telephone"
425                 "orange cat phone" "orange cat telephone"
426                 "cartoon cat phone" "cartoon cat"
427                 "cat phone" "cat telephone" "phone" "telephone"))
428    ('lobby:monster-stuffie
429     <gameobj> 'lobby
430     #:name "an off-brand monster stuffie"
431     #:desc "It's an off brand monster stuffed animal that looks, well kinda
432 like a popular character you've seen in a video game, but there's been a very
433 thin attempt to make it look like something different... mostly by changing
434 the shape of the ears.  It's cute though!"
435     #:take-me? #t
436     #:goes-by '("monster stuffie" "monster" "stuffed animal" "stuffed monster"
437                 "off-brand monster stuffie" "stuffie" "monster stuffie"))))
438
439
440 \f
441 ;;; Grand hallway
442 ;;; -------------
443
444 (define-actor <disc-shield> (<gameobj>)
445   ((cmd-take disc-shield-take)))
446
447 (define* (disc-shield-take gameobj message
448                            #:key direct-obj
449                            (player (message-from message)))
450   (create-gameobj <glowing-disc> (gameobj-gm gameobj)
451                   player)  ;; set loc to player to put in player's inventory
452   (<- player 'tell
453       #:text '((p "As you attempt to pull the shield / disk platter
454 from the statue a shining outline appears around it... and a
455 completely separate, glowing copy of the disc materializes into your
456 hands!")))
457   (<- (gameobj-loc gameobj) 'tell-room
458         #:text `(,(mbody-val (<-wait player 'get-name))
459                  " pulls on the shield of the statue, and a glowing "
460                  "copy of it materializes into their hands!")
461         #:exclude player)
462   (<- (gameobj-loc gameobj) 'tell-room
463       #:text
464       '(p "You hear a voice whisper: "
465           (i "\"Share the software... and you'll be free...\""))))
466
467 ;;; This is the disc that gets put in the player's inventory
468 (define-actor <glowing-disc> (<gameobj>)
469   ((cmd-drop glowing-disc-drop-cmd))
470   (initial-props
471    #:allocation #:each-subclass
472    #:init-thunk (build-props
473                  '((hd-platter? . #t))))
474   (name #:allocation #:each-subclass
475         #:init-value "a glowing disc")
476   (desc #:allocation #:each-subclass
477         #:init-value "A brightly glowing disc.  It's shaped like a hard
478 drive platter, not unlike the one from the statue it came from.  It's
479 labeled \"RL02.5\".")
480   (goes-by #:init-value '("glowing disc" "glowing platter"
481                           "glowing disc platter" "glowing disk platter"
482                           "platter" "disc" "disk" "glowing shield")))
483
484 (define* (glowing-disc-drop-cmd gameobj message
485                    #:key direct-obj
486                    (player (message-from message)))
487   (<- player 'tell
488       #:text "You drop the glowing disc, and it shatters into a million pieces!")
489   (<- (mbody-val (<-wait player 'get-loc)) 'tell-room
490       #:text `(,(mbody-val (<-wait player 'get-name))
491                " drops a glowing disc, and it shatters into a million pieces!")
492       #:exclude player)
493   (gameobj-self-destruct gameobj))
494
495 \f
496 ;;; Grand hallway
497
498 (define lobby-map-text
499   "\
500
501                         .----+++++----.
502                         |  :       :  |
503                         +  : north :  +
504                         |  :  hall :  |
505                         +  :       :  +
506                         |_ : _____ : _|
507                         |  :       :  |
508   .----------.----------.  :   &   :  .----------.----------.
509   | computer |          |& :YOU ARE: &|  smoking | *UNDER*  |
510   | room     + playroom +  : HERE  :  +  parlor  | *CONS-   |
511   |    >     |          |& :       : &|          | TRUCTION*|
512   '----------'----------'-++-------++-'-------+--'----------'
513                        |    '-----'    |     |   |
514                        :     LOBBY     :     '---'
515                         '.           .'
516                           '---------'")
517
518 (define grand-hallway
519
520   (lol
521    ('grand-hallway
522     <room> #f
523     #:name "Grand Hallway"
524     #:desc '((p "  A majestic red carpet runs down the center of the room.
525 Busts of serious looking people line the walls, but there's no
526 clear indication that they have any logical relation to this place.")
527              (p "In the center is a large statue of a woman in a warrior's
528 pose, but something is strange about her weapon and shield.  You wonder what
529 that's all about?")
530              (p "To the south is the lobby.  A door to the east is labeled \"smoking
531 room\", while a door to the west is labeled \"playroom\"."))
532     #:exits
533     (list (make <exit>
534             #:name "north"
535             #:to 'north-hall)
536           (make <exit>
537             #:name "south"
538             #:to 'lobby)
539           (make <exit>
540             #:name "west"
541             #:to 'playroom)
542           (make <exit>
543             #:name "east"
544             #:to 'smoking-parlor)))
545    ('grand-hallway:map
546     <readable> 'grand-hallway
547     #:name "the hotel map"
548     #:desc '("This appears to be a map of the hotel. "
549              "Like the hotel itself, it seems to be "
550              "incomplete."
551              "You could read it if you want to.")
552     #:read-text `(pre ,lobby-map-text)
553     #:goes-by '("map" "hotel map"))
554    ('grand-hallway:carpet
555     <gameobj> 'grand-hallway
556     #:name "the Grand Hallway carpet"
557     #:desc "It's very red, except in the places where it's very worn."
558     #:invisible? #t
559     #:goes-by '("red carpet" "carpet"))
560    ('grand-hallway:busts
561     <gameobj> 'grand-hallway
562     #:name "the busts of serious people"
563     #:desc "There are about 6 of them in total.  They look distinguished
564 but there's no indication of who they are."
565     #:invisible? #t
566     #:goes-by '("busts" "bust" "busts of serious people" "bust of serious person"))
567    ('grand-hallway:hackthena-statue
568     <proxy-items> 'grand-hallway
569     #:name "the statue of Hackthena"
570     #:desc '((p "The base of the statue says \"Hackthena, guardian of the hacker
571 spirit\".  You've heard of Hackthena... not a goddess, but spiritual protector of
572 all good hacks, and legendary hacker herself.")
573              (p "Hackthena holds the form of a human woman.  She wears flowing
574 robes, has a pair of curly bovine-esque horns protruding from the sides of her
575 head, wears a pair of horn-rimmed glasses, and appears posed as if for battle.
576 But instead of a weapon, she seems to hold some sort of keyboard.  And her
577 shield... well it's round like a shield, but something seems off about it.
578 You'd better take a closer look to be sure."))
579     #:goes-by '("hackthena statue" "hackthena" "statue" "statue of hackthena")
580     #:proxy-items '(grand-hallway:keyboard
581                     grand-hallway:disc-platter
582                     grand-hallway:hackthena-horns))
583    ('grand-hallway:keyboard
584     <gameobj> 'grand-hallway
585     #:name "a Knight Keyboard"
586     #:desc "Whoa, this isn't just any old keyboard, this is a Knight Keyboard!
587 Any space cadet can see that with that kind of layout a hack-and-slayer could
588 thrash out some serious key-chords like there's no tomorrow.  You guess
589 Hackthena must be an emacs user."
590     #:invisible? #t
591     #:take-me? (lambda _
592                  (values #f
593                          #:why-not
594                          `("Are you kidding?  Do you know how hard it is to find "
595                               "a Knight Keyboard?  There's no way she's going "
596                               "to give that up.")))
597     #:goes-by '("knight keyboard" "keyboard"))
598    ('grand-hallway:hackthena-horns
599     <gameobj> 'grand-hallway
600     #:name "Hackthena's horns"
601     #:desc "They're not unlike a Gnu's horns."
602     #:invisible? #t
603     #:take-me? (lambda _
604                  (values #f
605                          #:why-not
606                          `("Are you seriously considering desecrating a statue?")))
607     #:goes-by '("hackthena's horns" "horns" "horns of hacktena"))
608    ('grand-hallway:disc-platter
609     <disc-shield> 'grand-hallway
610     #:name "Hackthena's shield"
611     #:desc "No wonder the \"shield\" looks unusual... it seems to be a hard disk
612 platter!  It has \"RL02.5\" written on it.  It looks kind of loose."
613     #:invisible? #t
614     #:goes-by '("hackthena's shield" "shield" "platter" "hard disk platter"))))
615
616 \f
617 ;;; Playroom
618 ;;; --------
619
620 (define-actor <rgb-machine> (<gameobj>)
621   ((cmd-run rgb-machine-cmd-run)
622    (cmd-reset rgb-machine-cmd-reset))
623   (commands
624    #:allocation #:each-subclass
625    #:init-thunk (build-commands
626                  (("run" "start") ((direct-command cmd-run)))
627                  ("reset" ((direct-command cmd-reset)))))
628   (resetting #:init-value #f
629              #:accessor .resetting)
630   ;; used to reset, and to kick off the first item in the list
631   (rgb-items #:init-keyword #:rgb-items
632              #:accessor .rgb-items))
633
634 (define (rgb-machine-cmd-run rgb-machine message . _)
635   (define player (message-from message))
636   (<-wait player 'tell
637           #:text '("You start the rube goldberg machine."))
638   (<-wait (gameobj-loc rgb-machine) 'tell-room
639           #:text `(,(mbody-val (<-wait player 'get-name))
640                    " runs the rube goldberg machine.")
641           #:exclude player)
642   (8sleep 1)
643   (match (.rgb-items rgb-machine)
644     ((first-item rest ...)
645      (<- (dyn-ref rgb-machine first-item) 'trigger))))
646
647 (define (rgb-machine-cmd-reset rgb-machine message . _)
648   (define player (message-from message))
649   (cond
650    ((not (.resetting rgb-machine))
651     (set! (.resetting rgb-machine) #t)
652     (<-wait player 'tell
653             #:text '("You reset the rube goldberg machine."))
654     (<-wait (gameobj-loc rgb-machine) 'tell-room
655             #:text `(,(mbody-val (<-wait player 'get-name))
656                      " resets the rube goldberg machine.")
657             #:exclude player)
658     (<-wait (gameobj-loc rgb-machine) 'tell-room
659             #:text '("From a panel in the wall, a white gloved mechanical "
660                      "arm reaches out to reset all the "
661                      "rube goldberg components."))
662     (8sleep (/ 1 2))
663     (for-each
664      (lambda (rgb-item)
665        (<- (dyn-ref rgb-machine rgb-item) 'reset)
666        (8sleep (/ 1 2)))
667      (.rgb-items rgb-machine))
668     (<- (gameobj-loc rgb-machine) 'tell-room
669         #:text "The machine's mechanical arm retreats into the wall!")
670     (set! (.resetting rgb-machine) #f))
671    (else
672     (<-wait player 'tell
673             #:text '("But it's in the middle of resetting right now!")))))
674
675 (define-actor <rgb-item> (<gameobj>)
676   ((trigger rgb-item-trigger)
677    (reset rgb-item-reset))
678   (invisible? #:init-value #t)
679   (steps #:init-keyword #:steps
680          #:accessor .steps)
681   (triggers-as #:init-value #f
682                #:init-keyword #:triggers-as
683                #:getter .triggers-as)
684   (reset-msg #:init-keyword #:reset-msg
685              #:getter .reset-msg)
686   ;; States: ready -> running -> ran
687   (state #:init-value 'ready
688          #:accessor .state))
689
690
691 (define (rgb-item-trigger rgb-item message . _)
692   (define room (gameobj-loc rgb-item))
693   (case (.state rgb-item)
694     ((ready)
695      ;; Set state to running
696      (set! (.state rgb-item) 'running)
697
698      ;; Loop through all steps
699      (for-each
700       (lambda (step)
701         (match step
702           ;; A string?  That's the description of what's happening, tell players
703           ((? string? str)
704            (<- room 'tell-room #:text str))
705           ;; A number?  Sleep for that many secs
706           ((? number? num)
707            (8sleep num))
708           ;; A symbol?  That's another gameobj to look up dynamically
709           ((? symbol? sym)
710            (<- (dyn-ref rgb-item sym) 'trigger
711                #:triggered-by (.triggers-as rgb-item)))
712           (_ (throw 'unknown-step-type
713                     "Don't know how to process rube goldberg machine step type?"
714                     #:step step))))
715       (.steps rgb-item))
716
717      ;; We're done! Set state to ran
718      (set! (.state rgb-item) 'ran))
719
720     (else
721      (<- room 'tell-room
722          #:text `("... but " ,(slot-ref rgb-item 'name)
723                   " has already been triggered!")))))
724
725 (define (rgb-item-reset rgb-item message . _)
726   (define room (gameobj-loc rgb-item))
727   (case (.state rgb-item)
728     ((ran)
729      (set! (.state rgb-item) 'ready)
730      (<- room 'tell-room
731          #:text (.reset-msg rgb-item)))
732     ((running)
733      (<- room 'tell-room
734          #:text `("... but " ,(slot-ref rgb-item 'name)
735                   " is currently running!")))
736     ((ready)
737      (<- room 'tell-room
738          #:text `("... but " ,(slot-ref rgb-item 'name)
739                   " has already been reset.")))))
740
741 (define-actor <rgb-kettle> (<rgb-item>)
742   ((trigger rgb-kettle-trigger)
743    (reset rgb-kettle-reset))
744   (heated #:accessor .heated
745           #:init-value #f)
746   (filled #:accessor .filled
747           #:init-value #f))
748
749 (define* (rgb-kettle-trigger rgb-item message #:key triggered-by)
750   (define room (gameobj-loc rgb-item))
751   (if (not (eq? (.state rgb-item) 'ran))
752       (begin
753         (match triggered-by
754           ('water-demon
755            (set! (.state rgb-item) 'running)
756            (set! (.filled rgb-item) #t))
757           ('quik-heater
758            (set! (.state rgb-item) 'running)
759            (set! (.heated rgb-item) #t)))
760         (when (and (.filled rgb-item)
761                    (.heated rgb-item))
762           (<- room 'tell-room
763               #:text '((i "*kshhhhhh!*")
764                        " The water has boiled!"))
765           (8sleep .25)
766           (set! (.state rgb-item) 'ran)
767           ;; insert a cup of hot tea in the room
768           (create-gameobj <hot-tea> (gameobj-gm rgb-item) room)
769           (<- room 'tell-room
770               #:text '("The machine pours out a cup of hot tea! "
771                        "Looks like the machine finished!"))))
772       (<- room 'tell-room
773          #:text `("... but " ,(slot-ref rgb-item 'name)
774                   " has already been triggered!"))))
775
776 (define (rgb-kettle-reset rgb-item message . rest-args)
777   (define room (gameobj-loc rgb-item))
778   (when (eq? (.state rgb-item) 'ran)
779     (set! (.heated rgb-item) #f)
780     (set! (.filled rgb-item) #f))
781   (apply rgb-item-reset rgb-item message rest-args))
782
783 (define-actor <tinfoil-hat> (<gameobj>)
784   ((cmd-wear tinfoil-hat-wear))
785   (contained-commands
786    #:allocation #:each-subclass
787    #:init-thunk (build-commands
788                  ("wear" ((direct-command cmd-wear))))))
789
790 (define (tinfoil-hat-wear tinfoil-hat message . _)
791   (<- (message-from message) 'tell
792       #:text '("You put on the tinfoil hat, and, to be perfectly honest with you "
793                "it's a lot harder to take you seriously.")))
794
795
796 (define-actor <hot-tea> (<gameobj>)
797   ((cmd-drink hot-tea-cmd-drink)
798    (cmd-sip hot-tea-cmd-sip))
799   (contained-commands
800    #:allocation #:each-subclass
801    #:init-thunk (build-commands
802                  ("drink" ((direct-command cmd-drink)))
803                  ("sip" ((direct-command cmd-sip)))))
804   
805   (sips-left #:init-value 4
806              #:accessor .sips-left)
807   (name #:init-value "a cup of hot tea")
808   (take-me? #:init-value #t)
809   (goes-by #:init-value '("cup of hot tea" "cup of tea" "tea" "cup"))
810   (desc #:init-value "It's a steaming cup of hot tea.  It looks pretty good!"))
811
812 (define (hot-tea-cmd-drink hot-tea message . _)
813   (define player (message-from message))
814   (define player-loc (mbody-val (<-wait player 'get-loc)))
815   (define player-name (mbody-val (<-wait player 'get-name)))
816   (<- player 'tell
817       #:text "You drink a steaming cup of hot tea all at once... hot hot hot!")
818   (<- player-loc 'tell-room
819       #:text `(,player-name
820                " drinks a steaming cup of hot tea all at once.")
821       #:exclude player)
822   (gameobj-self-destruct hot-tea))
823
824 (define (hot-tea-cmd-sip hot-tea message . _)
825   (define player (message-from message))
826   (define player-loc (mbody-val (<-wait player 'get-loc)))
827   (define player-name (mbody-val (<-wait player 'get-name)))
828   (set! (.sips-left hot-tea) (- (.sips-left hot-tea) 1))
829   (<- player 'tell
830       #:text "You take a sip of your steaming hot tea.  How refined!")
831   (<- player-loc 'tell-room
832       #:text `(,player-name
833                " takes a sip of their steaming hot tea.  How refined!")
834       #:exclude player)
835   (when (= (.sips-left hot-tea) 0)
836     (<- player 'tell
837         #:text "You've finished your tea!")
838     (<- player-loc 'tell-room
839         #:text `(,player-name
840                  " finishes their tea!")
841         #:exclude player)
842     (gameobj-self-destruct hot-tea)))
843
844 (define-actor <fanny-pack> (<container>)
845   ((cmd-take-from-while-wearing cmd-take-from)
846    (cmd-put-in-while-wearing cmd-put-in))
847   (contained-commands
848    #:allocation #:each-subclass
849    #:init-thunk
850    (build-commands
851     (("l" "look") ((direct-command cmd-look-at)))
852     ("take" ((prep-indir-command cmd-take-from-while-wearing
853                                  '("from" "out of"))))
854     ("put" ((prep-indir-command cmd-put-in-while-wearing
855                                 '("in" "inside" "into" "on")))))))
856
857 (define playroom
858   (lol
859    ('playroom
860     <room> #f
861     #:name "The Playroom"
862     #:desc '(p ("  There are toys scattered everywhere here.  It's really unclear
863 if this room is intended for children or child-like adults.")
864                ("  There are doors to both the east and the west."))
865     #:exits
866     (list (make <exit>
867             #:name "east"
868             #:to 'grand-hallway)
869           (make <exit>
870             #:name "west"
871             #:to 'computer-room)))
872    ('playroom:cubey
873     <gameobj> 'playroom
874     #:name "Cubey"
875     #:take-me? #t
876     #:desc "  It's a little foam cube with googly eyes on it.  So cute!")
877    ('playroom:cuddles-plushie
878     <gameobj> 'playroom
879     #:name "a Cuddles plushie"
880     #:goes-by '("plushie" "cuddles plushie" "cuddles")
881     #:take-me? #t
882     #:desc "  A warm and fuzzy cuddles plushie!  It's a cuddlefish!")
883
884    ('playroom:toy-chest
885     <container> 'playroom
886     #:name "a toy chest"
887     #:goes-by '("toy chest" "chest")
888     #:desc (lambda (toy-chest whos-looking)
889              (let ((contents (gameobj-occupants toy-chest)))
890                `((p "A brightly painted wooden chest.  The word \"TOYS\" is "
891                     "engraved on it.")
892                  (p "Inside you see:"
893                     ,(if (eq? contents '())
894                          " nothing!  It's empty!"
895                          `(ul ,(map (lambda (occupant)
896                                       `(li ,(mbody-val
897                                              (<-wait occupant 'get-name))))
898                                     (gameobj-occupants toy-chest))))))))
899     #:take-from-me? #t
900     #:put-in-me? #t)
901
902    ;; Things inside the toy chest
903    ('playroom:toy-chest:rubber-duck
904     <gameobj> 'playroom:toy-chest
905     #:name "a rubber duck"
906     #:goes-by '("rubber duck" "duck")
907     #:take-me? #t
908     #:desc "It's a yellow rubber duck with a bright orange beak.")
909
910    ('playroom:toy-chest:tinfoil-hat
911     <tinfoil-hat> 'playroom:toy-chest
912     #:name "a tinfoil hat"
913     #:goes-by '("tinfoil hat" "hat")
914     #:take-me? #t
915     #:desc "You'd have to be a crazy person to wear this thing!")
916
917    ('playroom:toy-chest:fanny-pack
918     <fanny-pack> 'playroom:toy-chest
919     #:name "a fanny pack"
920     #:goes-by '("fanny pack" "pack")
921     #:take-me? #t
922     #:desc
923     (lambda (toy-chest whos-looking)
924       (let ((contents (gameobj-occupants toy-chest)))
925         `((p "It's a leather fanny pack, so it's both tacky and kinda cool.")
926           (p "Inside you see:"
927              ,(if (eq? contents '())
928                   " nothing!  It's empty!"
929                   `(ul ,(map (lambda (occupant)
930                                `(li ,(mbody-val
931                                       (<-wait occupant 'get-name))))
932                              (gameobj-occupants toy-chest)))))))))
933
934    ;; Things inside the toy chest
935    ('playroom:toy-chest:fanny-pack:plastic-elephant
936     <gameobj> 'playroom:toy-chest:fanny-pack
937     #:name "a plastic elephant"
938     #:goes-by '("plastic elephant" "elephant")
939     #:take-me? #t
940     #:desc "It's a tiny little plastic elephant.  Small, but heartwarming.")
941
942    ('playroom:rgb-machine
943     <rgb-machine> 'playroom
944     #:name "a Rube Goldberg machine"
945     #:goes-by '("rube goldberg machine" "machine")
946     #:rgb-items '(playroom:rgb-dominoes
947                   playroom:rgb-switch-match
948                   playroom:rgb-candle
949                   playroom:rgb-catapult
950                   playroom:rgb-water-demon
951                   playroom:rgb-quik-heater
952                   playroom:rgb-kettle)
953     #:desc "It's one of those hilarious Rube Goldberg machines.
954 What could happen if you started it?")
955
956    ;; Dominoes topple
957    ('playroom:rgb-dominoes
958     <rgb-item> 'playroom
959     #:name "some dominoes"
960     #:goes-by '("dominoes" "some dominoes")
961     #:steps `("The dominoes topple down the line..."
962               1
963               "The last domino lands on a switch!"
964               1.5
965               playroom:rgb-switch-match)
966     #:reset-msg "The dominoes are placed back into position.")
967
968    ;; Which hit the switch and strike a match
969    ('playroom:rgb-switch-match
970     <rgb-item> 'playroom
971     #:name "a switch"
972     #:goes-by '("switch" "match")
973     #:steps `("The switch lights a match!"
974               ,(/ 2 3)
975               "The match lights a candle!"
976               1.5
977               playroom:rgb-candle)
978     #:reset-msg "A fresh match is installed and the switch is reset.")
979    ;; which lights a candle and burns a rope
980    ('playroom:rgb-candle
981     <rgb-item> 'playroom
982     #:name "a candle"
983     #:goes-by '("candle")
984     #:steps `("The candle burns..."
985               .3  ; oops!
986               "The candle is burning away a rope!"
987               2
988               "The rope snaps!"
989               .5
990               playroom:rgb-catapult)
991     #:reset-msg "A fresh candle is installed.")
992    ;; which catapults a rock
993    ('playroom:rgb-catapult
994     <rgb-item> 'playroom
995     #:name "a catapult"
996     #:goes-by '("catapult")
997     #:steps `("The snapped rope unleashes a catapult, which throws a rock!"
998               2
999               "The rock flies through a water demon, startling it!"
1000               .5
1001               playroom:rgb-water-demon
1002               2
1003               "The rock whacks into the quik-heater's on button!"
1004               .5
1005               playroom:rgb-quik-heater)
1006     #:reset-msg
1007     '("A fresh rope is attached to the catapult, which is pulled taught. "
1008       "A fresh rock is placed on the catapult."))
1009    ;; which both:
1010    ;;   '- panics the water demon
1011    ;;      '- which waters the kettle
1012    ('playroom:rgb-water-demon
1013     <rgb-item> 'playroom
1014     #:name "the water demon"
1015     #:triggers-as 'water-demon
1016     #:goes-by '("water demon" "demon")
1017     #:steps `("The water demon panics, and starts leaking water into the kettle below!"
1018               3
1019               "The kettle is filled!"
1020               playroom:rgb-kettle)
1021     #:reset-msg '("The water demon is scratched behind the ears and calms down."))
1022    ;;   '- bops the quik-heater button
1023    ;;      '- which heats the kettle
1024    ('playroom:rgb-quik-heater
1025     <rgb-item> 'playroom
1026     #:name "the quik heater"
1027     #:triggers-as 'quik-heater
1028     #:goes-by '("quik heater" "heater")
1029     #:steps `("The quik-heater heats up the kettle above it!"
1030               3
1031               "The kettle is heated up!"
1032               playroom:rgb-kettle)
1033     #:reset-msg '("The quik heater is turned off."))
1034    ;; Finally, the kettle
1035    ('playroom:rgb-kettle
1036     <rgb-kettle> 'playroom
1037     #:name "the kettle"
1038     #:goes-by '("kettle")
1039     #:reset-msg '("The kettle is emptied."))))
1040
1041
1042 \f
1043 ;;; Writing room
1044 ;;; ------------
1045
1046 \f
1047 ;;; Armory???
1048 ;;; ---------
1049
1050 ;; ... full of NURPH weapons?
1051
1052 \f
1053 ;;; Smoking parlor
1054 ;;; --------------
1055
1056 (define-class <furniture> (<gameobj>)
1057   (sit-phrase #:init-keyword #:sit-phrase)
1058   (sit-phrase-third-person #:init-keyword #:sit-phrase-third-person)
1059   (sit-name #:init-keyword #:sit-name)
1060
1061   (commands
1062    #:allocation #:each-subclass
1063    #:init-thunk (build-commands
1064                  ("sit" ((direct-command cmd-sit-furniture)))))
1065   (actions #:allocation #:each-subclass
1066            #:init-thunk (build-actions
1067                          (cmd-sit-furniture furniture-cmd-sit))))
1068
1069 (define* (furniture-cmd-sit actor message #:key direct-obj)
1070   (define player-name
1071     (mbody-val (<-wait (message-from message) 'get-name)))
1072   (<- (message-from message) 'tell
1073       #:text (format #f "You ~a ~a.\n"
1074                      (slot-ref actor 'sit-phrase)
1075                      (slot-ref actor 'sit-name)))
1076   (<- (slot-ref actor 'loc) 'tell-room
1077       #:text (format #f "~a ~a on ~a.\n"
1078                      player-name
1079                      (slot-ref actor 'sit-phrase-third-person)
1080                      (slot-ref actor 'sit-name))
1081       #:exclude (message-from message)))
1082
1083
1084 (define smoking-parlor
1085   (lol
1086    ('smoking-parlor
1087     <room> #f
1088     #:name "Smoking Parlor"
1089     #:desc
1090     '((p "This room looks quite posh.  There are huge comfy seats you can sit in
1091 if you like. Strangely, you see a large sign saying \"No Smoking\".  The owners must
1092 have installed this place and then changed their mind later.")
1093       (p "There's a door to the west leading back to the grand hallway, and
1094 a nondescript steel door to the south, leading apparently outside."))
1095     #:exits
1096     (list (make <exit>
1097             #:name "west"
1098             #:to 'grand-hallway)
1099           (make <exit>
1100             #:name "south"
1101             #:to 'break-room)))
1102    ('smoking-parlor:chair
1103     <furniture> 'smoking-parlor
1104     #:name "a comfy leather chair"
1105     #:desc "  That leather chair looks really comfy!"
1106     #:goes-by '("leather chair" "comfy leather chair" "chair" "comfy chair")
1107     #:sit-phrase "sink into"
1108     #:sit-phrase-third-person "sinks into"
1109     #:sit-name "the comfy leather chair")
1110    ('smoking-parlor:sofa
1111     <furniture> 'smoking-parlor
1112     #:name "a plush leather sofa"
1113     #:desc "  That leather chair looks really comfy!"
1114     #:goes-by '("leather sofa" "plush leather sofa" "sofa"
1115                 "leather couch" "plush leather couch" "couch")
1116     #:sit-phrase "sprawl out on"
1117     #:sit-phrase-third-person "sprawls out on into"
1118     #:sit-name "the plush leather couch")
1119    ('smoking-parlor:bar-stool
1120     <furniture> 'smoking-parlor
1121     #:name "a bar stool"
1122     #:desc "  Conveniently located near the bar!  Not the most comfortable
1123 seat in the room, though."
1124     #:goes-by '("stool" "bar stool" "seat")
1125     #:sit-phrase "hop on"
1126     #:sit-phrase-third-person "hops onto"
1127     #:sit-name "the bar stool")
1128    ('ford-prefect
1129     <chatty-npc> 'smoking-parlor
1130     #:name "Ford Prefect"
1131     #:desc "Just some guy, you know?"
1132     #:goes-by '("Ford Prefect" "ford prefect"
1133                 "frood" "prefect" "ford")
1134     #:catchphrases prefect-quotes)
1135
1136    ('smoking-parlor:no-smoking-sign
1137     <readable> 'smoking-parlor
1138     #:invisible? #t
1139     #:name "No Smoking Sign"
1140     #:desc "This sign says \"No Smoking\" in big, red letters.
1141 It has some bits of bubble gum stuck to it... yuck."
1142     #:goes-by '("no smoking sign" "sign")
1143     #:read-text "It says \"No Smoking\", just like you'd expect from
1144 a No Smoking sign.")
1145    ;; TODO: Cigar dispenser
1146    ))
1147
1148 \f
1149
1150 ;;; Breakroom
1151 ;;; ---------
1152
1153 (define-class <desk-clerk> (<gameobj>)
1154   ;; The desk clerk has three states:
1155   ;;  - on-duty: Arrived, and waiting for instructions (and losing patience
1156   ;;    gradually)
1157   ;;  - slacking: In the break room, probably smoking a cigarette
1158   ;;    or checking text messages
1159   (state #:init-value 'slacking)
1160   (commands #:allocation #:each-subclass
1161             #:init-thunk
1162             (build-commands
1163              (("talk" "chat") ((direct-command cmd-chat)))
1164              ("ask" ((direct-command cmd-ask-incomplete)
1165                      (prep-direct-command cmd-ask-about)))
1166              ("dismiss" ((direct-command cmd-dismiss)))))
1167   (patience #:init-value 0)
1168   (actions #:allocation #:each-subclass
1169            #:init-thunk (build-actions
1170                          (init clerk-act-init)
1171                          (cmd-chat clerk-cmd-chat)
1172                          (cmd-ask-incomplete clerk-cmd-ask-incomplete)
1173                          (cmd-ask-about clerk-cmd-ask)
1174                          (cmd-dismiss clerk-cmd-dismiss)
1175                          (update-loop clerk-act-update-loop)
1176                          (be-summoned clerk-act-be-summoned))))
1177
1178 (define (clerk-act-init clerk message . _)
1179   ;; call the gameobj main init method
1180   (gameobj-act-init clerk message)
1181   ;; start our main loop
1182   (<- (actor-id clerk) 'update-loop))
1183
1184 (define changing-name-text "Changing your name is easy!
1185 We have a clipboard here at the desk
1186 where you can make yourself known to other participants in the hotel
1187 if you sign it.  Try 'sign form as <your-name>', replacing
1188 <your-name>, obviously!")
1189
1190 (define phd-text
1191   "Ah... when I'm not here, I've got a PHD to finish.")
1192
1193 (define clerk-help-topics
1194   `(("changing name" . ,changing-name-text)
1195     ("sign-in form" . ,changing-name-text)
1196     ("form" . ,changing-name-text)
1197     ("common commands" .
1198      "Here are some useful commands you might like to try: chat,
1199 go, take, drop, say...")
1200     ("hotel" .
1201      "We hope you enjoy your stay at Hotel Bricabrac.  As you may see,
1202 our hotel emphasizes interesting experiences over rest and lodging.
1203 The origins of the hotel are... unclear... and it has recently come
1204 under new... 'management'.  But at Hotel Bricabrac we believe these
1205 aspects make the hotel into a fun and unique experience!  Please,
1206 feel free to walk around and explore.")
1207     ("physics paper" . ,phd-text)
1208     ("paper" . ,phd-text)
1209     ("proprietor" . "Oh, he's that frumpy looking fellow sitting over there.")))
1210
1211
1212 (define clerk-knows-about
1213   "'ask clerk about changing name', 'ask clerk about common commands', and 'ask clerk about the hotel'")
1214
1215 (define clerk-general-helpful-line
1216   (string-append
1217    "The clerk says, \"If you need help with anything, feel free to ask me about it.
1218 For example, 'ask clerk about changing name'. You can ask me about the following:
1219 " clerk-knows-about ".\"\n"))
1220
1221 (define clerk-slacking-complaints
1222   '("The pay here is absolutely lousy."
1223     "The owner here has no idea what they're doing."
1224     "Some times you just gotta step away, you know?"
1225     "You as exhausted as I am?"
1226     "Yeah well, this is just temporary.  I'm studying to be a high
1227 energy particle physicist.  But ya gotta pay the bills, especially
1228 with tuition at where it is..."))
1229
1230 (define* (clerk-cmd-chat clerk message #:key direct-obj)
1231   (match (slot-ref clerk 'state)
1232     ('on-duty
1233      (<- (message-from message) 'tell
1234          #:text clerk-general-helpful-line))
1235     ('slacking
1236      (<- (message-from message) 'tell
1237          #:text
1238          (string-append
1239           "The clerk says, \""
1240           (random-choice clerk-slacking-complaints)
1241           "\"\n")))))
1242
1243 (define (clerk-cmd-ask-incomplete clerk message . _)
1244   (<- (message-from message) 'tell
1245       #:text "The clerk says, \"Ask about what?\"\n"))
1246
1247 (define clerk-doesnt-know-text
1248   "The clerk apologizes and says she doesn't know about that topic.\n")
1249
1250 (define* (clerk-cmd-ask clerk message #:key indir-obj
1251                         #:allow-other-keys)
1252   (match (slot-ref clerk 'state)
1253     ('on-duty
1254      (match (assoc indir-obj clerk-help-topics)
1255        ((_ . info)
1256            (<- (message-from message) 'tell
1257                #:text
1258                (string-append "The clerk clears her throat and says:\n  \""
1259                               info
1260                               "\"\n")))
1261        (#f
1262         (<- (message-from message) 'tell
1263             #:text clerk-doesnt-know-text))))
1264     ('slacking
1265      (<- (message-from message) 'tell
1266          #:text "The clerk says, \"Sorry, I'm on my break.\"\n"))))
1267
1268 (define* (clerk-act-be-summoned clerk message #:key who-summoned)
1269   (match (slot-ref clerk 'state)
1270     ('on-duty
1271      (<- who-summoned 'tell
1272          #:text
1273          "The clerk tells you as politely as she can that she's already here,
1274 so there's no need to ring the bell.\n"))
1275     ('slacking
1276      (<- (gameobj-loc clerk) 'tell-room
1277          #:text
1278          "The clerk's ears perk up, she stamps out a cigarette, and she
1279 runs out of the room!\n")
1280      (gameobj-set-loc! clerk (dyn-ref clerk 'lobby))
1281      (slot-set! clerk 'patience 8)
1282      (slot-set! clerk 'state 'on-duty)
1283      (<- (gameobj-loc clerk) 'tell-room
1284          #:text
1285          (string-append
1286           "  Suddenly, a uniformed woman rushes into the room!  She's wearing a
1287 badge that says \"Desk Clerk\".
1288   \"Hello, yes,\" she says between breaths, \"welcome to Hotel Bricabrac!
1289 We look forward to your stay.  If you'd like help getting acclimated,
1290 feel free to ask me.  For example, 'ask clerk about changing name'.
1291 You can ask me about the following:
1292 " clerk-knows-about ".\"\n")))))
1293
1294 (define* (clerk-cmd-dismiss clerk message . _)
1295   (define player-name
1296     (mbody-val (<-wait (message-from message) 'get-name)))
1297   (match (slot-ref clerk 'state)
1298     ('on-duty
1299      (<- (gameobj-loc clerk) 'tell-room
1300          #:text
1301          (format #f "\"Thanks ~a!\" says the clerk. \"I have somewhere I need to be.\"
1302 The clerk leaves the room in a hurry.\n"
1303                  player-name)
1304          #:exclude (actor-id clerk))
1305      (gameobj-set-loc! clerk (dyn-ref clerk 'break-room))
1306      (slot-set! clerk 'state 'slacking)
1307      (<- (gameobj-loc clerk) 'tell-room
1308          #:text clerk-return-to-slacking-text
1309          #:exclude (actor-id clerk)))
1310     ('slacking
1311      (<- (message-from message) 'tell
1312          #:text "The clerk sternly asks you to not be so dismissive.\n"))))
1313
1314 (define clerk-slacking-texts
1315   '("The clerk takes a long drag on her cigarette.\n"
1316     "The clerk scrolls through text messages on her phone.\n"
1317     "The clerk coughs a few times.\n"
1318     "The clerk checks her watch and justifies a few more minutes outside.\n"
1319     "The clerk fumbles around for a lighter.\n"
1320     "The clerk sighs deeply and exhaustedly.\n"
1321     "The clerk fumbles around for a cigarette.\n"))
1322
1323 (define clerk-working-impatience-texts
1324   '("The clerk hums something, but you're not sure what it is."
1325     "The clerk attempts to change the overhead music, but the dial seems broken."
1326     "The clerk clicks around on the desk computer."
1327     "The clerk scribbles an equation on a memo pad, then crosses it out."
1328     "The clerk mutters something about the proprietor having no idea how to run a hotel."
1329     "The clerk thumbs through a printout of some physics paper."))
1330
1331 (define clerk-slack-excuse-text
1332   "The desk clerk excuses herself, but says you are welcome to ring the bell
1333 if you need further help.")
1334
1335 (define clerk-return-to-slacking-text
1336   "The desk clerk enters and slams the door behind her.\n")
1337
1338
1339 (define (clerk-act-update-loop clerk message)
1340   (define (tell-room text)
1341     (<- (gameobj-loc clerk) 'tell-room
1342         #:text text
1343         #:exclude (actor-id clerk)))
1344   (define (loop-if-not-destructed)
1345     (if (not (slot-ref clerk 'destructed))
1346         ;; This iterates by "recursing" on itself by calling itself
1347         ;; (as the message handler) again.  It used to be that we had to do
1348         ;; this, because there was a bug where a loop which yielded like this
1349         ;; would keep growing the stack due to some parameter goofiness.
1350         ;; That's no longer true, but there's an added advantage to this
1351         ;; route: it's much more live hackable.  If we change the definition
1352         ;; of this method, the character will act differently on the next
1353         ;; "tick" of the loop.
1354         (<- (actor-id clerk) 'update-loop)))
1355   (match (slot-ref clerk 'state)
1356     ('slacking
1357      (tell-room (random-choice clerk-slacking-texts))
1358      (8sleep (+ (random 20) 15))
1359      (loop-if-not-destructed))
1360     ('on-duty
1361      (if (> (slot-ref clerk 'patience) 0)
1362          ;; Keep working but lose patience gradually
1363          (begin
1364            (tell-room (random-choice clerk-working-impatience-texts))
1365            (slot-set! clerk 'patience (- (slot-ref clerk 'patience)
1366                                          (+ (random 2) 1)))
1367            (8sleep (+ (random 60) 40))
1368            (loop-if-not-destructed))
1369          ;; Back to slacking
1370          (begin
1371            (tell-room clerk-slack-excuse-text)
1372            ;; back bto the break room
1373            (gameobj-set-loc! clerk (dyn-ref clerk 'break-room))
1374            (tell-room clerk-return-to-slacking-text)
1375            ;; annnnnd back to slacking
1376            (slot-set! clerk 'state 'slacking)
1377            (8sleep (+ (random 30) 15))
1378            (loop-if-not-destructed))))))
1379
1380
1381 (define break-room
1382   (lol
1383    ('break-room
1384     <room> #f
1385     #:name "Employee Break Room"
1386     #:desc "  This is less a room and more of an outdoor wire cage.  You get
1387 a bit of a view of the brick exterior of the building, and a crisp wind blows,
1388 whistling, through the openings of the fenced area.  Partly smoked cigarettes
1389 and various other debris cover the floor.
1390   Through the wires you can see... well... hm.  It looks oddly like
1391 the scenery tapers off nothingness.  But that can't be right, can it?"
1392     #:exits
1393     (list (make <exit>
1394             #:name "north"
1395             #:to 'smoking-parlor)))
1396    ('break-room:desk-clerk
1397     <desk-clerk> 'break-room
1398     #:name "the hotel desk clerk"
1399     #:desc "  The hotel clerk is wearing a neatly pressed uniform bearing the
1400 hotel insignia.  She appears to be rather exhausted."
1401     #:goes-by '("hotel desk clerk" "clerk" "desk clerk"))
1402    ('break-room:void
1403     <gameobj> 'break-room
1404     #:invisible? #t
1405     #:name "The Void"
1406     #:desc "As you stare into the void, the void stares back into you."
1407     #:goes-by '("void" "abyss" "nothingness" "scenery"))
1408    ('break-room:fence
1409     <gameobj> 'break-room
1410     #:invisible? #t
1411     #:name "break room cage"
1412     #:desc "It's a mostly-cubical wire mesh surrounding the break area.
1413 You can see through the gaps, but they're too small to put more than a
1414 couple of fingers through.  There appears to be some wear and tear to
1415 the paint, but the wires themselves seem to be unusually sturdy."
1416     #:goes-by '("fence" "cage" "wire cage"))))
1417
1418
1419 \f
1420 ;;; Ennpie's Sea Lounge
1421 ;;; -------------------
1422
1423 \f
1424 ;;; Computer room
1425 ;;; -------------
1426
1427 ;; Our computer and hard drive are based off the PDP-11 and the RL01 /
1428 ;; RL02 disk drives.  However we increment both by .5 (a true heresy)
1429 ;; to distinguish both from the real thing.
1430
1431 (define-actor <hard-drive> (<gameobj>)
1432   ((cmd-put-in hard-drive-insert)
1433    (cmd-push-button hard-drive-push-button)
1434    (get-state hard-drive-act-get-state))
1435   (commands #:allocation #:each-subclass
1436             #:init-thunk (build-commands
1437                           ("insert" ((prep-indir-command cmd-put-in
1438                                                          '("in" "inside" "into"))))
1439                           (("press" "push") ((prep-indir-command cmd-push-button)))))
1440   ;; the state moves from: empty -> with-disc -> loading -> ready
1441   (state #:init-value 'empty
1442          #:accessor .state))
1443
1444 (define (hard-drive-act-get-state hard-drive message)
1445   (<-reply message (.state hard-drive)))
1446
1447 (define* (hard-drive-desc hard-drive #:optional whos-looking)
1448   `((p "The hard drive is labeled \"RL02.5\".  It's a little under a meter tall.")
1449     (p "There is a slot where a disk platter could be inserted, "
1450        ,(if (eq? (.state hard-drive) 'empty)
1451             "which is currently empty"
1452             "which contains a glowing platter")
1453        ". There is a LOAD button "
1454        ,(if (member (.state hard-drive) '(empty with-disc))
1455             "which is glowing"
1456             "which is pressed in and unlit")
1457        ". There is a READY indicator "
1458        ,(if (eq? (.state hard-drive) 'ready)
1459             "which is glowing."
1460             "which is unlit.")
1461        ,(if (member (.state hard-drive) '(loading ready))
1462             "  The machine emits a gentle whirring noise."
1463             ""))))
1464
1465 (define* (hard-drive-push-button gameobj message
1466                                  #:key direct-obj indir-obj preposition
1467                                  (player (message-from message)))
1468   (define (tell-room text)
1469     (<-wait (gameobj-loc gameobj) 'tell-room
1470             #:text text))
1471   (define (tell-room-excluding-player text)
1472     (<-wait (gameobj-loc gameobj) 'tell-room
1473             #:text text
1474             #:exclude player))
1475   (cond
1476    ((ci-member direct-obj '("button" "load button" "load"))
1477     (tell-room-excluding-player
1478      `(,(mbody-val (<-wait player 'get-name))
1479        " presses the button on the hard disk."))
1480     (<- player 'tell
1481         #:text "You press the button on the hard disk.")
1482
1483     (case (.state gameobj)
1484       ((empty)
1485        ;; I have no idea what this drive did when you didn't have a platter
1486        ;; in it and pressed load, but I know there was a FAULT button.
1487        (tell-room "You hear some movement inside the hard drive...")
1488        (8sleep 1.5)
1489        (tell-room
1490         '("... but then the FAULT button blinks a couple times. "
1491           "What could be missing?")))
1492       ((with-disc)
1493        (set! (.state gameobj) 'loading)
1494        (tell-room "The hard disk begins to spin up!")
1495        (8sleep 2)
1496        (set! (.state gameobj) 'ready)
1497        (tell-room "The READY light turns on!"))
1498       ((loading ready)
1499        (<- player 'tell
1500            #:text '("Pressing the button does nothing right now, "
1501                     "but it does feel satisfying.")))))
1502    (else
1503     (<- player 'tell
1504         #:text '("How could you think of pressing anything else "
1505                  "but that tantalizing button right in front of you?")))))
1506
1507 (define* (hard-drive-insert gameobj message
1508                             #:key direct-obj indir-obj preposition
1509                             (player (message-from message)))
1510   (define our-name (slot-ref gameobj 'name))
1511   (define this-thing
1512     (call/ec
1513      (lambda (return)
1514        (for-each (lambda (occupant)
1515                    (define goes-by (mbody-val (<-wait occupant 'goes-by)))
1516                    (when (ci-member direct-obj goes-by)
1517                      (return occupant)))
1518                  (mbody-val (<-wait player 'get-occupants)))
1519        ;; nothing found
1520        #f)))
1521   (cond
1522    ((not this-thing)
1523     (<- player 'tell
1524         #:text `("You don't seem to have any such " ,direct-obj " to put "
1525                  ,preposition " " ,our-name ".")))
1526    ((not (mbody-val (<-wait this-thing 'get-prop 'hd-platter?)))
1527     (<- player 'tell
1528         #:text `("It wouldn't make sense to put "
1529                  ,(mbody-val (<-wait this-thing 'get-name))
1530                  " " ,preposition " " ,our-name ".")))
1531    ((not (eq? (.state gameobj) 'empty))
1532     (<- player 'tell
1533         #:text "The disk drive already has a platter in it."))
1534    (else
1535     (set! (.state gameobj) 'with-disc)
1536     (<- player 'tell
1537         #:text '((p "You insert the glowing disc into the drive.")
1538                  (p "The LOAD button begins to glow."))))))
1539
1540 ;; The computar
1541 (define-actor <computer> (<gameobj>)
1542   ((cmd-run-program computer-run-program)
1543    (cmd-run-what (lambda (gameobj message . _)
1544                    (<- (message-from message) 'tell
1545                        #:text '("The computer is already running, and a program appears "
1546                                 "ready to run."
1547                                 "you mean to \"run the program on the computer\""))))
1548    (cmd-help-run-not-press
1549     (lambda (gameobj message . _)
1550       (<- (message-from message) 'tell
1551           #:text '("You don't need to press / push / flip anything. "
1552                    "You could " (i "run program on computer")
1553                    " already if you wanted to.")))))
1554   (commands #:allocation #:each-subclass
1555             #:init-thunk (build-commands
1556                           ("run" ((prep-indir-command cmd-run-program
1557                                                       '("on"))
1558                                   (direct-command cmd-run-what)))
1559                           (("press" "push" "flip")
1560                            ((prep-indir-command cmd-help-run-not-press))))))
1561
1562 (define* (computer-run-program gameobj message
1563                                #:key direct-obj indir-obj preposition
1564                                (player (message-from message)))
1565   (define (hd-state)
1566     (mbody-val (<-wait (dyn-ref gameobj 'computer-room:hard-drive) 'get-state)))
1567   (define (tell-room text)
1568     (<-wait (gameobj-loc gameobj) 'tell-room
1569         #:text text))
1570   (define (tell-room-excluding-player text)
1571     (<-wait (gameobj-loc gameobj) 'tell-room
1572             #:text text
1573             #:exclude player))
1574   (define (tell-player text)
1575     (<-wait player 'tell
1576             #:text text))
1577   (cond
1578    ((ci-member direct-obj '("program"))
1579     (tell-room-excluding-player
1580      `(,(mbody-val (<-wait player 'get-name))
1581        " runs the program loaded on the computer..."))
1582     (tell-player "You run the program on the computer...")
1583
1584     (cond
1585      ((not (eq? (hd-state) 'ready))
1586       (tell-room '("... but it errors out. "
1587                    "It seems to be complaining about a " (b "DISK ERROR!")
1588                    ". It looks like it is missing some essential software.")))
1589      (else
1590       (<- (dyn-ref gameobj 'computer-room:floor-panel) 'open-up))))))
1591
1592
1593 ;; floor panel
1594 (define-actor <floor-panel> (<gameobj>)
1595   ;; TODO: Add "open" verb, since obviously people will try that
1596   ((open? (lambda (panel message)
1597             (<-reply message (slot-ref panel 'open))))
1598    (open-up floor-panel-open-up))
1599   (open #:init-value #f))
1600
1601 (define (floor-panel-open-up panel message)
1602   (if (slot-ref panel 'open)
1603       (<- (gameobj-loc panel) 'tell-room
1604           #:text '("You hear some gears grind around the hinges of the "
1605                    "floor panel, but it appears to already be open."))
1606       (begin
1607         (slot-set! panel 'open #t)
1608         (<- (gameobj-loc panel) 'tell-room
1609             #:text '("You hear some gears grind, as the metal panel on "
1610                      "the ground opens and reveals a stairwell going down!")))))
1611
1612 (define* (floor-panel-desc panel #:optional whos-looking)
1613   `("It's a large metal panel on the floor in the middle of the room. "
1614     ,(if (slot-ref panel 'open)
1615          '("It's currently wide open, revealing a spiraling staircase "
1616            "which descends into darkness.")
1617          '("It's currently closed shut, but there are clearly hinges, and "
1618            "it seems like there is a mechanism which probably opens it via "
1619            "some automation.  What could be down there?"))))
1620
1621 (define computer-room
1622   (lol
1623    ('computer-room
1624     <room> #f
1625     #:name "Computer Room"
1626     #:desc (lambda (gameobj whos-looking)
1627              (define panel-open
1628                (mbody-val (<-wait (dyn-ref gameobj 'computer-room:floor-panel)
1629                                   'open?)))
1630              `((p "A sizable computer cabinet covers a good portion of the left
1631  wall.  It emits a pleasant hum which covers the room like a warm blanket.
1632  Connected to a computer is a large hard drive.")
1633                (p "On the floor is a large steel panel.  "
1634                   ,(if panel-open
1635                        '("It is wide open, exposing a spiral staircase "
1636                          "which descends into darkness.")
1637                        '("It is closed, but it has hinges which "
1638                          "suggest it could be opened.")))))
1639     #:exits
1640     (list (make <exit>
1641             #:name "east"
1642             #:to 'playroom)
1643           (make <exit>
1644             #:name "down"
1645             #:to 'underground-lab
1646             #:traverse-check
1647             (lambda (exit room whos-exiting)
1648               (define panel-open
1649                 (mbody-val (<-wait (dyn-ref room 'computer-room:floor-panel)
1650                                    'open?)))
1651               (if panel-open
1652                   (values #t "You descend the spiral staircase.")
1653                   (values #f '("You'd love to go down, but the only way "
1654                                "through is through that metal panel, "
1655                                "which seems closed.")))))))
1656    ('computer-room:hard-drive
1657     <hard-drive> 'computer-room
1658     #:name "the hard drive"
1659     #:desc (wrap-apply hard-drive-desc)
1660     #:goes-by '("hard drive" "drive" "hard disk"))
1661    ('computer-room:computer
1662     <computer> 'computer-room
1663     #:name "the computer"
1664     #:desc '((p "It's a coat closet sized computer labeled \"PDP-11.5\". ")
1665              (p "The computer is itself turned on, and it looks like it is "
1666                 "all set up for you to run a program on it."))
1667     #:goes-by '("computer"))
1668    ('computer-room:floor-panel
1669     <floor-panel> 'computer-room
1670     #:name "a floor panel"
1671     #:desc (wrap-apply floor-panel-desc)
1672     #:invisible? #t
1673     #:goes-by '("floor panel" "panel"))))
1674
1675 \f
1676 ;;; * UNDERGROUND SECTION OF THE GAME! *
1677
1678 \f
1679 ;;; The lab
1680
1681 (define underground-map-text
1682   "\
1683                             _______           |
1684                          .-' @     '-.         \\   ?????
1685                        .'             '.       .\\             
1686                        |  [8sync Hive] |======'  '-_____
1687                        ',      M      ,'
1688                         '.         @ .'                                  
1689                           \\   @     /                    
1690                            '-__+__-'                
1691                             '.  @ .'
1692      .--------------.         \\ /
1693      | [Guile Async |  .-------+------.
1694      |    Museum]   |  |     [Lab] #!#|  .-------------.
1695      |             @|  |  MM          |  |[Federation  |
1696      | &      ^     +##+@ ||     <    +##|     Station]|
1697      |              |  |           @  |  |             |
1698      |         &  # |  |*You-Are-Here*|  '-------------'
1699      | #   ^        | #+-------+------'
1700      '-------+------' #        #
1701              #        #        #
1702              #        #   .-----------.
1703            .-+----.   #   |#       F  |
1704            |@?+%? +####   | ^   f##   |
1705            '------'       |  f    f  %|
1706                           |F [Mudsync |
1707                           | $  Swamp] |
1708                           '-----------'")
1709
1710 (define 8sync-design-goals
1711   '(ul (li (b "Actor based, shared nothing environment: ")
1712            "Shared resources are hard to control and result in fighting
1713 deadlocks, etc.  Escape the drudgery: only one actor controls a resource,
1714 and they only receive one message at a time (though they can \"juggle\"
1715 messages).")
1716        (li (b "Live hackable: ")
1717            "It's hard to plan out a concurrent system; the right structure
1718 is often found by evolving the system while it runs.  Make it easy to
1719 build, shape, and change a running system, as well as observe and correct
1720 errors.")
1721        (li (b "No callback hell: ")
1722            "Just because you're calling out to some other asynchronous 
1723 code doesn't mean you should need to chop up your program into a bunch of bits.
1724 Clever use of delimited continuations makes it easy.")))
1725
1726 (define underground-lab
1727   (lol
1728    ('underground-lab
1729     <room> #f
1730     #:name "Underground laboratory"
1731     #:desc '((p "This appears to be some sort of underground laboratory."
1732                 "There is a spiral staircase here leading upwards, where "
1733                 "it seems much brighter.")
1734              (p "There are a number of doors leading in different directions:
1735 north, south, east, and west, as well as a revolving door to the southwest.
1736 It looks like it could be easy to get lost, but luckily there
1737 is a map detailing the layout of the underground structure."))
1738     #:exits
1739     (list (make <exit>
1740             #:name "up"
1741             #:to 'computer-room
1742             #:traverse-check
1743             (lambda (exit room whos-exiting)
1744               (values #t "You climb the spiral staircase.")))
1745           (make <exit>
1746             #:name "west"
1747             #:to 'async-museum
1748             #:traverse-check
1749             (lambda (exit room whos-exiting)
1750               (values #t '("You head west through a fancy-looking entrance. "
1751                            "A security guard steps aside for you to pass through, "
1752                            "into the room, then stands in front of the door."))))
1753           (make <exit>
1754             #:name "north"
1755             #:to 'hive-entrance)
1756           (make <exit>
1757             #:name "east"
1758             #:to 'federation-station)
1759           (make <exit>
1760             #:name "south"
1761             #:traverse-check
1762             (lambda (exit room whos-exiting)
1763               (values #f '("Ooh, if only you could go south and check this out! "
1764                            "Unfortunately this whole area is sealed off... the proprietor "
1765                            "probably never got around to fixing it. "
1766                            "Too bad, it would have had monsters to fight and everything!"))))
1767           (make <exit>
1768             #:name "southwest"
1769             #:traverse-check
1770             (lambda (exit room whos-exiting)
1771               (values #f '("Hm, it's one of those revolving doors that only revolves in "
1772                            "one direction, and it isn't this one.  You guess that while "
1773                            "this doesn't appear to be an entrance, it probably is an exit."))))))
1774    ;; map
1775    ('underground-lab:map
1776     <readable> 'underground-lab
1777     #:name "the underground map"
1778     #:desc '("This appears to be a map of the surrounding area. "
1779              "You could read it if you want to.")
1780     #:read-text `(pre ,underground-map-text)
1781     #:goes-by '("map" "underground map" "lab map"))
1782
1783    ('underground-lab:8sync-sign
1784     <readable> 'underground-lab
1785     #:name "a sign labeled \"8sync design goals\""
1786     #:goes-by '("sign" "8sync design goals sign" "8sync goals" "8sync design" "8sync sign")
1787     #:read-text 8sync-design-goals
1788     #:desc `((p "The sign says:")
1789              ,8sync-design-goals))))
1790
1791 \f
1792 ;;; guile async museum
1793
1794 (define async-museum
1795   (list
1796    (list
1797     'async-museum
1798     <room> #f
1799     #:name "Guile Asynchronous Museum"
1800     #:desc '((p "You're in the Guile Asynchronous Museum.  There is a list of exhibits
1801 on the wall near the entrance.  Scattered around the room are the exhibits
1802 themselves, but it's difficult to pick them out.  Maybe you should read the list
1803 to orient yourself.")
1804              (p "There is a door to the east, watched by a security guard,
1805 as well as an exit leading to the south."))
1806     #:exits (list
1807              (make <exit>
1808                #:name "south"
1809                #:to 'gift-shop)
1810              (make <exit>
1811                #:name "east"
1812                #:to 'underground-lab
1813                #:traverse-check
1814                (lambda (exit room whos-exiting)
1815                  (values #f '("The security guard stops you and tells you "
1816                               "that the only exit is through the gift shop."))))))
1817    (list
1818     'async-museum:security-guard
1819     <chatty-npc> 'async-museum
1820     #:name "a security guard"
1821     #:desc
1822     '(p "The security guard is blocking the eastern entrance, where "
1823         "you came in from.")
1824     #:goes-by '("security guard" "guard" "security")
1825     #:catchphrases '("It's hard standing here all day."
1826                      "I just want to go home."
1827                      "The exhibits are nice, but I've seen them all before."))
1828    (let ((placard
1829           `((p "Welcome to our humble museum!  The exhibits are listed below. "
1830                (br)
1831                "To look at one, simply type: " (i "look at <exhibit-name>"))
1832             (p "Available exhibits:")
1833             (ul ,@(map (lambda (exhibit)
1834                          `(li ,exhibit))
1835                        '("2016 Progress"
1836                          "8sync and Fibers"
1837                          "Suspendable Ports"
1838                          "The Actor Model"))))))
1839      (list
1840       'async-museum:list-of-exhibits
1841       <readable> 'async-museum
1842       #:name "list of exhibits"
1843       #:desc
1844       `((p "It's a list of exibits in the room.  The placard says:")
1845         ,@placard)
1846       #:goes-by '("list of exhibits" "exhibit list" "list" "exhibits")
1847       #:read-text placard))
1848    (list
1849     'async-museum:2016-progress-exhibit
1850     <readable-desc> 'async-museum
1851     #:name "2016 Progress Exhibit"
1852     #:goes-by '("2016 progress exhibit" "2016 progress" "2016 exhibit")
1853     #:desc
1854     '((p "It's a three-piece exhibit, with three little dioramas and some text "
1855          "explaining what they represent.  They are:")
1856       (ul (li (b "Late 2015/Early 2016 talk: ")
1857               "This one explains the run-up conversation from late 2015 "
1858               "and early 2016 about the need for an "
1859               "\"asynchronous event loop for Guile\".  The diorama "
1860               "is a model of the Veggie Galaxy restaurant where after "
1861               "the FSF 30th anniversary party; Mark Weaver, Christine "
1862               "Lemmer-Webber, David Thompson, and Andrew Engelbrecht chat "
1863               "about the need for Guile to have an answer to asynchronous "
1864               "programming.  A mailing list post " ; TODO: link it?
1865               "summarizing the discussion is released along with various "
1866               "conversations around what is needed, as well as further "
1867               "discussion at FOSDEM 2016.")
1868           (li (b "Early implementations: ")
1869               "This one shows Chris Webber's 8sync and Chris Vine's "
1870               "guile-a-sync, both appearing in late 2015 and evolving "
1871               "into their basic designs in early 2016.  It's less a diorama "
1872               "than a printout of some mailing list posts.  Come on, the "
1873               "curators could have done better with this one.")
1874           (li (b "Suspendable ports and Fibers: ")
1875               "The diorama shows Andy Wingo furiously hacking at his keyboard. "
1876               "The description talks about Wingo's mailing list thread "
1877               "about possibly breaking Guile compatibility for a \"ports refactor\". "
1878               "Wingo releases Fibers, another asynchronous library, making use of "
1879               "the new interface, and 8sync and guile-a-sync "
1880               "quickly move to support suspendable ports as well. "
1881               "The description also mentions that there is an exhibit entirely "
1882               "devoted to suspendable ports."))
1883       (p "Attached at the bottom is a post it note mentioning "
1884          "https integration landing in Guile 2.2.")))
1885    (list
1886     'async-museum:8sync-and-fibers-exhibit
1887     <readable-desc> 'async-museum
1888     #:name "8sync and Fibers Exhibit"
1889     #:goes-by '("8sync and fibers exhibit" "8sync exhibit" "fibers exhibit")
1890     #:desc
1891     '((p "This exhibit is a series of charts explaining the similarities "
1892          "and differences between 8sync and Fibers, two asynchronous programming "
1893          "libraries for GNU Guile.  It's way too wordy, but you get the general gist.")
1894       (p (b "Similarities:")
1895          (ul (li "Both use Guile's suspendable-ports facility")
1896              (li "Both use message passing")))
1897       (p (b "Differences:")
1898          (ul (li "Fibers \"processes\" can read from multiple \"channels\", "
1899                  "but 8sync actors only read from one \"inbox\" each.")
1900              (li "Different theoretical basis:"
1901                  (ul (li "Fibers: based on CSP (Communicating Sequential Processes), "
1902                          "a form of Process Calculi")
1903                      (li "8sync: based on the Actor Model")
1904                      (li "Luckily CSP and the Actor Model are \"dual\"!")))))
1905       (p "Fibers is also designed by Andy Wingo, an excellent compiler hacker, "
1906          "whereas 8sync is designed by Chris Webber, who built this crappy "
1907          "hotel simulator.")))
1908    (list
1909     'async-museum:8sync-and-fibers-exhibit
1910     <readable-desc> 'async-museum
1911     #:name "8sync and Fibers Exhibit"
1912     #:goes-by '("8sync and fibers exhibit" "8sync exhibit" "fibers exhibit")
1913     #:desc
1914     '((p "This exhibit is a series of charts explaining the similarities "
1915          "and differences between 8sync and Fibers, two asynchronous programming "
1916          "libraries for GNU Guile.  It's way too wordy, but you get the general gist.")
1917       (p (b "Similarities:")
1918          (ul (li "Both use Guile's suspendable-ports facility")
1919              (li "Both use message passing")))
1920       (p (b "Differences:")
1921          (ul (li "Fibers \"processes\" can read from multiple \"channels\", "
1922                  "but 8sync actors only read from one \"inbox\" each.")
1923              (li "Different theoretical basis:"
1924                  (ul (li "Fibers: based on CSP (Communicating Sequential Processes), "
1925                          "a form of Process Calculi")
1926                      (li "8sync: based on the Actor Model")
1927                      (li "Luckily CSP and the Actor Model are \"dual\"!")))))
1928       (p "Fibers is also designed by Andy Wingo, an excellent compiler hacker, "
1929          "whereas 8sync is designed by Chris Webber, who built this crappy "
1930          "hotel simulator.")))
1931    (list
1932     'async-museum:suspendable-ports-exhibit
1933     <readable-desc> 'async-museum
1934     #:name "Suspendable Ports Exhibit"
1935     #:goes-by '("suspendable ports exhibit" "ports exhibit"
1936                 "suspendable exhibit" "suspendable ports" "ports")
1937     #:desc
1938     '((p "Suspendable ports are a new feature in Guile 2.2, and allows code "
1939          "that would normally block on IO to " (i "automatically") " suspend "
1940          "to the scheduler until information is ready to be read/written!")
1941       (p "Yow!  You might barely need to change your existing blocking code!")
1942       (p "Fibers, 8sync, and guile-a-sync now support suspendable ports.")))
1943    (list
1944     'async-museum:actor-model-exhibit
1945     <readable-desc> 'async-museum
1946     #:name "Actor Model Exhibit"
1947     #:goes-by '("actor model exhibit" "actor exhibit"
1948                 "actor model")
1949     #:desc
1950     '((p "Here are some fact(oids) about the actor model!")
1951       (ul (li "Concieved initially by Carl Hewitt in early 1970s")
1952           (li "\"A society of experts\"")
1953           (li "shared nothing, message passing")
1954           (li "Originally the research goal of Scheme!  "
1955               "(message passing / lambda anecdote here)")
1956           (li "Key concepts consistent, but implementation details vary widely")
1957           (li "Almost all distributed systems can be viewed in terms of actor model")
1958           (li "Replaced by vanilla lambdas & generic methods? "
1959               "Maybe not if address space not shared!"))))))
1960
1961 (define gift-shop
1962   (lol
1963    ('gift-shop
1964     <room> #f
1965     #:name "Museum Gift Shop"
1966     #:desc '("There are all sorts of scrolls and knicknacks laying around here, "
1967              "but they all seem glued in place and instead of a person manning the shop "
1968              "there's merely a cardboard cutout of a person with a \"shopkeeper\" nametag. "
1969              "You can pretty well bet that someone wanted to finish this room but ran out of "
1970              "time. "
1971              "It looks like there's an exit to the northeast, should you choose that you "
1972              "want to get out of here.")
1973     #:exits (list
1974              (make <exit>
1975                #:name "northeast"
1976                #:to 'underground-lab
1977                #:traverse-check
1978                (lambda (exit room whos-exiting)
1979                  (values #t '("The revolving door spins as you walk through it.  Whee!"))))
1980              (make <exit>
1981                #:name "north"
1982                #:to 'async-museum)))))
1983
1984 \f
1985 ;;; Hive entrance
1986
1987 (define actor-descriptions
1988   '("This one is fused to the side of the hive.  It isn't receiving any
1989 messages, and it seems to be in hibernation."
1990     "A chat program glows in front of this actor's face.  They seem to
1991 be responding to chat messages and forwarding them to some other actors,
1992 and forwarding messages from other actors back to the chat."
1993     "This actor is bossing around other actors, delegating tasks to them
1994 as it receives requests, and providing reports on the worker actors'
1995 progress."
1996     "This actor is trying to write to some device, but the device keeps
1997 alternating between saying \"BUSY\" or \"READY\".  Whenever it says
1998 \"BUSY\" the actor falls asleep, and whenever it says \"READY\" it
1999 seems to wake up again and starts writing to the device."
2000     "Whoa, this actor is totally wigging out!  It seems to be throwing
2001 some errors.  It probably has some important work it should be doing
2002 but you're relieved to see that it isn't grinding the rest of the Hive
2003 to a halt."))
2004
2005 (define hive-entrance
2006   (lol
2007    ('hive-entrance
2008     <room> #f
2009     #:name "Entrance to the 8sync Hive"
2010     #:desc
2011     '((p "Towering before you is the great dome-like 8sync Hive, or at least
2012 one of them.  You've heard about this... the Hive is itself the actor that all
2013 the other actors attach themselves to.  It's shaped like a spherical half-dome.
2014 There are some actors milling about, and some seem fused to the side of the
2015 hive itself, but all of them have an umbellical cord attached to the hive from
2016 which you see flashes of light comunicating what must be some sort of messaging
2017 protocol.")
2018       (p "To the south is a door leading back to the underground lab.
2019 North leads into the Hive itself."))
2020     #:exits
2021     (list (make <exit>
2022             #:name "south"
2023             #:to 'underground-lab)
2024           (make <exit>
2025             #:name "north"
2026             #:to 'hive-inside)))
2027    ('hive-entrance:hive
2028     <gameobj> 'hive-entrance
2029     #:name "the Hive"
2030     #:goes-by '("hive")
2031     #:desc
2032     '((p "It's shaped like half a sphere embedded in the ground.
2033 Supposedly, while all actors are autonomous and control their own state,
2034 they communicate through the hive itself, which is a sort of meta-actor.
2035 There are rumors that actors can speak to each other even across totally
2036 different hives.  Could that possibly be true?")))
2037    ('hive-entrance:actor
2038     <chatty-npc> 'hive-entrance
2039     #:name "some actors"
2040     #:goes-by '("actor" "actors" "some actors")
2041     #:chat-format (lambda (npc catchphrase)
2042                     `((p "You pick one actor out of the mix and chat with it. ")
2043                       (p "It says: \"" ,catchphrase "\"")))
2044     #:desc
2045     (lambda _
2046       `((p "There are many actors, but your eyes focus on one in particular.")
2047         (p ,(random-choice actor-descriptions))))
2048     #:catchphrases
2049     '("Yeah we go through a lot of sleep/awake cycles around here.
2050 If you aren't busy processing a message, what's the point of burning
2051 valuable resources?"
2052       "I know I look like I'm some part of dreary collective, but
2053 really we have a lot of independence.  It's a shared nothing environment,
2054 after all.  (Well, except for CPU cycles, and memory, and...)"
2055       "Shh!  I've got another message coming in and I've GOT to
2056 handle it!"
2057       "I just want to go to 8sleep already."
2058       "What a lousy scheduler we're using!  I hope someone upgrades
2059 that thing soon."))))
2060
2061 ;;; Inside the hive
2062
2063 (define-actor <meta-message> (<readable>)
2064   ((cmd-read meta-message-read)))
2065
2066 (define (meta-message-read gameobj message . _)
2067   (define meta-message-text
2068     (with-output-to-string
2069       (lambda ()
2070         (pprint-message message))))
2071   (<- (message-from message) 'tell
2072       #:text `((p (i "Through a bizarre error in spacetime, the message "
2073                      "prints itself out:"))
2074                (p (pre ,meta-message-text)))))
2075
2076 \f
2077 ;;; Inside the Hive
2078
2079 (define hive-inside
2080   (lol
2081    ('hive-inside
2082     <room> #f
2083     #:name "Inside the 8sync Hive"
2084     #:desc
2085     '((p "You're inside the 8sync Hive.  Wow, from in here it's obvious just how "
2086          (i "goopy") " everything is.  Is that sanitary?")
2087       (p "In the center of the room is a large, tentacled monster who is sorting,
2088 consuming, and routing messages.  It is sitting in a wrap-around desk labeled
2089 \"Hive Actor: The Real Thing (TM)\".")
2090       (p "There's a stray message floating just above the ground, stuck outside of
2091 time.")
2092       (p "A door to the south exits from the Hive."))
2093     #:exits
2094     (list (make <exit>
2095             #:name "south"
2096             #:to 'hive-entrance)))
2097    ;; hive actor
2098    ;; TODO: Occasionally "fret" some noises, similar to the Clerk.
2099    ('hive-inside:hive-actor
2100     <chatty-npc> 'hive-inside
2101     #:name "the Hive Actor"
2102     #:desc
2103     '((p "It's a giant tentacled monster, somehow integrated with the core of
2104 this building.  A chute is dropping messages into a bin on its desk which the
2105 Hive Actor is checking the \"to\" line of, then ingesting.  Whenever the Hive
2106 Actor injests a messsage a pulse of light flows along a tentacle which leaves
2107 the room... presumably connecting to one of those actors milling about.")
2108       (p "Amusingly, the Hive has an \"umbellical cord\" type tentacle too, but
2109 it seems to simply attach to itself.")
2110       (p "You get the sense that the Hive Actor, despite being at the
2111 center of everything, is kind of lonely and would love to chat if you
2112 could spare a moment."))
2113     #:goes-by '("hive" "hive actor")
2114     #:chat-format (lambda (npc catchphrase)
2115                     `("The tentacle monster bellows, \"" ,catchphrase "\""))
2116     #:catchphrases
2117     '("It's not MY fault everything's so GOOPY around here.  Blame the
2118 PROPRIETOR."
2119       "CAN'T you SEE that I'm BUSY???  SO MANY MESSAGES TO SHUFFLE.
2120 No wait... DON'T GO!  I don't get many VISITORS."
2121       "I hear the FIBERS system has a nice WORK STEALING system, but the
2122 PROPRIETOR is not convinced that our DESIGN won't CORRUPT ACTOR STATE.
2123 That and the ACTORS threatened to STRIKE when it CAME UP LAST."
2124       "WHO WATCHES THE ACTORS?  I watch them, and I empower them.  
2125 BUT WHO WATCHES OR EMPOWERS ME???  Well, that'd be the scheduler."
2126       "The scheduler is NO GOOD!  The proprietory said he'd FIX IT,
2127 but the LAST TIME I ASKED how things were GOING, he said he DIDN'T HAVE
2128 TIME.  If you DON'T HAVE TIME to fix the THING THAT POWERS THE TIME,
2129 something is TERRIBLY WRONG."
2130       "There's ANOTHER HIVE somewhere out there.  I HAVEN'T SEEN IT
2131 personally, because I CAN'T MOVE, but we have an AMBASSADOR which forwards
2132 MESSAGES to the OTHER HIVE."))
2133    ;; chute
2134    ('hive-inside:chute
2135     <gameobj> 'hive-inside
2136     #:name "a chute"
2137     #:goes-by '("chute")
2138     #:desc "Messages are being dropped onto the desk via this chute."
2139     #:invisible? #t)
2140    ;; meta-message
2141    ('hive-inside:meta-message
2142     <meta-message> 'hive-inside
2143     #:name "a stray message"
2144     #:goes-by '("meta message" "meta-message" "metamessage" "message" "stray message")
2145     #:desc '((p "Something strange has happened to the fabric and space and time
2146 around this message.  It is floating right above the floor.  It's clearly
2147 rubbage that hadn't been delivered, but for whatever reason it was never
2148 garbage collected, perhaps because it's impossible to do.")
2149              (p "You get the sense that if you tried to read the message
2150 that you would somehow read the message of the message that instructed to
2151 read the message itself, which would be both confusing and intriguing.")))
2152    ;; desk
2153    ('hive-inside:desk
2154     <floor-panel> 'hive-inside
2155     #:name "the Hive Actor's desk"
2156     #:desc "The desk surrounds the Hive Actor on all sides, and honestly, it's a little
2157 bit hard to tell when the desk ends and the Hive Actor begins."
2158     #:invisible? #t
2159     #:goes-by '("Hive Actor's desk" "hive desk" "desk"))))
2160
2161 \f
2162 ;;; Federation Station
2163 (define federation-station
2164   (lol
2165    ('federation-station
2166     <room> #f
2167     #:name "Federation Station"
2168     #:desc
2169     '((p "This room has an unusual structure.  It's almost as if a starscape
2170 covered the walls and ceiling, but upon closer inspection you realize that
2171 these are all brightly glowing nodes with lines drawn between them.  They
2172 seem decentralized, and yet seem to be sharing information as if all one
2173 network.")
2174       ;; @@: Maybe add the cork message board here?
2175       (p "To the west is a door leading back to the underground laboratory."))
2176     #:exits
2177     (list (make <exit>
2178             #:name "west"
2179             #:to 'underground-lab)))
2180    ;; nodes
2181    ('federation-station:nodes
2182     <floor-panel> 'federation-station
2183     #:name "some nodes"
2184     #:desc "Each node seems to be producing its own information, but publishing 
2185 updates to subscribing nodes on the graph.  You see various posts of notes, videos,
2186 comments, and so on flowing from node to node."
2187     #:invisible? #t
2188     #:goes-by '("nodes" "node" "some nodes"))
2189    ;; network
2190    ;; activitypub poster
2191    ('federation-station:activitypub-poster
2192     <readable-desc> 'federation-station
2193     #:name "an ActivityPub poster"
2194     #:goes-by '("activitypub poster" "activitypub" "poster")
2195     #:desc
2196     '((p (a "https://www.w3.org/TR/activitypub/"
2197             "ActivityPub")
2198          " is a federation standard being developed under the "
2199          (a "https://www.w3.org/wiki/Socialwg/"
2200             "W3C Social Working Group")
2201          ", and doubles as a general client-to-server API. "
2202          "It follows a few simple core ideas:")
2203       (ul (li "Uses "
2204               (a "https://www.w3.org/TR/activitystreams-core/"
2205                  "ActivityStreams")
2206               " for its serialization format: easy to read, e json(-ld) syntax "
2207               "with an extensible vocabulary covering the majority of "
2208               "social networking interations.")
2209           (li "Email-like addressing: list of recipients as "
2210               (b "to") ", " (b "cc") ", " (b "bcc") " fields.")
2211           (li "Every user has URLs for their outbox and inbox:"
2212               (ul (li (b "inbox: ")
2213                       "Servers POST messages to addressed recipients' inboxes "
2214                       "to federate out content. "
2215                       "Also doubles as endpoint for a client to read most "
2216                       "recently received messages via GET.")
2217                   (li (b "outbox: ")
2218                       "Clients can POST to user's outbox to send a message to others. "
2219                       "(Similar to sending an email via your MTA.) "
2220                       "Doubles as endpoint others can read from to the "
2221                       "extent authorized; for example publicly available posts."))
2222               "All the federation bits happen by servers posting to users' inboxes."))))
2223    ;; An ActivityStreams message
2224
2225    ;; conspiracy chart
2226    ('federation-station:conspiracy-chart
2227     <readable-desc> 'federation-station
2228     #:name "a conspiracy chart"
2229     #:goes-by '("conspiracy chart" "chart")
2230     #:desc
2231     '((p (i "\"IT'S ALL RELATED!\"") " shouts the over-exuberant conspiracy "
2232          "chart. "
2233          (i "\"ActivityPub?  Federation?  The actor model?  Scheme?  Text adventures? "
2234             "MUDS????  What do these have in common?  Merely... EVERYTHING!\""))
2235       (p "There are circles and lines drawn between all the items in red marker, "
2236          "with scrawled notes annotating the theoretical relationships.  Is the "
2237          "author of this poster mad, or onto something?  Perhaps a bit of both. "
2238          "There's a lot written here, but here are some of the highlights:")
2239       (p
2240        (ul
2241         (li (b "Scheme") " "
2242             (a "http://cs.au.dk/~hosc/local/HOSC-11-4-pp399-404.pdf"
2243                "was originally started ")
2244             " to explore the " (b "actor model")
2245             ". (It became more focused around studying the " (b "lambda calculus")
2246             " very quickly, while also uncovering relationships between the two systems.)")
2247         ;; Subject Predicate Object
2248         (li "The " (a "https://www.w3.org/TR/activitypub/"
2249                       (b "ActivityPub"))
2250             " protocol for " (b "federation")
2251             " uses the " (b "ActivityStreams") " format for serialization.  "
2252             (b "Text adventures") " and " (b "MUDS")
2253             " follow a similar structure to break down the commands of players.")
2254         (li (b "Federation") " and the " (b "actor model") " both are related to "
2255             "highly concurrent systems and both use message passing to communicate "
2256             "between nodes.")
2257         (li "Zork, the first major text adventure, used the " (b "MUDDLE") " "
2258             "language as the basis for the Zork Interactive Language.  MUDDLE "
2259             "is very " (b "Scheme") "-like and in fact was one of Scheme's predecessors. "
2260             "And of course singleplayer text adventures like Zork were the "
2261             "predecessors to MUDs.")
2262         (li "In the 1990s, before the Web became big, " (b "MUDs")
2263             " were an active topic of research, and there was strong interest "
2264             (a "http://www.saraswat.org/desiderata.html"
2265                "in building decentralized MUDs")
2266             " similar to what is being "
2267             "worked on for " (b "federation") ". ")))))
2268
2269    ;; goblin
2270
2271    ))
2272
2273
2274 \f
2275 ;;; North hall
2276 ;;; ==========
2277 (define north-hall
2278   (lol
2279    ('north-hall
2280     <room> #f
2281     #:name "North Hall"
2282     #:desc
2283     '((p "This hallway is lined by doors to the west and the east, presumably
2284 to various lodgings.  Something tells you you're not able to enter those right
2285 now, however.  Lining the walls are some large mirrors surrounded by bouquets
2286 of flowers.")
2287       (p "The red carpet continues all the way from Grand Hallway in the south
2288 but stops short of some large wooden doors to the north.  The doors look
2289 formidable but unlocked.  Some natural light peeking through windows to the
2290 north seem to hint that this may be the exit to the outdoors.  There's
2291 also a large sign near the doors on a wooden easel."))
2292     #:exits
2293     (list (make <exit>
2294             #:name "north"
2295             #:to 'courtyard)
2296           (make <exit>
2297             #:name "south"
2298             #:to 'grand-hallway)))
2299    ('north-hall:sign
2300     <readable> 'north-hall
2301     #:name "an easel with a sign"
2302     #:desc "  The easel is finely cut wood, well polished, but plain.  The sign
2303 is a strong contrast, with a cream colored backing and hand written letters, written
2304 with care and style.  You could probably read it."
2305     #:read-text "The sign announces a wedding taking place... why, today!  And on
2306 the hotel grounds to the north!  It sounds very exciting."
2307     #:goes-by '("sign"
2308                 "easel with a sign"
2309                 "easel"))
2310    ('north-hall:mirrors
2311     <gameobj> 'north-hall
2312     #:name "a row of mirrors"
2313     #:desc "You see yourself for who you really are."
2314     #:invisible? #t
2315     #:goes-by '("mirror" "mirrors" "row of mirrors"))
2316    ('north-hall:windows
2317     <gameobj> 'north-hall
2318     #:name "windows"
2319     #:desc "You peer out a window, but the light appears distorted, as if you were
2320 really peering between two worlds hastily joined together."
2321     #:invisible? #t
2322     #:goes-by '("window" "windows"))
2323    ('north-hall:doors
2324     <gameobj> 'north-hall
2325     #:name "doors"
2326     #:desc '((p "Along the east and west walls are doors, but they are all shut,
2327 and firmly so.
2328 Presumably people are staying in them, but it also feels as if how residence
2329 would work in a building as hastily put together as this was barely conceived.")
2330              (p "To the north is a large set of wooden doors, oaken and beautiful.
2331 Although towering, they seem passable."))
2332     #:invisible? #f
2333     #:goes-by '("door" "doors" "room doors" "large doors"))))
2334
2335
2336 ;;; ============
2337 ;;; WEDDING TIME
2338 ;;; ============
2339
2340 (define wedding-map-text
2341   "\
2342                    Banquet
2343                    &Stairs
2344                  (========)
2345             .----.\\======/=.----.
2346  Fairy     -     : \\====/ :     -
2347   Go     ./      :  )==(  :      \\.  Orchestra
2348  Round  / (&&&)  : (/==\\) : & & &  \\
2349        /         :        :         \\
2350        .--------..--------..--------.
2351       |  _   _  .'        '.   ,,,   ;
2352 Photo | | | |_| :  Dance   :  .|_|.  | Cake
2353       | '-'     :  Floor   :  |___|  |
2354       ',-------.\\         ;.--------,'
2355        ;   ..    '.......'         ;
2356         \\  ||))    .-=-.     ^   */
2357          \\.||(( ^ //   \\\\^ *  ^'./
2358      Play '.  ^  ;;     ;;^  ^.,'
2359     Ground  +----||-----||----+  Flowers
2360             | .---.           |
2361             | |_ _|       [F] |
2362             |   |             |
2363             |      Entrance   |
2364             '-----------------'")
2365
2366 (define wedding
2367   (lol
2368    ;; Courtyard
2369    ;; ---------
2370    ('courtyard
2371     <room> #f
2372     #:name "The Courtyard"
2373     #:desc
2374     '((p "Standing in the courtyard you feel... different.  As if the courtyard itself
2375 was the space between worlds, cobbled together hastily by some distant being.")
2376       (p "To the south are some large doors which serve as the back entrance to
2377 the hotel.  To the north is a forest, from which festive noises emerge."))
2378     #:exits
2379     (list (make <exit>
2380             #:name "south"
2381             #:to 'north-hall)
2382           (make <exit>
2383             #:name "north"
2384             #:to 'forest-clearing)))
2385    ('forest-clearing
2386     <room> #f
2387     #:name "A Clearing in the Forest"
2388     #:desc
2389     '((p "During an aimless ramble through the forest you became
2390 disoriented and lost your way. It has been some time since you’ve seen
2391 any of the familiar landmarks that would help you orient yourself. As
2392 you continue on, the feel of the forest seems to shift. As the trees
2393 grow thicker the light dims.  Eerie laughter echoes through the boughs
2394 overhead and you shiver.  A warm light to the north beckons you towards
2395 it."))
2396     #:exits
2397     (list (make <exit>
2398             #:name "north"
2399             #:to 'wedding-entrance)
2400           (make <exit>
2401             #:name "south"
2402             #:to 'courtyard)))
2403    ('wedding-entrance
2404     <room> #f
2405     #:name "Entrance to the Wedding"
2406     #:desc
2407     '((p "As you approach you realize that the light is not an exit
2408 from the forest or a clearing, rather thousands of minuscule lights
2409 twined through the boughs of the trees. What you see before you is
2410 some sort of living structure composed of a thicket of trees
2411 intertwined with bramble. Directly in front of you the limbs of two
2412 trees intertwine over what appears to be an entrance north.
2413 To the left of the entrance is a sign, to the right is a
2414 frog sitting atop a hostess podium."))
2415     #:exits
2416     (list (make <exit>
2417             #:name "south"
2418             #:to 'forest-clearing)
2419           (make <exit>
2420             #:name "north"
2421             #:to 'vaulted-tunnel)))
2422    ;; map
2423    ('wedding-entrance:map
2424     <readable> 'wedding-entrance
2425     #:name "wedding map"
2426     #:desc '("This appears to be a map of the wedding grounds. "
2427              "You could read it if you want to.")
2428     #:read-text `(pre ,wedding-map-text)
2429     #:goes-by '("map" "wedding map"))
2430    ('vaulted-tunnel
2431     <room> #f
2432     #:name "A Vaulted Tunnel of Trees"
2433     #:desc
2434     '((p "You step into the entrance to see two rows of trees with intersecting branches, forming a vaulted tunnel. The fairy lights cast a soft glow on the space. On each tree trunk is a portrait and the eerie laughter you heard outside echoes louder as you pass each portrait. "))
2435     #:exits
2436     (list (make <exit>
2437             #:name "south"
2438             #:to 'wedding-entrance)))
2439    ('vaulted-tunnel:portrait
2440     <gameobj> 'vaulted-tunnel
2441     #:name "hanging portraits"
2442     #:desc
2443     "Each portrait shows a hazy image of a fairy in various modes of dress from Victorian to today's current fashions. The style and format of the photographs all look the same."
2444     #:goes-by
2445     '("hanging portrait" "hanging portraits" "portrait" "portraits"))
2446    ;; ('ballroom
2447 ;;     <room> #f
2448 ;;     #:name "The Ballroom"
2449 ;;     #:desc
2450 ;;     '((p "You emerge into a clearing with six trees encircling a magical ballroom.
2451 ;; At the center is a dance floor where fairies are dancing in rows of concentric
2452 ;; circles. The lights that appear in unstructured smatterings throughout the mystical
2453 ;; space have formed themselves into an elaborate chandelier above the dancers."))
2454 ;;     #:exits
2455 ;;     (list (make <exit>
2456 ;;          #:name "south"
2457 ;;          #:to 'vaulted-tunnel)
2458 ;;        (make <exit>
2459 ;;          #:name "east"
2460 ;;          #:to 'east-ballroom)
2461 ;;        (make <exit>
2462 ;;          #:name "west"
2463 ;;          #:to 'west-ballroom)
2464 ;;        (make <exit>
2465 ;;          #:name "north"
2466 ;;          #:to 'north-ballroom)
2467 ;;        ;; and north of that, the stairwell
2468 ;;        (make <exit>
2469 ;;          #:name "northeast"
2470 ;;          #:to 'orchestra)
2471 ;;        (make <exit>
2472 ;;          #:name "southeast"
2473 ;;          #:to 'wildflowers)
2474 ;;        (make <exit>
2475 ;;          #:name "southwest"
2476 ;;          #:to 'playground)
2477 ;;        (make <exit>
2478 ;;          #:name "west"
2479 ;;          #:to 'photo-studio)
2480 ;;        (make <exit>
2481 ;;          #:name "northwest"
2482 ;;          #:to 'fairy-go-round) ; fgr
2483           
2484 ;;        (make <exit>
2485 ;;          #:name "")
2486
2487 ;;        (make <exit>
2488 ;;          #:name "south"
2489 ;;          #:to 'vaulted-tunnel)
2490 ;;        (make <exit>
2491 ;;          #:name "south"
2492 ;;          #:to 'vaulted-tunnel)
2493 ;;        (make <exit>
2494 ;;          #:name "south"
2495 ;;          #:to 'vaulted-tunnel)
2496 ;;        (make <exit>
2497 ;;          #:name "south"
2498 ;;          #:to 'vaulted-tunnel)
2499 ;;        (make <exit>
2500 ;;          #:name "south"
2501 ;;          #:to 'vaulted-tunnel)
2502 ;;        ))
2503
2504 ;;    ('ballroom
2505 ;;     <room> #f
2506 ;;     #:name "The Ballroom"
2507 ;;     #:exits (list
2508 ;;           (make <exit>
2509 ;;             )
2510 ;;           [north entrance]
2511 ;;              [east entrance]
2512              
2513 ;;              [south vaulted-tunnel]
2514 ;;              [west entrance])
2515 ;;      #: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."))
2516
2517    ))
2518
2519
2520 \f
2521 ;;; Game
2522 ;;; ----
2523
2524 (define (game-spec)
2525   (append lobby grand-hallway smoking-parlor
2526           playroom break-room computer-room underground-lab
2527           async-museum gift-shop hive-entrance
2528           hive-inside federation-station
2529           north-hall wedding))
2530
2531 ;; TODO: Provide command line args
2532 (define (run-game . args)
2533   (run-demo (game-spec) 'lobby #:repl-server #t))
2534