-
Notifications
You must be signed in to change notification settings - Fork 1
/
STARSHIP.TYP
357 lines (252 loc) · 7.3 KB
/
STARSHIP.TYP
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
# STARSHIP.TYP
#
# Special type definitions used in STARSHIP.ACH .
include "utility"
type openable based on object
open : FALSE
methods
'TRANSPARENT' : open
'look' : {
writes "It is presently "
if open then write "open." else write "closed."
}
'look in' :
if 'TRANSPARENT' -> self then {
writes "I look inside ", 'DEF' -> self, ". "
'INVENTORY'
}
else if not open then
write "It's not open; I can't look inside."
else
write "I can't look inside that."
'open' :
if open then
write "I would but ", 'DEF' -> self, " is already open."
else {
open := TRUE
write "I opened ", 'DEF' -> self, "."
}
'close' :
if not open then
write "I would but ", 'DEF' -> self, " is already closed."
else {
open := FALSE
write "I closed ", 'DEF' -> self, "."
}
end
type wearable based on object
wearing : FALSE
methods
'INVENTORY NAME' :
if visible then
if wearing then
('INDEF' -> self) & " (which I'm wearing)"
else
'INDEF' -> self
'put_on' : 'wear'
'wear' :
if location ~= player then
write "I don't have ", pronoun, "."
else if wearing then
write "I'm already wearing ", 'DEF' -> self, "."
else {
write "I put on ", 'DEF' -> self, "."
wearing := TRUE
}
'take_off' : 'remove'
'remove' :
if wearing then {
write "I take off ", 'DEF' -> self, "."
wearing := FALSE
}
else
write "I'm not wearing ", 'DEF' -> self, "."
# And remember to change how drop works.
'drop' : {
if wearing then 'remove'
'drop' --> object
}
end
# Plural nouns or mass nouns.
# described as indefinite nouns.
type plural_noun based on object
pronoun : "them"
methods
'INDEF' :
"some " & desc
end
# large_structure
#
# This is a structure that you can enter, something much like a room but
# not accessible by the cardinal directions. You cannot 'get' this kind
# of object; the reason why not is given in the why_not attribute.
keyword PartOfRoom, PartOfFloor, FastenedDown, TooHeavy, Impossible
type large_structure based on hollow_object
why_not : PartOfRoom
methods
'look in' :
if 'TRANSPARENT' -> self then
message --> hollow_object
else if open = FALSE then
write "I can't look inside that; it isn't open."
else
write "I can't look inside that."
'get' : {
writes "I can't pick that up; "
case why_not of {
PartOfRoom : >>it's part of the room.
PartOfFloor : >>it's part of the floor.
FastenedDown : >>it's securely fastened down.
TooHeavy : >>it is much too heavy.
Impossible : >>it would be rather impossible.
}
}
end
type big_furniture based on furniture
methods
'look' : >>It looks big enough to go to.
'look in' : message --> large_structure
'get' :
>>That's too bulky to pick up.
end
type sit_furniture based on big_furniture
proximity : "on"
methods
'look' : >>Looks big enough to sit on.
'sit' : 'enter'
'sit on' : 'enter'
'sit onto' : 'enter'
'get onto' : 'enter'
'get up' : 'leave'
end
# visible_part
#
# These are things that are visible parts of other objects, such as latches
# or doorknobs. You can manipulate them otherwise but you cannot 'get' them.
# What it's part of is listed in part_of. "wall" is an enumerated constant
# meaning simply part of the surrounding walls.
keyword wall
type visible_part based on object
part_of : wall
methods
'get' : {
writes "I can't pick that up; it's part of "
if part_of = wall then
write "the wall."
else if 'DEF' -> part_of = UNDEFINED then
write part_of, "." # it will be text
else
write 'DEF' -> part_of, "."
}
end
type invisible_part based on visible_part
visible : FALSE
end
# Batteries-not-included objects.
type needs_batteries based on openable
IsAneeds_batteries : TRUE
contains : UNDEFINED
open : FALSE
methods
'TRANSPARENT' : open
'Insert Me' :
if not sender.IsApowersource then
write "I don't think ", 'DEF' -> sender, " is a power source."
else if not open then
write "I can't because ", 'DEF' -> self, " is not open."
else {
sender.location := self; 'MOVE' -> sender
write "I put ", 'DEF' -> sender, " into ", 'DEF' -> self, "."
}
'Change Open' :
main.verb --> openable
'look' :
if open then {
writes "It is presently open."
if contains then {
writes " There is ", 'INDEF' -> contains, " lying inside. "
writes "However it is not quite sitting flat; it probably would if "
writes "I closed ", 'DEF' -> self, "."
}
write
}
else
write "It is presently closed."
end
type powersource based on object
IsApowersource : TRUE
powered : TRUE
methods
'MOVE' :
if location.contains then {
write "There's ", 'INDEF' -> location, " in the way."
location := last_location
}
else {
if last_location.IsAneeds_batteries then
last_location.contains := UNDEFINED
'MOVE' --> object
if location.IsAneeds_batteries then location.contains := self
}
'put...in' :
if main.dobj.IsAneeds_batteries then
'Insert Me' -> main.dobj
else
message --> object
end
# gravhalf
#
# An object that is fitted with the other half of a gravlifting apparatus.
type gravhalf based on object
IsAgravhalf : TRUE
prev_weight : 0
outlet_filled : UNDEFINED
methods
'look' : {
writes "There's a slim green ring around the bottom with a "
writes "five-hole outlet in it"
if outlet_filled then {
write "; ", 'INDEF' -> outlet_filled, " is plugged into the outlet."
'MENTION SELF' -> outlet_filled
}
else
write "."
}
'Plug Into' : {
outlet_filled := sender
sender.location := self; 'MOVE' -> sender
if sender.location = self then {
write "I plugged ", 'DEF' -> sender, " into ", 'DEF' -> self, "."
if gravlifter.powered then {
prev_weight := size
size := 0
write "Lights around the tray on the bottom light up."
}
else
write "Nothing happens."
}
}
'Unplug From' : {
outlet_filled := UNDEFINED
sender.location := location; 'MOVE' -> sender
if sender.location = location then {
write "I unplugged ", 'DEF' -> sender, " from ", 'DEF' -> self, "."
if sender.powered then {
size := prev_weight
if location = player then {
writes "Oof! Suddenly ", 'DEF' -> self, " regains all of its "
write "previous weight and crashes to the floor!"
location := player.location; 'MOVE'
}
}
else
write "Nothing happens."
}
}
end
type readable based on object
viewed : FALSE
methods
'look' : >>There's writing on it.
'read' : >>I can't quite make out anything.
end