some more clerk texts
[mudsync.git] / worlds / bricabrac.scm
1 ;;; Mudsync --- Live hackable MUD
2 ;;; Copyright © 2016 Christopher Allan 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 allows you to take from items that are proxied by it
65 (define-actor <proxy-items> (<gameobj>)
66   ((cmd-take-from take-from-proxy))
67   (proxy-items #:init-keyword #:proxy-items))
68
69 (define* (take-from-proxy gameobj message
70                           #:key direct-obj indir-obj preposition
71                           (player (message-from message)))
72   (call/ec
73    (lambda (escape)
74      (for-each
75       (lambda (obj-sym)
76         (define obj-id (dyn-ref gameobj obj-sym))
77         (define goes-by
78           (mbody-val (<-wait obj-id 'goes-by)))
79         (when (ci-member direct-obj goes-by)
80           (<- obj-id 'cmd-take #:direct-obj direct-obj #:player player)
81           (escape #f)))
82       (slot-ref gameobj 'proxy-items))
83
84      (<- player 'tell
85         #:text `("You don't see any such " ,direct-obj " to take "
86                  ,preposition " " ,(slot-ref gameobj 'name) ".")))))
87
88
89 \f
90 ;;; Lobby
91 ;;; -----
92
93 (define (npc-chat-randomly actor message . _)
94   (define text-to-send
95     (format #f "~a says: \"~a\"\n"
96             (slot-ref actor 'name)
97             (random-choice (slot-ref actor 'catchphrases))))
98   (<- (message-from message) 'tell
99       #:text text-to-send))
100
101 (define hotel-owner-grumps
102   '("Eight sinks!  Eight sinks!  And I couldn't unwind them..."
103     "Don't mind the mess.  I built this place on a dare, you
104 know?"
105     "(*tearfully*) Here, take this parenthesis.  May it serve
106 you well."
107     "I gotta get back to the goblin farm soon..."
108     "Oh, but I was going to make a mansion... a great,
109 beautiful mansion!  Full of ghosts!  Now all I have is this cruddy
110 mo... hotel.  Oh... If only I had more time!"
111     "I told them to paint more of the walls purple.
112 Why didn't they listen?"
113     "Listen to that overhead muzak.  Whoever made that doesn't
114 know how to compose very well!  Have you heard of the bands 'fmt'
115 or 'skribe'?  Now *that's* composition!"))
116
117 (define-class <chatty-npc> (<gameobj>)
118   (catchphrases #:init-value '("Blarga blarga blarga!")
119                 #:init-keyword #:catchphrases)
120   (commands
121    #:allocation #:each-subclass
122    #:init-thunk (build-commands
123                  (("chat" "talk") ((direct-command cmd-chat)))))
124   (actions #:allocation #:each-subclass
125            #:init-thunk
126            (build-actions
127             (cmd-chat npc-chat-randomly))))
128
129 (define-class <sign-in-form> (<gameobj>)
130   (commands
131    #:allocation #:each-subclass
132    #:init-thunk (build-commands
133                  ("sign" ((prep-direct-command cmd-sign-form '("as"))))))
134
135   (actions #:allocation #:each-subclass
136            #:init-thunk (build-actions
137                          (cmd-sign-form sign-cmd-sign-in))))
138
139
140 (define name-sre
141   (sre->irregex '(: alpha (** 1 14 (or alphanum "-" "_")))))
142
143 (define forbidden-words
144   (append article preposition
145           '("and" "or" "but" "admin")))
146
147 (define (valid-name? name)
148   (and (irregex-match name-sre name)
149        (not (member name forbidden-words))))
150
151 (define* (sign-cmd-sign-in actor message
152                            #:key direct-obj indir-obj preposition)
153   (define old-name
154     (mbody-val (<-wait (message-from message) 'get-name)))
155   (define name indir-obj)
156   (if (valid-name? indir-obj)
157       (begin
158         (<-wait (message-from message) 'set-name! name)
159         (<- (slot-ref actor 'loc) 'tell-room
160             #:text (format #f "~a signs the form!\n~a is now known as ~a\n"
161                            old-name old-name name)))
162       (<- (message-from message) 'tell
163           #:text "Sorry, that's not a valid name.
164 Alphanumerics, _ and - only, 2-15 characters, starts with an alphabetic
165 character.\n")))
166
167
168 (define-class <summoning-bell> (<gameobj>)
169   (summons #:init-keyword #:summons)
170
171   (commands
172    #:allocation #:each-subclass
173    #:init-thunk (build-commands
174                  ("ring" ((direct-command cmd-ring)))))
175   (actions #:allocation #:each-subclass
176            #:init-thunk (build-actions
177                          (cmd-ring summoning-bell-cmd-ring))))
178
179 (define* (summoning-bell-cmd-ring bell message . _)
180   ;; Call back to actor who invoked this message handler
181   ;; and find out their name.  We'll call *their* get-name message
182   ;; handler... meanwhile, this procedure suspends until we get
183   ;; their response.
184   (define who-rang
185     (mbody-val (<-wait (message-from message) 'get-name)))
186
187   ;; Now we'll invoke the "tell" message handler on the player
188   ;; who rang us, displaying this text on their screen.
189   ;; This one just uses <- instead of <-wait, since we don't
190   ;; care when it's delivered; we're not following up on it.
191   (<- (message-from message) 'tell
192       #:text "*ring ring!*  You ring the bell!\n")
193   ;; We also want everyone else in the room to "hear" the bell,
194   ;; but they get a different message since they aren't the ones
195   ;; ringing it.  Notice here's where we make use of the invoker's
196   ;; name as extracted and assigned to the who-rang variable.
197   ;; Notice how we send this message to our "location", which
198   ;; forwards it to the rest of the occupants in the room.
199   (<- (gameobj-loc bell) 'tell-room
200       #:text
201       (format #f "*ring ring!*  ~a rings the bell!\n"
202               who-rang)
203       #:exclude (message-from message))
204   ;; Now we perform the primary task of the bell, which is to summon
205   ;; the "clerk" character to the room.  (This is configurable,
206   ;; so we dynamically look up their address.)
207   (<- (dyn-ref bell (slot-ref bell 'summons)) 'be-summoned
208       #:who-summoned (message-from message)))
209
210
211 (define prefect-quotes
212   '("I'm a frood who really knows where my towel is!"
213     "On no account allow a Vogon to read poetry at you."
214     "Time is an illusion, lunchtime doubly so!"
215     "How can you have money if none of you produces anything?"
216     "On no account allow Arthur to request tea on this ship."))
217
218 (define-class <cabinet-item> (<gameobj>)
219   (take-me? #:init-value
220             (lambda _
221               (values #f #:why-not
222                       `("Hm, well... the cabinet is locked and the properitor "
223                         "is right over there.")))))
224
225 (define lobby
226   (lol
227    ('lobby
228     <room> #f
229     #:name "Hotel Lobby"
230     #:desc
231     '((p "You're in some sort of hotel lobby.  You see a large sign hanging "
232          "over the desk that says \"Hotel Bricabrac\".  On the desk is a bell "
233          "that says \"'ring bell' for service\".  Terrible music plays from a speaker "
234          "somewhere overhead.  "
235          "The room is lined with various curio cabinets, filled with all sorts "
236          "of kitschy junk.  It looks like whoever decorated this place had great "
237          "ambitions, but actually assembled it all in a hurry and used whatever "
238          "kind of objects they found lying around.")
239       (p "There's a door to the north leading to some kind of hallway."))
240     #:exits
241     (list (make <exit>
242             #:name "north"
243             #:to 'grand-hallway)))
244    ;; NPC: hotel owner
245    ('lobby:hotel-owner
246     <chatty-npc> 'lobby
247     #:name "a frumpy fellow"
248     #:desc
249     '((p "  Whoever this is, they looks totally exhausted.  They're
250 collapsed into the only comfortable looking chair in the room and you
251 don't get the sense that they're likely to move any time soon.
252   You notice they're wearing a sticker badly adhesed to their clothing
253 which says \"Hotel Proprietor\", but they look so disorganized that you
254 think that can't possibly be true... can it?
255   Despite their exhaustion, you sense they'd be happy to chat with you,
256 though the conversation may be a bit one sided."))
257     #:goes-by '("frumpy fellow" "fellow"
258                 "Chris Webber"  ; heh, did you rtfc?  or was it so obvious?
259                 "hotel proprietor" "proprietor")
260     #:catchphrases hotel-owner-grumps)
261    ;; Object: Sign
262    ('lobby:sign
263     <readable> 'lobby
264     #:name "the Hotel Bricabrac sign"
265     #:desc "  It strikes you that there's something funny going on with this sign.
266 Sure enough, if you look at it hard enough, you can tell that someone
267 hastily painted over an existing sign and changed the \"M\" to an \"H\".
268 Classy!"
269     #:read-text "  All it says is \"Hotel Bricabrac\" in smudged, hasty text."
270     #:goes-by '("sign"
271                 "bricabrac sign"
272                 "hotel sign"
273                 "hotel bricabrac sign"
274                 "lobby sign"))
275
276    ('lobby:bell
277     <summoning-bell> 'lobby
278     #:name "a shiny brass bell"
279     #:goes-by '("shiny brass bell" "shiny bell" "brass bell" "bell")
280     #:desc "  A shiny brass bell.  Inscribed on its wooden base is the text
281 \"ring me for service\".  You probably could \"ring the bell\" if you 
282 wanted to."
283     #:summons 'break-room:desk-clerk)
284
285    ('lobby:sign-in-form
286     <sign-in-form> 'lobby
287     #:name "sign-in form"
288     #:goes-by '("sign-in form" "form" "signin form")
289     #:desc '("It looks like you could sign this form and set your name like so: "
290              (i "sign form as <my-name-here>")))
291
292    ;; Object: curio cabinets
293    ;; TODO: respond to attempts to open the curio cabinet
294    ('lobby:cabinet
295     <proxy-items> 'lobby
296     #:proxy-items '(lobby:porcelain-doll
297                     lobby:1950s-robots
298                     lobby:tea-set lobby:mustard-pot
299                     lobby:head-of-elvis lobby:circuitboard-of-evlis
300                     lobby:teletype-scroll lobby:orange-cat-phone)
301     #:name "a curio cabinet"
302     #:goes-by '("curio cabinet" "cabinet" "bricabrac cabinet"
303                 "cabinet of curiosities")
304     #:desc (lambda _
305              (format #f "  The curio cabinet is full of all sorts of oddities!
306 Something catches your eye!
307 Ooh, ~a!" (random-choice
308            '("a creepy porcelain doll"
309              "assorted 1950s robots"
310              "an exquisite tea set"
311              "an antique mustard pot"
312              "the pickled head of Elvis"
313              "the pickled circuitboard of EVLIS"
314              "a scroll of teletype paper holding the software Four Freedoms"
315              "a telephone shaped like an orange cartoon cat")))))
316
317    ('lobby:porcelain-doll
318     <cabinet-item> 'lobby
319     #:invisible? #t
320     #:name "a creepy porcelain doll"
321     #:desc "It strikes you that while the doll is technically well crafted,
322 it's also the stuff of nightmares."
323     #:goes-by '("porcelain doll" "doll"))
324    ('lobby:1950s-robots
325     <cabinet-item> 'lobby
326     #:invisible? #t
327     #:name "a set of 1950s robots"
328     #:desc "There's a whole set of these 1950s style robots.
329 They seem to be stamped out of tin, and have various decorations of levers
330 and buttons and springs.  Some of them have wind-up knobs on them."
331     #:goes-by '("robot" "robots" "1950s robot" "1950s robots"))
332    ('lobby:tea-set
333     <cabinet-item> 'lobby
334     #:invisible? #t
335     #:name "a tea set"
336     #:desc "A complete tea set.  Some of the cups are chipped.
337 You can imagine yourself joining a tea party using this set, around a
338 nice table with some doilies, drinking some Earl Grey tea, hot.  Mmmm."
339     #:goes-by '("tea set" "tea"))
340    ('lobby:mustard-pot
341     <cabinet-item> 'lobby
342     #:invisible? #t
343     #:name "a mustard pot"
344     #:desc '((p "It's a mustard pot.  I mean, it's kind of cool, it has a
345 nice design, and it's an antique, but you can't imagine putting something
346 like this in a museum.")
347              (p "Ha... imagine that... a mustard museum."))
348     #:goes-by '("mustard pot" "antique mustard pot" "mustard"))
349    ('lobby:head-of-elvis
350     <cabinet-item> 'lobby
351     #:invisible? #t
352     #:name "the pickled head of Elvis"
353     #:desc '((p "It's a jar full of some briny-looking liquid and...
354 a free floating head.  The head looks an awful lot like Elvis, and
355 definitely not the younger Elvis.  The hair even somehow maintains
356 that signature swoop while suspended in liquid.  But of course it's
357 not Elvis.")
358              (p "Oh, wait, it has a label at the bottom which says:
359 \"This is really the head of Elvis\".  Well... maybe don't believe
360 everything you read."))
361     #:goes-by '("pickled head of elvis" "pickled head of Elvis"
362                 "elvis" "Elvis" "head" "pickled head"))
363    ('lobby:circuitboard-of-evlis
364     <cabinet-item> 'lobby
365     #:invisible? #t
366     #:name "the pickled circuitboard of Evlis"
367     #:desc '((p "It's a circuitboard from a Lisp Machine called EVLIS.
368 This is quite the find, and you bet just about anyone interested in
369 preserving computer history would love to get their hands on this.")
370              (p "Unfortunately, whatever moron did acquire this has
371 no idea what it means to preserve computers, so here it is floating
372 in some kind of briny liquid.  It appears to be heavily corroded.
373 Too bad..."))
374     #:goes-by '("pickled circuitboard of evlis" "pickled circuitboard of Evlis"
375                 "pickled circuitboard of EVLIS"
376                 "evlis" "Evlis" "EVLIS" "circuitboard" "pickled circuitboard"))
377    ('lobby:teletype-scroll
378     <cabinet-item> 'lobby
379     #:invisible? #t
380     #:name "a scroll of teletype"
381     #:desc '((p "This is a scroll of teletype paper.  It's a bit old
382 and yellowed but the type is very legible.  It says:")
383              (br)
384              (i
385               (p (strong "== The four essential freedoms =="))
386               (p "A program is free software if the program's users have
387 the four essential freedoms: ")
388               (ul (li "The freedom to run the program as you wish, for any purpose (freedom 0).")
389                   (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.")
390                   (li "The freedom to redistribute copies so you can help your neighbor (freedom 2).")
391                   (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.")))
392              (p "You get this feeling that ambiguities in the
393 English language surrounding the word 'free' have lead to a lot of terminology debates."))
394     #:goes-by '("scroll of teletype" "scroll of teletype paper" "teletype scroll"
395                 "teletype paper" "scroll" "four freedoms"
396                 "scroll of teletype paper holding the software Four Freedoms"
397                 "scroll of teletype paper holding the software four freedoms"))
398    ('lobby:orange-cat-phone
399     <cabinet-item> 'lobby
400     #:invisible? #t
401     #:name "a telephone shaped like an orange cartoon cat"
402     #:desc "It's made out of a cheap plastic, and it's very orange.
403 It resembles a striped tabby, and it's eyes hold the emotion of
404 a being both sleepy and smarmy.
405 You suspect that someone, somewhere made a ton of cash on items holding
406 this general shape in the 1990s."
407     #:goes-by '("orange cartoon cat phone" "orange cartoon cat telephone"
408                 "orange cat phone" "orange cat telephone"
409                 "cartoon cat phone" "cartoon cat"
410                 "cat phone" "cat telephone" "phone" "telephone"))))
411
412
413 \f
414 ;;; Grand hallway
415 ;;; -------------
416
417 (define-actor <disc-shield> (<gameobj>)
418   ((cmd-take disc-shield-take)))
419
420 (define* (disc-shield-take gameobj message
421                            #:key direct-obj
422                            (player (message-from message)))
423   (create-gameobj <glowing-disc> (gameobj-gm gameobj)
424                   player)  ;; set loc to player to put in player's inventory
425   (<- player 'tell
426       #:text '((p "As you attempt to pull the shield / disk platter
427 from the statue a shining outline appears around it... and a
428 completely separate, glowing copy of the disc materializes into your
429 hands!")))
430   (<- (gameobj-loc gameobj) 'tell-room
431         #:text `(,(mbody-val (<-wait player 'get-name))
432                  " pulls on the shield of the statue, and a glowing "
433                  "copy of it materializes into their hands!")
434         #:exclude player)
435   (<- (gameobj-loc gameobj) 'tell-room
436       #:text
437       '(p "You hear a voice whisper: "
438           (i "\"Share the software... and you'll be free...\""))))
439
440 ;;; This is the disc that gets put in the player's inventory
441 (define-actor <glowing-disc> (<gameobj>)
442   ((cmd-drop glowing-disc-drop-cmd))
443   (initial-props
444    #:allocation #:each-subclass
445    #:init-thunk (build-props
446                  '((hd-platter? . #t))))
447   (name #:allocation #:each-subclass
448         #:init-value "a glowing disc")
449   (desc #:allocation #:each-subclass
450         #:init-value "A brightly glowing disc.  It's shaped like a hard
451 drive platter, not unlike the one from the statue it came from.  It's
452 labeled \"RL02.5\".")
453   (goes-by #:init-value '("glowing disc" "glowing platter"
454                           "glowing disc platter" "glowing disk platter"
455                           "platter" "disc" "disk" "glowing shield")))
456
457 (define* (glowing-disc-drop-cmd gameobj message
458                    #:key direct-obj
459                    (player (message-from message)))
460   (<- player 'tell
461       #:text "You drop the glowing disc, and it shatters into a million pieces!")
462   (<- (mbody-val (<-wait player 'get-loc)) 'tell-room
463       #:text `(,(mbody-val (<-wait player 'get-name))
464                " drops a glowing disc, and it shatters into a million pieces!")
465       #:exclude player)
466   (gameobj-self-destruct gameobj))
467
468 \f
469 ;;; Grand hallway
470
471 (define lobby-map-text
472   "\
473                         |  :       :  |
474   .----------.----------.  :   &   :  .----------.----------.
475   | computer |          |& :YOU ARE: &|  smoking | *UNDER*  |
476   | room     + playroom +  : HERE  :  +  parlor  | *CONS-   |
477   |    >     |          |& :       : &|          | TRUCTION*|
478   '----------'----------'-++-------++-'-------+--'----------'
479                        |    '-----'    |     |   |
480                        :     LOBBY     :     '---'
481                         '.           .'
482                           '---------'")
483
484 (define grand-hallway
485   (lol
486    ('grand-hallway
487     <room> #f
488     #:name "Grand Hallway"
489     #:desc '((p "  A majestic red carpet runs down the center of the room.
490 Busts of serious looking people line the walls, but there's no
491 clear indication that they have any logical relation to this place.")
492              (p "In the center is a large statue of a woman in a warrior's
493 pose, but something is strange about her weapon and shield.  You wonder what
494 that's all about?")
495              (p "To the south is the lobby.  A door to the east is labeled \"smoking
496 room\", while a door to the west is labeled \"playroom\"."))
497     #:exits
498     (list (make <exit>
499             #:name "south"
500             #:to 'lobby)
501           (make <exit>
502             #:name "west"
503             #:to 'playroom)
504           (make <exit>
505             #:name "east"
506             #:to 'smoking-parlor)))
507    ('grand-hallway:map
508     <readable> 'grand-hallway
509     #:name "the hotel map"
510     #:desc '("This appears to be a map of the hotel. "
511              "Like the hotel itself, it seems to be "
512              "incomplete."
513              "You could read it if you want to.")
514     #:read-text `(pre ,lobby-map-text)
515     #:goes-by '("map" "hotel map"))
516    ('grand-hallway:carpet
517     <gameobj> 'grand-hallway
518     #:name "the Grand Hallway carpet"
519     #:desc "It's very red, except in the places where it's very worn."
520     #:invisible? #t
521     #:goes-by '("red carpet" "carpet"))
522    ('grand-hallway:busts
523     <gameobj> 'grand-hallway
524     #:name "the busts of serious people"
525     #:desc "There are about 6 of them in total.  They look distinguished
526 but there's no indication of who they are."
527     #:invisible? #t
528     #:goes-by '("busts" "bust" "busts of serious people" "bust of serious person"))
529    ('grand-hallway:hackthena-statue
530     <proxy-items> 'grand-hallway
531     #:name "the statue of Hackthena"
532     #:desc '((p "The base of the statue says \"Hackthena, guardian of the hacker
533 spirit\".  You've heard of Hackthena... not a goddess, but spiritual protector of
534 all good hacks, and legendary hacker herself.")
535              (p "Hackthena holds the form of a human woman.  She wears flowing
536 robes, has a pear of curly bovine-esque horns protruding from the sides of her
537 head, wears a pair of horn-rimmed glasses, and appears posed as if for battle.
538 But instead of a weapon, she seems to hold some sort of keyboard.  And her
539 shield... well it's round like a shield, but something seems off about it.
540 You'd better take a closer look to be sure."))
541     #:goes-by '("hackthena statue" "hackthena" "statue" "statue of hackthena")
542     #:proxy-items '(grand-hallway:keyboard
543                     grand-hallway:disc-platter
544                     grand-hallway:hackthena-horns))
545    ('grand-hallway:keyboard
546     <gameobj> 'grand-hallway
547     #:name "a Knight Keyboard"
548     #:desc "Whoa, this isn't just any old keyboard, this is a Knight Keyboard!
549 Any space cadet can see that with that kind of layout a hack-and-slayer could
550 thrash out some serious key-chords like there's no tomorrow.  You guess
551 Hackthena must be an emacs user."
552     #:invisible? #t
553     #:take-me? (lambda _
554                  (values #f
555                          #:why-not
556                          `("Are you kidding?  Do you know how hard it is to find "
557                               "a Knight Keyboard?  There's no way she's going "
558                               "to give that up.")))
559     #:goes-by '("knight keyboard" "keyboard"))
560    ('grand-hallway:hackthena-horns
561     <gameobj> 'grand-hallway
562     #:name "Hackthena's horns"
563     #:desc "They're not unlike a Gnu's horns."
564     #:invisible? #t
565     #:take-me? (lambda _
566                  (values #f
567                          #:why-not
568                          `("Are you seriously considering desecrating a statue?")))
569     #:goes-by '("hackthena's horns" "horns" "horns of hacktena"))
570    ('grand-hallway:disc-platter
571     <disc-shield> 'grand-hallway
572     #:name "Hackthena's shield"
573     #:desc "No wonder the \"shield\" looks unusual... it seems to be a hard disk
574 platter!  It has \"RL02.5\" written on it.  It looks kind of loose."
575     #:invisible? #t
576     #:goes-by '("hackthena's shield" "shield" "platter" "hard disk platter"))))
577
578 \f
579 ;;; Playroom
580 ;;; --------
581
582 (define playroom
583   (lol
584    ('playroom
585     <room> #f
586     #:name "The Playroom"
587     #:desc '(p ("  There are toys scattered everywhere here.  It's really unclear
588 if this room is intended for children or child-like adults.")
589                ("  There are doors to both the east and the west."))
590     #:exits
591     (list (make <exit>
592             #:name "east"
593             #:to 'grand-hallway)
594           (make <exit>
595             #:name "west"
596             #:to 'computer-room)))
597    ('playroom:cubey
598     <gameobj> 'playroom
599     #:name "Cubey"
600     #:take-me? #t
601     #:desc "  It's a little foam cube with googly eyes on it.  So cute!")
602    ('playroom:cuddles-plushie
603     <gameobj> 'playroom
604     #:name "a Cuddles plushie"
605     #:goes-by '("plushie" "cuddles plushie" "cuddles")
606     #:take-me? #t
607     #:desc "  A warm and fuzzy cuddles plushie!  It's a cuddlefish!")
608
609    ('playroom:toy-chest
610     <container> 'playroom
611     #:name "a toy chest"
612     #:goes-by '("toy chest" "chest")
613     #:desc (lambda (toy-chest whos-looking)
614              (let ((contents (gameobj-occupants toy-chest)))
615                `((p "A brightly painted wooden chest.  The word \"TOYS\" is "
616                     "engraved on it.")
617                  (p "Inside you see:"
618                     ,(if (eq? contents '())
619                          " nothing!  It's empty!"
620                          `(ul ,(map (lambda (occupant)
621                                       `(li ,(mbody-val
622                                              (<-wait occupant 'get-name))))
623                                     (gameobj-occupants toy-chest))))))))
624     #:take-from-me? #t
625     #:put-in-me? #t)
626
627    ;; Things inside the toy chest
628    ('playroom:toy-chest:rubber-duck
629     <gameobj> 'playroom:toy-chest
630     #:name "a rubber duck"
631     #:goes-by '("rubber duck" "duck")
632     #:take-me? #t
633     #:desc "It's a yellow rubber duck with a bright orange beak.")))
634
635
636 \f
637 ;;; Writing room
638 ;;; ------------
639
640 \f
641 ;;; Armory???
642 ;;; ---------
643
644 ;; ... full of NURPH weapons?
645
646 \f
647 ;;; Smoking parlor
648 ;;; --------------
649
650 (define-class <furniture> (<gameobj>)
651   (sit-phrase #:init-keyword #:sit-phrase)
652   (sit-phrase-third-person #:init-keyword #:sit-phrase-third-person)
653   (sit-name #:init-keyword #:sit-name)
654
655   (commands
656    #:allocation #:each-subclass
657    #:init-thunk (build-commands
658                  ("sit" ((direct-command cmd-sit-furniture)))))
659   (actions #:allocation #:each-subclass
660            #:init-thunk (build-actions
661                          (cmd-sit-furniture furniture-cmd-sit))))
662
663 (define* (furniture-cmd-sit actor message #:key direct-obj)
664   (define player-name
665     (mbody-val (<-wait (message-from message) 'get-name)))
666   (<- (message-from message) 'tell
667       #:text (format #f "You ~a ~a.\n"
668                      (slot-ref actor 'sit-phrase)
669                      (slot-ref actor 'sit-name)))
670   (<- (slot-ref actor 'loc) 'tell-room
671       #:text (format #f "~a ~a on ~a.\n"
672                      player-name
673                      (slot-ref actor 'sit-phrase-third-person)
674                      (slot-ref actor 'sit-name))
675       #:exclude (message-from message)))
676
677
678 (define smoking-parlor
679   (lol
680    ('smoking-parlor
681     <room> #f
682     #:name "Smoking Parlor"
683     #:desc
684     '((p "This room looks quite posh.  There are huge comfy seats you can sit in
685 if you like. Strangely, you see a large sign saying \"No Smoking\".  The owners must
686 have installed this place and then changed their mind later.")
687       (p "There's a door to the west leading back to the grand hallway, and
688 a nondescript steel door to the south, leading apparently outside."))
689     #:exits
690     (list (make <exit>
691             #:name "west"
692             #:to 'grand-hallway)
693           (make <exit>
694             #:name "south"
695             #:to 'break-room)))
696    ('smoking-parlor:chair
697     <furniture> 'smoking-parlor
698     #:name "a comfy leather chair"
699     #:desc "  That leather chair looks really comfy!"
700     #:goes-by '("leather chair" "comfy leather chair" "chair")
701     #:sit-phrase "sink into"
702     #:sit-phrase-third-person "sinks into"
703     #:sit-name "the comfy leather chair")
704    ('smoking-parlor:sofa
705     <furniture> 'smoking-parlor
706     #:name "a plush leather sofa"
707     #:desc "  That leather chair looks really comfy!"
708     #:goes-by '("leather sofa" "plush leather sofa" "sofa"
709                 "leather couch" "plush leather couch" "couch")
710     #:sit-phrase "sprawl out on"
711     #:sit-phrase-third-person "sprawls out on into"
712     #:sit-name "the plush leather couch")
713    ('smoking-parlor:bar-stool
714     <furniture> 'smoking-parlor
715     #:name "a bar stool"
716     #:desc "  Conveniently located near the bar!  Not the most comfortable
717 seat in the room, though."
718     #:goes-by '("stool" "bar stool" "seat")
719     #:sit-phrase "hop on"
720     #:sit-phrase-third-person "hops onto"
721     #:sit-name "the bar stool")
722    ('ford-prefect
723     <chatty-npc> 'smoking-parlor
724     #:name "Ford Prefect"
725     #:desc "Just some guy, you know?"
726     #:goes-by '("Ford Prefect" "ford prefect"
727                 "frood" "prefect" "ford")
728     #:catchphrases prefect-quotes)
729
730    ('smoking-parlor:no-smoking-sign
731     <gameobj> 'smoking-parlor
732     #:invisible? #t
733     #:name "No Smoking Sign"
734     #:desc "This sign says \"No Smoking\" in big, red letters.
735 It has some bits of bubble gum stuck to it... yuck."
736     #:goes-by '("no smoking sign" "sign"))
737
738    ;; TODO: Cigar dispenser
739    ))
740
741 \f
742
743 ;;; Breakroom
744 ;;; ---------
745
746 (define-class <desk-clerk> (<gameobj>)
747   ;; The desk clerk has three states:
748   ;;  - on-duty: Arrived, and waiting for instructions (and losing patience
749   ;;    gradually)
750   ;;  - slacking: In the break room, probably smoking a cigarette
751   ;;    or checking text messages
752   (state #:init-value 'slacking)
753   (commands #:allocation #:each-subclass
754             #:init-thunk
755             (build-commands
756              (("talk" "chat") ((direct-command cmd-chat)))
757              ("ask" ((direct-command cmd-ask-incomplete)
758                      (prep-direct-command cmd-ask-about)))
759              ("dismiss" ((direct-command cmd-dismiss)))))
760   (patience #:init-value 0)
761   (actions #:allocation #:each-subclass
762            #:init-thunk (build-actions
763                          (init clerk-act-init)
764                          (cmd-chat clerk-cmd-chat)
765                          (cmd-ask-incomplete clerk-cmd-ask-incomplete)
766                          (cmd-ask-about clerk-cmd-ask)
767                          (cmd-dismiss clerk-cmd-dismiss)
768                          (update-loop clerk-act-update-loop)
769                          (be-summoned clerk-act-be-summoned))))
770
771 (define (clerk-act-init clerk message . _)
772   ;; call the gameobj main init method
773   (gameobj-act-init clerk message)
774   ;; start our main loop
775   (<- (actor-id clerk) 'update-loop))
776
777 (define changing-name-text "Changing your name is easy!
778 We have a clipboard here at the desk
779 where you can make yourself known to other participants in the hotel
780 if you sign it.  Try 'sign form as <your-name>', replacing
781 <your-name>, obviously!")
782
783 (define phd-text
784   "Ah... when I'm not here, I've got a PHD to finish.")
785
786 (define clerk-help-topics
787   `(("changing name" . ,changing-name-text)
788     ("sign-in form" . ,changing-name-text)
789     ("form" . ,changing-name-text)
790     ("common commands" .
791      "Here are some useful commands you might like to try: chat,
792 go, take, drop, say...")
793     ("hotel" .
794      "We hope you enjoy your stay at Hotel Bricabrac.  As you may see,
795 our hotel emphasizes interesting experiences over rest and lodging.
796 The origins of the hotel are... unclear... and it has recently come
797 under new... 'management'.  But at Hotel Bricabrac we believe these
798 aspects make the hotel into a fun and unique experience!  Please,
799 feel free to walk around and explore.")
800     ("physics paper" . ,phd-text)
801     ("paper" . ,phd-text)
802     ("proprietor" . "Oh, he's that frumpy looking fellow sitting over there.")))
803
804
805 (define clerk-knows-about
806   "'ask clerk about changing name', 'ask clerk about common commands', and 'ask clerk about the hotel'")
807
808 (define clerk-general-helpful-line
809   (string-append
810    "The clerk says, \"If you need help with anything, feel free to ask me about it.
811 For example, 'ask clerk about changing name'. You can ask me about the following:
812 " clerk-knows-about ".\"\n"))
813
814 (define clerk-slacking-complaints
815   '("The pay here is absolutely lousy."
816     "The owner here has no idea what they're doing."
817     "Some times you just gotta step away, you know?"
818     "You as exhausted as I am?"
819     "Yeah well, this is just temporary.  I'm studying to be a high
820 energy particle physicist.  But ya gotta pay the bills, especially
821 with tuition at where it is..."))
822
823 (define* (clerk-cmd-chat clerk message #:key direct-obj)
824   (match (slot-ref clerk 'state)
825     ('on-duty
826      (<- (message-from message) 'tell
827          #:text clerk-general-helpful-line))
828     ('slacking
829      (<- (message-from message) 'tell
830          #:text
831          (string-append
832           "The clerk says, \""
833           (random-choice clerk-slacking-complaints)
834           "\"\n")))))
835
836 (define (clerk-cmd-ask-incomplete clerk message . _)
837   (<- (message-from message) 'tell
838       #:text "The clerk says, \"Ask about what?\"\n"))
839
840 (define clerk-doesnt-know-text
841   "The clerk apologizes and says she doesn't know about that topic.\n")
842
843 (define* (clerk-cmd-ask clerk message #:key indir-obj
844                         #:allow-other-keys)
845   (match (slot-ref clerk 'state)
846     ('on-duty
847      (match (assoc indir-obj clerk-help-topics)
848        ((_ . info)
849            (<- (message-from message) 'tell
850                #:text
851                (string-append "The clerk clears her throat and says:\n  \""
852                               info
853                               "\"\n")))
854        (#f
855         (<- (message-from message) 'tell
856             #:text clerk-doesnt-know-text))))
857     ('slacking
858      (<- (message-from message) 'tell
859          #:text "The clerk says, \"Sorry, I'm on my break.\"\n"))))
860
861 (define* (clerk-act-be-summoned clerk message #:key who-summoned)
862   (match (slot-ref clerk 'state)
863     ('on-duty
864      (<- who-summoned 'tell
865          #:text
866          "The clerk tells you as politely as she can that she's already here,
867 so there's no need to ring the bell.\n"))
868     ('slacking
869      (<- (gameobj-loc clerk) 'tell-room
870          #:text
871          "The clerk's ears perk up, she stamps out a cigarette, and she
872 runs out of the room!\n")
873      (gameobj-set-loc! clerk (dyn-ref clerk 'lobby))
874      (slot-set! clerk 'patience 8)
875      (slot-set! clerk 'state 'on-duty)
876      (<- (gameobj-loc clerk) 'tell-room
877          #:text
878          (string-append
879           "  Suddenly, a uniformed woman rushes into the room!  She's wearing a
880 badge that says \"Desk Clerk\".
881   \"Hello, yes,\" she says between breaths, \"welcome to Hotel Bricabrac!
882 We look forward to your stay.  If you'd like help getting acclimated,
883 feel free to ask me.  For example, 'ask clerk about changing name'.
884 You can ask me about the following:
885 " clerk-knows-about ".\"\n")))))
886
887 (define* (clerk-cmd-dismiss clerk message . _)
888   (define player-name
889     (mbody-val (<-wait (message-from message) 'get-name)))
890   (match (slot-ref clerk 'state)
891     ('on-duty
892      (<- (gameobj-loc clerk) 'tell-room
893          #:text
894          (format #f "\"Thanks ~a!\" says the clerk. \"I have somewhere I need to be.\"
895 The clerk leaves the room in a hurry.\n"
896                  player-name)
897          #:exclude (actor-id clerk))
898      (gameobj-set-loc! clerk (dyn-ref clerk 'break-room))
899      (slot-set! clerk 'state 'slacking)
900      (<- (gameobj-loc clerk) 'tell-room
901          #:text clerk-return-to-slacking-text
902          #:exclude (actor-id clerk)))
903     ('slacking
904      (<- (message-from message) 'tell
905          #:text "The clerk sternly asks you to not be so dismissive.\n"))))
906
907 (define clerk-slacking-texts
908   '("The clerk takes a long drag on her cigarette.\n"
909     "The clerk scrolls through text messages on her phone.\n"
910     "The clerk coughs a few times.\n"
911     "The clerk checks her watch and justifies a few more minutes outside.\n"
912     "The clerk fumbles around for a lighter.\n"
913     "The clerk sighs deeply and exhaustedly.\n"
914     "The clerk fumbles around for a cigarette.\n"))
915
916 (define clerk-working-impatience-texts
917   '("The clerk hums something, but you're not sure what it is."
918     "The clerk attempts to change the overhead music, but the dial seems broken."
919     "The clerk clicks around on the desk computer."
920     "The clerk scribbles an equation on a memo pad, then crosses it out."
921     "The clerk mutters something about the proprietor having no idea how to run a hotel."
922     "The clerk thumbs through a printout of some physics paper."))
923
924 (define clerk-slack-excuse-text
925   "The desk clerk excuses herself, but says you are welcome to ring the bell
926 if you need further help.")
927
928 (define clerk-return-to-slacking-text
929   "The desk clerk enters and slams the door behind her.\n")
930
931
932 (define (clerk-act-update-loop clerk message)
933   (define (tell-room text)
934     (<- (gameobj-loc clerk) 'tell-room
935         #:text text
936         #:exclude (actor-id clerk)))
937   (define (loop-if-not-destructed)
938     (if (not (slot-ref clerk 'destructed))
939         ;; This iterates by "recursing" on itself by calling itself
940         ;; (as the message handler) again.  It used to be that we had to do
941         ;; this, because there was a bug where a loop which yielded like this
942         ;; would keep growing the stack due to some parameter goofiness.
943         ;; That's no longer true, but there's an added advantage to this
944         ;; route: it's much more live hackable.  If we change the definition
945         ;; of this method, the character will act differently on the next
946         ;; "tick" of the loop.
947         (<- (actor-id clerk) 'update-loop)))
948   (match (slot-ref clerk 'state)
949     ('slacking
950      (tell-room (random-choice clerk-slacking-texts))
951      (8sleep (+ (random 20) 15))
952      (loop-if-not-destructed))
953     ('on-duty
954      (if (> (slot-ref clerk 'patience) 0)
955          ;; Keep working but lose patience gradually
956          (begin
957            (tell-room (random-choice clerk-working-impatience-texts))
958            (slot-set! clerk 'patience (- (slot-ref clerk 'patience)
959                                          (+ (random 2) 1)))
960            (8sleep (+ (random 60) 40))
961            (loop-if-not-destructed))
962          ;; Back to slacking
963          (begin
964            (tell-room clerk-slack-excuse-text)
965            ;; back bto the break room
966            (gameobj-set-loc! clerk (dyn-ref clerk 'break-room))
967            (tell-room clerk-return-to-slacking-text)
968            ;; annnnnd back to slacking
969            (slot-set! clerk 'state 'slacking)
970            (8sleep (+ (random 30) 15))
971            (loop-if-not-destructed))))))
972
973
974 (define break-room
975   (lol
976    ('break-room
977     <room> #f
978     #:name "Employee Break Room"
979     #:desc "  This is less a room and more of an outdoor wire cage.  You get
980 a bit of a view of the brick exterior of the building, and a crisp wind blows,
981 whistling, through the openings of the fenced area.  Partly smoked cigarettes
982 and various other debris cover the floor.
983   Through the wires you can see... well... hm.  It looks oddly like
984 the scenery tapers off nothingness.  But that can't be right, can it?"
985     #:exits
986     (list (make <exit>
987             #:name "north"
988             #:to 'smoking-parlor)))
989    ('break-room:desk-clerk
990     <desk-clerk> 'break-room
991     #:name "the hotel desk clerk"
992     #:desc "  The hotel clerk is wearing a neatly pressed uniform bearing the
993 hotel insignia.  She appears to be rather exhausted."
994     #:goes-by '("hotel desk clerk" "clerk" "desk clerk"))
995    ('break-room:void
996     <gameobj> 'break-room
997     #:invisible? #t
998     #:name "The Void"
999     #:desc "As you stare into the void, the void stares back into you."
1000     #:goes-by '("void" "abyss" "nothingness" "scenery"))
1001    ('break-room:fence
1002     <gameobj> 'break-room
1003     #:invisible? #t
1004     #:name "break room cage"
1005     #:desc "It's a mostly-cubical wire mesh surrounding the break area.
1006 You can see through the gaps, but they're too small to put more than a
1007 couple of fingers through.  There appears to be some wear and tear to
1008 the paint, but the wires themselves seem to be unusually sturdy."
1009     #:goes-by '("fence" "cage" "wire cage"))))
1010
1011
1012 \f
1013 ;;; Ennpie's Sea Lounge
1014 ;;; -------------------
1015
1016 \f
1017 ;;; Computer room
1018 ;;; -------------
1019
1020 ;; Our computer and hard drive are based off the PDP-11 and the RL01 /
1021 ;; RL02 disk drives.  However we increment both by .5 (a true heresy)
1022 ;; to distinguish both from the real thing.
1023
1024 (define-actor <hard-drive> (<gameobj>)
1025   ((cmd-put-in hard-drive-insert)
1026    (cmd-push-button hard-drive-push-button)
1027    (get-state hard-drive-act-get-state))
1028   (commands #:allocation #:each-subclass
1029             #:init-thunk (build-commands
1030                           ("insert" ((prep-indir-command cmd-put-in
1031                                                          '("in" "inside" "into"))))
1032                           (("press" "push") ((prep-indir-command cmd-push-button)))))
1033   ;; the state moves from: empty -> with-disc -> loading -> ready
1034   (state #:init-value 'empty
1035          #:accessor .state))
1036
1037 (define (hard-drive-act-get-state hard-drive message)
1038   (<-reply message (.state hard-drive)))
1039
1040 (define* (hard-drive-desc hard-drive #:optional whos-looking)
1041   `((p "The hard drive is labeled \"RL02.5\".  It's a little under a meter tall.")
1042     (p "There is a slot where a disk platter could be inserted, "
1043        ,(if (eq? (.state hard-drive) 'empty)
1044             "which is currently empty"
1045             "which contains a glowing platter")
1046        ". There is a LOAD button "
1047        ,(if (member (.state hard-drive) '(empty with-disc))
1048             "which is glowing"
1049             "which is pressed in and unlit")
1050        ". There is a READY indicator "
1051        ,(if (eq? (.state hard-drive) 'ready)
1052             "which is glowing."
1053             "which is unlit.")
1054        ,(if (member (.state hard-drive) '(loading ready))
1055             "  The machine emits a gentle whirring noise."
1056             ""))))
1057
1058 (define* (hard-drive-push-button gameobj message
1059                                  #:key direct-obj indir-obj preposition
1060                                  (player (message-from message)))
1061   (define (tell-room text)
1062     (<-wait (gameobj-loc gameobj) 'tell-room
1063             #:text text))
1064   (define (tell-room-excluding-player text)
1065     (<-wait (gameobj-loc gameobj) 'tell-room
1066             #:text text
1067             #:exclude player))
1068   (cond
1069    ((ci-member direct-obj '("button" "load button" "load"))
1070     (tell-room-excluding-player
1071      `(,(mbody-val (<-wait player 'get-name))
1072        " presses the button on the hard disk."))
1073     (<- player 'tell
1074         #:text "You press the button on the hard disk.")
1075
1076     (case (.state gameobj)
1077       ((empty)
1078        ;; I have no idea what this drive did when you didn't have a platter
1079        ;; in it and pressed load, but I know there was a FAULT button.
1080        (tell-room "You hear some movement inside the hard drive...")
1081        (8sleep 1.5)
1082        (tell-room
1083         '("... but then the FAULT button blinks a couple times. "
1084           "What could be missing?")))
1085       ((with-disc)
1086        (set! (.state gameobj) 'loading)
1087        (tell-room "The hard disk begins to spin up!")
1088        (8sleep 2)
1089        (set! (.state gameobj) 'ready)
1090        (tell-room "The READY light turns on!"))
1091       ((loading ready)
1092        (<- player 'tell
1093            #:text '("Pressing the button does nothing right now, "
1094                     "but it does feel satisfying.")))))
1095    (else
1096     (<- player 'tell
1097         #:text '("How could you think of pressing anything else "
1098                  "but that tantalizing button right in front of you?")))))
1099
1100 (define* (hard-drive-insert gameobj message
1101                             #:key direct-obj indir-obj preposition
1102                             (player (message-from message)))
1103   (define our-name (slot-ref gameobj 'name))
1104   (define this-thing
1105     (call/ec
1106      (lambda (return)
1107        (for-each (lambda (occupant)
1108                    (define goes-by (mbody-val (<-wait occupant 'goes-by)))
1109                    (when (ci-member direct-obj goes-by)
1110                      (return occupant)))
1111                  (mbody-val (<-wait player 'get-occupants)))
1112        ;; nothing found
1113        #f)))
1114   (cond
1115    ((not this-thing)
1116     (<- player 'tell
1117         #:text `("You don't seem to have any such " ,direct-obj " to put "
1118                  ,preposition " " ,our-name ".")))
1119    ((not (mbody-val (<-wait this-thing 'get-prop 'hd-platter?)))
1120     (<- player 'tell
1121         #:text `("It wouldn't make sense to put "
1122                  ,(mbody-val (<-wait this-thing 'get-name))
1123                  " " ,preposition " " ,our-name ".")))
1124    ((not (eq? (.state gameobj) 'empty))
1125     (<- player 'tell
1126         #:text "The disk drive already has a platter in it."))
1127    (else
1128     (set! (.state gameobj) 'with-disc)
1129     (<- player 'tell
1130         #:text '((p "You insert the glowing disc into the drive.")
1131                  (p "The LOAD button begins to glow."))))))
1132
1133 ;; The computar
1134 (define-actor <computer> (<gameobj>)
1135   ((cmd-run-program computer-run-program)
1136    (cmd-run-what (lambda (gameobj message . _)
1137                    (<- (message-from message) 'tell
1138                        #:text '("The computer is already running, and a program appears "
1139                                 "ready to run."
1140                                 "you mean to \"run the program on the computer\"")))))
1141   (commands #:allocation #:each-subclass
1142             #:init-thunk (build-commands
1143                           ("run" ((prep-indir-command cmd-run-program
1144                                                       '("on"))
1145                                   (direct-command cmd-run-what))))))
1146
1147 (define* (computer-run-program gameobj message
1148                                #:key direct-obj indir-obj preposition
1149                                (player (message-from message)))
1150   (define (hd-state)
1151     (mbody-val (<-wait (dyn-ref gameobj 'computer-room:hard-drive) 'get-state)))
1152   (define (tell-room text)
1153     (<-wait (gameobj-loc gameobj) 'tell-room
1154         #:text text))
1155   (define (tell-room-excluding-player text)
1156     (<-wait (gameobj-loc gameobj) 'tell-room
1157             #:text text
1158             #:exclude player))
1159   (define (tell-player text)
1160     (<-wait player 'tell
1161             #:text text))
1162   (cond
1163    ((ci-member direct-obj '("program"))
1164     (tell-room-excluding-player
1165      `(,(mbody-val (<-wait player 'get-name))
1166        " runs the program loaded on the computer..."))
1167     (tell-player "You run the program on the computer...")
1168
1169     (cond
1170      ((not (eq? (hd-state) 'ready))
1171       (tell-room '("... but it errors out. "
1172                    "It seems to be complaining about a " (b "DISK ERROR!")
1173                    ". It looks like it is missing some essential software.")))
1174      (else
1175       (<- (dyn-ref gameobj 'computer-room:floor-panel) 'open-up))))))
1176
1177
1178 ;; floor panel
1179 (define-actor <floor-panel> (<gameobj>)
1180   ;; TODO: Add "open" verb, since obviously people will try that
1181   ((open? (lambda (panel message)
1182             (<-reply message (slot-ref panel 'open))))
1183    (open-up floor-panel-open-up))
1184   (open #:init-value #f))
1185
1186 (define (floor-panel-open-up panel message)
1187   (if (slot-ref panel 'open)
1188       (<- (gameobj-loc panel) 'tell-room
1189           #:text '("You hear some gears grind around the hinges of the "
1190                    "floor panel, but it appears to already be open."))
1191       (begin
1192         (slot-set! panel 'open #t)
1193         (<- (gameobj-loc panel) 'tell-room
1194             #:text '("You hear some gears grind, as the metal panel on "
1195                      "the ground opens and reveals a stairwell going down!")))))
1196
1197 (define* (floor-panel-desc panel #:optional whos-looking)
1198   `("It's a large metal panel on the floor in the middle of the room. "
1199     ,(if (slot-ref panel 'open)
1200          '("It's currently wide open, revealing a spiraling staircase "
1201            "which descends into darkness.")
1202          '("It's currently closed shut, but there are clearly hinges, and "
1203            "it seems like there is a mechanism which probably opens it via "
1204            "some automation.  What could be down there?"))))
1205
1206 (define computer-room
1207   (lol
1208    ('computer-room
1209     <room> #f
1210     #:name "Computer Room"
1211     #:desc (lambda (gameobj whos-looking)
1212              (define panel-open
1213                (mbody-val (<-wait (dyn-ref gameobj 'computer-room:floor-panel)
1214                                   'open?)))
1215              `((p "A sizable computer cabinet covers a good portion of the left
1216  wall.  It emits a pleasant hum which covers the room like a warm blanket.
1217  Connected to a computer is a large hard drive.")
1218                (p "On the floor is a large steel panel.  "
1219                   ,(if panel-open
1220                        '("It is wide open, exposing a spiral staircase "
1221                          "which descends into darkness.")
1222                        '("It is closed, but it has hinges which "
1223                          "suggest it could be opened.")))))
1224     #:exits
1225     (list (make <exit>
1226             #:name "east"
1227             #:to 'playroom)
1228           (make <exit>
1229             #:name "down"
1230             #:to 'underground-lab
1231             #:traverse-check
1232             (lambda (exit room whos-exiting)
1233               (define panel-open
1234                 (mbody-val (<-wait (dyn-ref room 'computer-room:floor-panel)
1235                                    'open?)))
1236               (if panel-open
1237                   (values #t "You descend the spiral staircase.")
1238                   (values #f '("You'd love to go down, but the only way "
1239                                "through is through that metal panel, "
1240                                "which seems closed.")))))))
1241    ('computer-room:hard-drive
1242     <hard-drive> 'computer-room
1243     #:name "the hard drive"
1244     #:desc (wrap-apply hard-drive-desc)
1245     #:goes-by '("hard drive" "drive" "hard disk"))
1246    ('computer-room:computer
1247     <computer> 'computer-room
1248     #:name "the computer"
1249     #:desc '((p "It's a coat closet sized computer labeled \"PDP-11.5\". ")
1250              (p "The computer is itself turned on, and it looks like it is "
1251                 "all set up for you to run a program on it."))
1252     #:goes-by '("computer"))
1253    ('computer-room:floor-panel
1254     <floor-panel> 'computer-room
1255     #:name "a floor panel"
1256     #:desc (wrap-apply floor-panel-desc)
1257     #:invisible? #t
1258     #:goes-by '("floor panel" "panel"))))
1259
1260 \f
1261 ;;; * UNDERGROUND SECTION OF THE GAME! *
1262
1263 \f
1264 ;;; The lab
1265
1266 (define underground-map-text
1267   "\
1268                             _______           |
1269                          .-' @     '-.         \\   ?????
1270                        .'             '.       .\\             
1271                        |  [8sync Hive] |======'  '-_____
1272                        ',      M      ,'
1273                         '.         @ .'                                  
1274                           \\  @     /                    
1275                            '-__+__-'                
1276                             '.  @ .'
1277      .--------------.         \\ /
1278      | [Guile Async |  .-------+------.
1279      |    Museum]   |  |     [Lab] #!#|  .-------------.
1280      |             @|  |  MM          |  |[Federation  |
1281      | &      ^     +##+@ ||     <    +##|     Station]|
1282      |              |  |           @  |  |             |
1283      |         &  # |  |*You-Are-Here*|  '-------------'
1284      | #   ^        | #+-------+------'
1285      '-------+------' #        #
1286              #        #        #
1287              #        #   .-----------.
1288            .-+----.   #   |#       F  |
1289            |@?+%? +####   | ^   f##   |
1290            '------'       |  f    f  %|
1291                           |F [Mudsync |
1292                           | $  Swamp] |
1293                           '-----------'")
1294
1295 (define underground-lab
1296   (lol
1297    ('underground-lab
1298     <room> #f
1299     #:name "Underground laboratory"
1300     #:desc '("This appears to be some sort of underground laboratory. "
1301              )
1302     #:exits
1303     (list (make <exit>
1304             #:name "up"
1305             #:to 'computer-room
1306             #:traverse-check
1307             (lambda (exit room whos-exiting)
1308               (values #t "You climb the spiral staircase.")))))
1309
1310    ;; Test tubes
1311    ;; map
1312    ('underground-lab:map
1313     <readable> 'underground-lab
1314     #:name "the underground map"
1315     #:desc '("This appears to be a map of the surrounding area. "
1316              "You could read it if you want to.")
1317     #:read-text `(pre ,underground-map-text)
1318     #:goes-by '("map" "underground map" "lab map"))))
1319
1320
1321
1322
1323
1324 \f
1325 ;;; Game
1326 ;;; ----
1327
1328 (define (game-spec)
1329   (append lobby grand-hallway smoking-parlor
1330           playroom break-room computer-room underground-lab))
1331
1332 ;; TODO: Provide command line args
1333 (define (run-game . args)
1334   (run-demo (game-spec) 'lobby #:repl-server #t))
1335