-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrooms.lua
488 lines (421 loc) · 10.8 KB
/
rooms.lua
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
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
rooms = {}
things = {}
hidingContainers = {};
hidingSupporters = {};
function addHidingContainer(obj)
hidingContainers[#hidingContainers+1] = obj;
end
function addHidingSupporter(obj)
hidingSupporters[#hidingSupporters+1] = obj;
end
----------------------------------------
rooms.livingroom = luaIf.Room:new{
short = "living room";
desc = [[
The main living space on the first floor.
The dining room lies to the south. The bonus room to the north. The
front door leading to the pourch is to the west. The kitchen is
east. You can take the stairs up to the second floor.
]];
}
things.couch = luaIf.Thing:new{
short = "couch";
desc = [[
A brown leather couch.
]];
name = {"brown", "leather", "couch"};
supports = {};
fixed = true;
};
rooms.livingroom:placeIn(things.couch);
addHidingSupporter(things.couch);
things.chest = luaIf.Thing:new{
short = "plastic chest";
desc = [[
A beige plastic chest with a green lid.
]];
name = {"beige", "plastic", "chest"};
openable = true;
contains = {};
supports = {};
fixed = true;
before_open = function(self)
if(#self.supports > 0) then
io.write("You can't open it without knocking the stuff on top of it on the floor.\n");
return true;
end
end;
before_place_on = function(self, obj)
if(self.open) then
io.write("It falls in\n");
self:placeIn(obj);
return true;
end
end;
};
rooms.livingroom:placeIn(things.chest);
addHidingContainer(things.chest);
----------------------------------------
rooms.diningroom = luaIf.Room:new{
short = "dining room";
desc = [[
This room might be better described as the game room, since board
games is it's main purpose. Today, however, is an exception. The table
is set and ready for the meal.
The kitchen is east of here. The living room is to the north.
]]; --'
};
rooms.livingroom.south = rooms.diningroom;
rooms.diningroom.north = rooms.livingroom;
things.table = luaIf.Thing:new{
short = "dining room table";
desc = [[
A large wooden table.
]];
name={"diningroom", "dining", "wooden", "table"};
supports = {};
fixed = true;
};
rooms.diningroom:placeIn(things.table);
addHidingSupporter(things.table);
--------------------------------------
rooms.kitchen = luaIf.Room:new{
short = "kitchen";
desc = [[
The kitchen is where you should be cooking the big meal, but where is the food?
The dining room is to the west. The living room is north. You can go upstairs from here.
]];
};
rooms.livingroom.east = rooms.kitchen;
rooms.kitchen.north = rooms.livingroom;
rooms.diningroom.east = rooms.kitchen;
rooms.kitchen.west = rooms.diningroom;
things.cabinets = luaIf.Thing:new{
short = "cabinets";
desc = [[
The kitchen cabinets.
]];
name = {"kitchen", "cabinets"};
contians = {};
open = false;
openable = true;
fixed = true;
plural = true;
};
rooms.kitchen:placeIn(things.cabinets);
addHidingContainer(things.cabinets);
things.fridge = luaIf.Thing:new{
short = "refridgerator";
desc = [[
The good old fridge. Why isn't the food in here?
]];
name = {"refridgerator", "fridge"};
fixed = true;
contains = {};
open = false;
openable = true;
};
rooms.kitchen:placeIn(things.fridge);
things.sink = luaIf.Thing:new{
short = "kitchen sink";
desc = [[
It has a deep basin and a tap.
]];
name = {"kitchen", "sink"};
fixed = true;
contains = {};
open = true;
openable = false;
};
rooms.kitchen:placeIn(things.sink);
addHidingContainer(things.sink);
------------------------------------
rooms.bonus = luaIf.Room:new{
short = "bonus room";
desc = [[
The realater listed this room as a "bonus room." You've never quite
been sure what to do with it, so it's become a dumping ground for
all half-finished projects.
The living room is west of here. The bathroom is south of here.
]];
};
rooms.bonus.west = rooms.livingroom;
rooms.livingroom.north = rooms.bonus;
things.bonusTable = luaIf.Thing:new{
short = "table";
desc = [[
A small wooden table.
]];
name = {"small", "wooden", "table"};
fixed = true;
supports = {};
};
rooms.bonus:placeIn(things.bonusTable);
things.printer = luaIf.Thing:new{
short = "3d printer";
desc = [[
A 3d printer that can produce things out of plastic.
]];
name = {"3d", "printer"};
};
things.bonusTable:placeOn(things.printer);
--------------------------------
rooms.ffbathroom = luaIf.Room:new{
short = "first floor bathroom";
desc = [[
A small bathroom with a shower.
The bonus room is north of here.
]];
};
rooms.ffbathroom.north = rooms.bonus;
rooms.bonus.south = rooms.ffbathroom;
things.fftoilet = luaIf.Thing:new{
short = "toilet";
desc = [[
The porcalin goddess.
]];
name = {"toilet"};
contains = {};
open = true;
openable = true;
fixed = true;
};
rooms.ffbathroom:placeIn(things.fftoilet);
addHidingContainer(things.fftoilet);
things.ffsink = luaIf.Thing:new{
short = "sink";
desc = [[
The sink sits in a cabinet with a door on the front.
]];
name = {"cabinet", "sink"};
openable = true;
contains = {};
fixed = true;
};
rooms.ffbathroom:placeIn(things.ffsink);
addHidingContainer(things.ffsink);
-------------------------------
rooms.frontpourch = luaIf.Room:new{
short="front pourch";
desc = [[
A covered pourch adorns the front of the house.
The front yard is to the west. You can enter the house to the east.
]];
alert_go = function(self, dir)
if(dir == "west") then
io.write("Where do you think you're going? There's food to cook!\n");
return true;
end
end;
};
rooms.livingroom.west = rooms.frontpourch;
rooms.frontpourch.east = rooms.livingroom;
things.package = luaIf.Thing:new{
short = "package";
pronoun = "a";
desc = [[
A package from Amazon addressed to you.
]];
name = {"amazon", "package"};
open = false;
openable = true;
contains = {};
};
rooms.frontpourch:placeIn(things.package);
addHidingContainer(things.package);
things.book = luaIf.Thing:new{
short = "cookbook";
desc = [[
The Way to Cook by Julia Child..
]];
name = {"cookbook", "book"};
after_take = function(self)
if(not self.taken) then
self.taken = true;
luaIf.current.score = luaIf.current.score + 5;
io.write("That should come in handy\n");
return true;
end
end
}
things.package:placeIn(things.book);
--------------------------------
rooms.upstairshall = luaIf.Room:new{
short="upstairs hall";
desc = [[
A small hallway connecting the rooms of the second floor.
A bathroom is to the south. The master bedroom is to the
west. Nathan's room is to the north. The office is to the east. you
can take the stairs down to the first floor.
]]; --'
};
rooms.upstairshall.down = rooms.livingroom;
rooms.livingroom.up = rooms.upstairshall;
rooms.kitchen.up = rooms.upstairshall;
---------------------------------
rooms.upstairsbathroom = luaIf.Room:new{
short = "upstairs bathroom";
desc = [[
The upstairs bathroom is larger than the downstairs bathroom.
You can exit the bathroom to the north.
]];
};
rooms.upstairsbathroom.north = rooms.upstairshall;
rooms.upstairshall.south = rooms.upstairsbathroom;
things.bathtub = luaIf.Thing:new{
short="bathtub";
name = {"bathtub", "tub"};
details = function(self)
if(self.filled) then
return "It apears to be filled ready for a bubble bath.";
else
return "An empty bathtub.\n";
end
end;
phrase = function(self, pronoun, cap)
local res = self:parent().phrase(self, pronoun, cap);
if(self.filled) then
res = res.." (full)";
else
res = res.." (drained)";
end
return res;
end;
fixed = true;
filled = true;
openable = false;
open = false;
contains = {};
};
rooms.upstairsbathroom:placeIn(things.bathtub);
addHidingContainer(things.bathtub);
things.uptoilet = luaIf.Thing:new{
short = "toilet";
desc = [[
The porcalin goddess.
]];
name = {"toilet"};
contains = {};
open = false;
openable = true;
fixed = true;
after_open = function(self)
io.write("You take the lid off the tank.\n");
return true;
end
};
rooms.upstairsbathroom:placeIn(things.uptoilet);
addHidingContainer(things.uptoilet);
things.upsink = luaIf.Thing:new{
short = "sink";
desc = [[
The sink sits in a cabinet with a door on the front.
]];
name = {"cabinet", "sink"};
openable = true;
contains = {};
fixed = true;
};
rooms.upstairsbathroom:placeIn(things.upsink);
addHidingContainer(things.upsink);
---------------------------------
rooms.masterbedroom = luaIf.Room:new{
short = "master bedroom";
desc = [[
The room is dominated by a large bed in the center.
You can exit to the east.
]];
};
rooms.masterbedroom.east = rooms.upstairshall;
rooms.upstairshall.west = rooms.masterbedroom;
things.masterbed = luaIf.Thing:new{
short = "bed";
desc = [[
A large bed sits in the middle of the room.
]];
name = {"bed"};
fixed = true;
supports = {};
};
rooms.masterbedroom:placeIn(things.masterbed);
addHidingSupporter(things.masterbed);
things.dresser = luaIf.Thing:new{
short = "dresser";
desc = [[
A lovely antique dresser.
]];
name = {"dresser", "antique"};
fixed = true;
contains = {};
open = false;
openable = true;
}
rooms.masterbedroom:placeIn(things.dresser);
addHidingContainer(things.dresser);
------------------------------------
rooms.nathansroom = luaIf.Room:new{
short = "nathan's room";
desc = [[
A bed is pushed in the corner. Stuff is piled here and there.
You can exit to the south.
]];
};
rooms.nathansroom.south = rooms.upstairshall;
rooms.upstairshall.north = rooms.nathansroom;
things.natbed = luaIf.Thing:new{
short = "bed";
desc = [[
Nathan's bed is in the corner of the room.
]];
name = {"nathan's", "bed"};
supports = {};
fixed = true;
};
rooms.nathansroom:placeIn(things.natbed);
addHidingSupporter(things.natbed);
things.bookshelf = luaIf.Thing:new{
short = "bookshelf";
desc = "A tall bookshelf.\n";
name = {"tall", "bookshelf"};
fixed = true;
supports = {};
}
rooms.nathansroom:placeIn(things.bookshelf);
addHidingSupporter(things.bookshelf);
-----------------------------
rooms.office = luaIf.Room:new{
short = "Stacy's office";
desc = [[
This room is dedicated to Stacy's computer and all of the pets that
the cats want to eat.
You can exit to the west.
]];
};
rooms.office.west = rooms.upstairshall;
rooms.upstairshall.east = rooms.office;
things.ratcage = luaIf.Thing:new{
short = "rat cage";
desc = [[
A large rat cage containing Barack.
]];
name = {"rat", "cage"};
fixed = true;
openable = true;
open = false;
before_open = function()
io.write("You wouldn't want to let Barack out would you?\n");
return true;
end
};
rooms.office:placeIn(things.ratcage);
things.desk = luaIf.Thing:new{
short = "desk";
desc = [[
A desk with a computer.
]];
name={"computer", "desk"};
fixed = true;
supports = {};
}
rooms.office:placeIn(things.desk);
addHidingSupporter(things.desk);