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-class <locked-cabinet> (<gameobj>)
73 (define-mhandler (npc-chat-randomly actor message)
75 (format #f "~a says: \"~a\"\n"
76 (slot-ref actor 'name)
77 (random-choice (slot-ref actor 'catchphrases))))
78 (<- actor (message-from message) 'tell
83 (direct-command "chat" 'cmd-chat)))
86 (cmd-chat (wrap-apply npc-chat-randomly))))
88 (define hotel-owner-grumps
89 '("Eight sinks! Eight sinks! And I couldn't unwind them..."
90 "Don't mind the mess. I built this place on a dare, you
92 "(*tearfully*) Here, take this parenthesis. May it serve
94 "I gotta get back to the goblin farm soon..."
95 "Oh, but I was going to make a mansion... a great,
96 beautiful mansion! Full of ghosts! Now all I have is this cruddy
97 mo... hotel. Oh... If only I had more time!"
98 "I told them to paint more of the walls purple.
99 Why didn't they listen?"
100 "Listen to that overhead muzak. Whoever made that doesn't
101 know how to compose very well! Have you heard of the bands 'fmt'
102 or 'skribe'? Now *that's* composition!"))
104 (define-class <chatty-npc> (<gameobj>)
105 (catchphrases #:init-value '("Blarga blarga blarga!")
106 #:init-keyword #:catchphrases)
108 #:init-value chat-commands)
111 (simple-dispatcher (append gameobj-actions chat-actions))))
119 " You're in some sort of hotel lobby. You see a large sign hanging
120 over the desk that says \"Hotel Bricabrac\". On the desk is a bell
121 that says \"ring for service\". Terrible music plays from a speaker
123 The room is lined with various curio cabinets, filled with all sorts
124 of kitschy junk. It looks like whoever decorated this place had great
125 ambitions, but actually assembled it all in a hurry and used whatever
126 kind of objects they found lying around.")
129 <chatty-npc> 'room:lobby
130 #:name "a frumpy fellow"
131 #:desc " Whoever this is, they looks totally exhausted. They're
132 collapsed into the only comfortable looking chair in the room and you
133 don't get the sense that they're likely to move any time soon.
134 You notice they're wearing a sticker badly adhesed to their clothing
135 which says \"Hotel Proprietor\", but they look so disorganized that you
136 think that can't possibly be true... can it?
137 Despite their exhaustion, you sense they'd be happy to chat with you,
138 though the conversation may be a bit one sided."
139 #:goes-by '("frumpy fellow" "fellow"
140 "Chris Webber" ; heh, did you rtfc? or was it so obvious?
141 "hotel proprietor" "proprietor")
142 #:catchphrases hotel-owner-grumps)
143 ;; NPC: desk clerk (comes when you ring the s)
144 ;; impatient teenager, only stays around for a few minutes
145 ;; complaining, then leaves.
149 <readable> 'room:lobby
150 #:name "the Hotel Bricabrac sign"
151 #:desc " It strikes you that there's something funny going on with this sign.
152 Sure enough, if you look at it hard enough, you can tell that someone
153 hastily painted over an existing sign and changed the \"M\" to an \"H\".
155 #:read-text " All it says is \"Hotel Bricabrac\" in smudged, hasty text."
159 "hotel bricabrac sign"
164 ;; - Object: sign in form
165 ;; - Object: pamphlet
166 ;; Object: curio cabinets
167 ;; Object: <invisible bell>: reprimands that you want to ring the
185 ;; ... full of NURPH weapons?
193 ;;; Ennpie's Sea Lounge
194 ;;; -------------------
207 (define (run-game . args)
208 (run-demo "/tmp/bricabrac-game.db" game-spec 'room:lobby))