1 ;;; Mudsync --- Live hackable MUD
2 ;;; Copyright © 2016 Christopher Allan Webber <cwebber@dustycloud.org>
4 ;;; This file is part of Mudsync.
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.
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.
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/>.
21 (use-modules (mudsync)
22 (8sync systems actors)
29 ;;; Utilities, useful or otherwise
30 ;;; ==============================
32 (set! *random-state* (random-state-from-platform))
34 (define (random-choice lst)
35 (list-ref lst (random (length lst))))
37 ;; list of lists, lol.
38 (define-syntax-rule (lol (list-contents ...) ...)
39 (list (list list-contents ...) ...))
42 ;;; Some simple object types.
43 ;;; =========================
45 (define readable-commands
47 (direct-command "read" 'cmd-read)))
48 (define readable-actions
50 (cmd-read (wrap-apply readable-cmd-read))))
52 (define-class <readable> (<gameobj>)
53 (read-text #:init-value "All it says is: \"Blah blah blah.\""
54 #:init-keyword #:read-text)
56 #:init-value readable-commands)
59 (simple-dispatcher (append gameobj-actions readable-actions))))
61 (define (readable-cmd-read actor message)
62 (<- actor (message-from message) 'tell
63 #:text (string-append (slot-ref actor 'read-text) "\n")))
70 (define-mhandler (npc-chat-randomly actor message)
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
80 (direct-command "chat" 'cmd-chat)))
83 (cmd-chat (wrap-apply npc-chat-randomly))))
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
89 "(*tearfully*) Here, take this parenthesis. May it serve
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!"))
101 (define-class <chatty-npc> (<gameobj>)
102 (catchphrases #:init-value '("Blarga blarga blarga!")
103 #:init-keyword #:catchphrases)
105 #:init-value chat-commands)
108 (simple-dispatcher (append gameobj-actions chat-actions))))
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"))
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
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."
138 #:to-symbol 'room:grand-hallway)))
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.
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\".
167 #:read-text " All it says is \"Hotel Bricabrac\" in smudged, hasty text."
171 "hotel bricabrac sign"
174 ;; Object: curio cabinets
176 <gameobj> 'room:lobby
177 #:name "a curio cabinet"
178 #:goes-by '("curio cabinet" "cabinet" "bricabrac cabinet")
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))))
186 ;; - Object: sign in form
187 ;; - Object: pamphlet
188 ;; Object: <invisible bell>: reprimands that you want to ring the
198 (define grand-hallway
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?"
211 #:to-symbol 'room:lobby))
226 ;; ... full of NURPH weapons?
234 ;;; Ennpie's Sea Lounge
235 ;;; -------------------
246 (append lobby grand-hallway))
248 (define (run-game . args)
249 (run-demo "/tmp/bricabrac-game.db" game-spec 'room:lobby))