add the grand hallway
[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              (8sync systems actors)
23              (8sync agenda)
24              (oop goops)
25              (ice-9 format))
26
27
28 \f
29 ;;; Utilities, useful or otherwise
30 ;;; ==============================
31
32 (set! *random-state* (random-state-from-platform))
33
34 (define (random-choice lst)
35   (list-ref lst (random (length lst))))
36
37 ;; list of lists, lol.
38 (define-syntax-rule (lol (list-contents ...) ...)
39   (list (list list-contents ...) ...))
40
41 \f
42 ;;; Some simple object types.
43 ;;; =========================
44
45 (define readable-commands
46   (list
47    (direct-command "read" 'cmd-read)))
48 (define readable-actions
49   (build-actions
50    (cmd-read (wrap-apply readable-cmd-read))))
51
52 (define-class <readable> (<gameobj>)
53   (read-text #:init-value "All it says is: \"Blah blah blah.\""
54              #:init-keyword #:read-text)
55   (commands
56    #:init-value readable-commands)
57   (message-handler
58    #:init-value
59    (simple-dispatcher (append gameobj-actions readable-actions))))
60
61 (define (readable-cmd-read actor message)
62   (<- actor (message-from message) 'tell
63       #:text (string-append (slot-ref actor 'read-text) "\n")))
64
65
66 \f
67 ;;; Lobby
68 ;;; -----
69
70 (define-mhandler (npc-chat-randomly actor message)
71   (define text-to-send
72     (format #f "~a says: \"~a\"\n"
73             (slot-ref actor 'name)
74             (random-choice (slot-ref actor 'catchphrases))))
75   (<- actor (message-from message) 'tell
76       #:text text-to-send))
77
78 (define chat-commands
79   (list
80    (direct-command "chat" 'cmd-chat)))
81 (define chat-actions
82   (build-actions
83    (cmd-chat (wrap-apply npc-chat-randomly))))
84
85 (define hotel-owner-grumps
86   '("Eight sinks!  Eight sinks!  And I couldn't unwind them..."
87     "Don't mind the mess.  I built this place on a dare, you
88 know?"
89     "(*tearfully*) Here, take this parenthesis.  May it serve
90 you well."
91     "I gotta get back to the goblin farm soon..."
92     "Oh, but I was going to make a mansion... a great,
93 beautiful mansion!  Full of ghosts!  Now all I have is this cruddy
94 mo... hotel.  Oh... If only I had more time!"
95     "I told them to paint more of the walls purple.
96 Why didn't they listen?"
97     "Listen to that overhead muzak.  Whoever made that doesn't
98 know how to compose very well!  Have you heard of the bands 'fmt'
99 or 'skribe'?  Now *that's* composition!"))
100
101 (define-class <chatty-npc> (<gameobj>)
102   (catchphrases #:init-value '("Blarga blarga blarga!")
103                 #:init-keyword #:catchphrases)
104   (commands
105    #:init-value chat-commands)
106   (message-handler
107    #:init-value
108    (simple-dispatcher (append gameobj-actions chat-actions))))
109
110 (define random-bricabrac
111   '("a creepy porcelain doll"
112     "assorted 1950s robots"
113     "an exquisite tea set"
114     "an antique mustard pot"
115     "the pickled head of Elvis"
116     "the pickled circuitboard of EVLIS"
117     "a scroll of teletype paper holding the software Four Freedoms"
118     "a telephone shaped like an orange cartoon cat"))
119
120 (define lobby
121   (lol
122    ('room:lobby
123     <room> #f
124     #:name "Hotel Lobby"
125     #:desc
126     "  You're in some sort of hotel lobby.  You see a large sign hanging
127 over the desk that says \"Hotel Bricabrac\".  On the desk is a bell
128 that says \"ring for service\".  Terrible music plays from a speaker
129 somewhere overhead.
130   The room is lined with various curio cabinets, filled with all sorts
131 of kitschy junk.  It looks like whoever decorated this place had great
132 ambitions, but actually assembled it all in a hurry and used whatever
133 kind of objects they found lying around.
134   There's a door to the north leading to some kind of hallway."
135     #:exits
136     (list (make <exit>
137             #:name "north"
138             #:to-symbol 'room:grand-hallway)))
139    ;; NPC: hotel owner
140    ('npc:hotel-owner
141     <chatty-npc> 'room:lobby
142     #:name "a frumpy fellow"
143     #:desc "  Whoever this is, they looks totally exhausted.  They're
144 collapsed into the only comfortable looking chair in the room and you
145 don't get the sense that they're likely to move any time soon.
146   You notice they're wearing a sticker badly adhesed to their clothing
147 which says \"Hotel Proprietor\", but they look so disorganized that you
148 think that can't possibly be true... can it?
149   Despite their exhaustion, you sense they'd be happy to chat with you,
150 though the conversation may be a bit one sided."
151     #:goes-by '("frumpy fellow" "fellow"
152                 "Chris Webber"  ; heh, did you rtfc?  or was it so obvious?
153                 "hotel proprietor" "proprietor")
154     #:catchphrases hotel-owner-grumps)
155    ;; NPC: desk clerk (comes when you ring the s)
156    ;;   impatient teenager, only stays around for a few minutes
157    ;;   complaining, then leaves.
158    
159    ;; Object: Sign
160    ('thing:lobby-sign
161     <readable> 'room:lobby
162     #:name "the Hotel Bricabrac sign"
163     #:desc "  It strikes you that there's something funny going on with this sign.
164 Sure enough, if you look at it hard enough, you can tell that someone
165 hastily painted over an existing sign and changed the \"M\" to an \"H\".
166 Classy!"
167     #:read-text "  All it says is \"Hotel Bricabrac\" in smudged, hasty text."
168     #:goes-by '("sign"
169                 "bricabrac sign"
170                 "hotel sign"
171                 "hotel bricabrac sign"
172                 "lobby sign"))
173
174    ;; Object: curio cabinets
175    ('thing:cabinet
176     <gameobj> 'room:lobby
177     #:name "a curio cabinet"
178     #:goes-by '("curio cabinet" "cabinet" "bricabrac cabinet")
179     #:desc (lambda _
180              (format #f "  The curio cabinet is full of all sorts of oddities!
181 Something catches your eye!
182 Ooh, ~a!" (random-choice random-bricabrac))))
183
184    ;; Object: desk
185    ;;  - Object: bell
186    ;;  - Object: sign in form
187    ;;  - Object: pamphlet
188    ;; Object: <invisible bell>: reprimands that you want to ring the
189    ;;   bell on the desk
190    )
191   )
192
193
194 \f
195 ;;; Grand hallway
196 ;;; -------------
197
198 (define grand-hallway
199   (lol
200    ('room:grand-hallway
201     <room> #f
202     #:name "Grand Hallway"
203     #:desc "  A majestic red carpet runs down the center of the room.
204 Busts of serious looking people line the walls, but there's no
205 clear indication that they have any logical relation to this place.
206   To the south is the lobby.  All around are various doors, but
207 they're all boarded up.  Guess this is still a work in progress, huh?"
208     #:exits
209     (list (make <exit>
210             #:name "south"
211             #:to-symbol 'room:lobby))
212     )))
213
214 \f
215 ;;; Playroom
216 ;;; --------
217
218 \f
219 ;;; Writing room
220 ;;; ------------
221
222 \f
223 ;;; Armory???
224 ;;; ---------
225
226 ;; ... full of NURPH weapons?
227
228 \f
229 ;;; Smoking parlor
230 ;;; --------------
231
232
233 \f
234 ;;; Ennpie's Sea Lounge
235 ;;; -------------------
236
237 \f
238 ;;; Computer room
239 ;;; -------------
240
241 \f
242 ;;; Game
243 ;;; ----
244
245 (define game-spec
246   (append lobby grand-hallway))
247
248 (define (run-game . args)
249   (run-demo "/tmp/bricabrac-game.db" game-spec 'room:lobby))
250