Import the source code submitted to IntroComp 2019
[homeland.git] / src / objects / neighborlivingroom.inf
1 ! Copyright (C) 2019 Jason Self <j@jxself.org>
2 !
3 ! This file is free software: you may copy, redistribute gand/or
4 ! modify it under the terms of the GNU Affero General Public License
5 ! as published by the Free Software Foundation, either version 3 of
6 ! the License, or (at your option) any later version.
7 !
8 ! This file is distributed in the hope that it will be useful, but
9 ! WITHOUT ANY WARRANTY; without even the implied warranty of
10 ! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 ! Affero General Public License for more details.
12 !
13 ! You should have received a copy of the GNU Affero General Public
14 ! License along with this file. If not, see https://gnu.org/licenses/
15
16 Object  neighborlivingroom "Neighbor's Livingroom"
17   with  description 
18             "You are in your neighor's livingroom. It seems that no 
19             one has lived here in a long time, even though you saw 
20             your neighbor here last week. All of the furniture has 
21             been removed and the air smells stale. There's another 
22             room to the north. A door is to the east.^^A machine as 
23             tall as you sits in the center of their livingroom. It 
24             consists of three transparent spheres joined together 
25             containing machinery. A barrel with a small aperture comes 
26             out of the farthest sphere, pointing down and to the wall. 
27             The entire thing rests on a shiny metal platform allowing 
28             it to rotate and tilt with ease.",
29         w_to neighborkitchen,
30         e_to neighbordoor,
31         n_to grandlivingroom,
32         before [;
33           Go:
34             if (bluebutton has on && poker notin machine) {
35                 machine.shoot();
36                 rtrue;
37             }
38         ],
39   has   light;
40
41 Object  redbutton "red button" neighborlivingroom
42   with  name 'red' 'red button' 'button' 'buttons',
43         before [;
44           Push:
45             if (bluebutton has on && poker notin machine) {
46                 print 
47                     "You reach for the red button, but not in 
48                     time...^ ";
49                 machine.shoot();
50                 rtrue;
51             }
52             if (poker in machine)
53                 print_ret 
54                     "You press the red button but it's futile because 
55                     the machine's shorted out.";
56             else {
57                 print 
58                     "You push the red button. The machine makes clunky 
59                     noises as machinery moves inside. A loud humming 
60                     begins to emanate from it. It comes to life, spins 
61                     around on its base, aims, and quickly fires a 
62                     series of three bright blue sparks at you. You 
63                     hear a small explosive sound as they impact your 
64                     chest. You feel a little disoriented as it 
65                     teleports you away.^";
66                 PlayerTo(campsite);
67                 rtrue;
68             }
69         ],
70   has   scenery;
71
72 Object  bluebutton "blue button" neighborlivingroom
73   with  name 'blue' 'blue button' 'button' 'buttons',
74         before [;
75           Push:
76             if (bluebutton has on) {
77                 if (poker notin machine) {
78                     print 
79                         "You reach for the blue button, but not 
80                         in time...^ ";
81                     machine.shoot();
82                     rtrue;
83                 }
84                 else {
85                     give bluebutton ~on;
86                     print_ret "You push the blue button.";
87                 }
88             }
89             else {
90                 give bluebutton on;
91                 if (poker notin machine) {
92                     machine.shoot();
93                     rtrue;
94                 }
95                 print_ret "You push the blue button.";
96             }
97         ],
98   has   scenery on;
99
100 Object  machine "machine" neighborlivingroom
101   with  name 'machine' 'machinery' 'sphere' 'spheres' 'platform' 'barrel'
102         'aperture' 'metal platform' 'shiny metal platform' 'shiny platform'
103         'shiny' 'metal',
104         description 
105             "It consists of three transparent spheres joined together 
106             containing machinery. A barrel with a small aperture comes 
107             out of the farthest sphere, pointing down and to the wall. 
108             The entire thing rests on a shiny metal platform allowing 
109             it to rotate and tilt with ease. There is a blue button 
110             and a red button.",
111         time_left,
112         before [ weapon;
113           Attack:
114             if (noun == self)
115                 weapon = second;
116             else
117                 weapon = noun;
118             if (weapon ~= poker) {
119                 print "That wasn't helpful.^";
120                 if (bluebutton has on)
121                     self.shoot();
122                 rtrue;
123             }
124             self.shortout();
125             return true;
126           Receive:
127             if (noun == poker) {
128                 self.shortout();
129                 return true;
130             }
131             if (bluebutton has on)
132                 self.shoot();
133             rtrue;
134         ],
135         time_out [;
136             if (poker in self)
137                 StopTimer(machine);
138             else
139                 if (bluebutton has on)
140                     self.shoot();
141         ],
142         daemon [;
143             if (poker in player)
144                 rfalse;
145             if (player in parent(self) && poker notin machine)
146                 self.shoot();
147         ],
148         shoot [ destination;
149             destination = random(3);
150             print 
151                 "^A loud humming begins to emanate from the machine. 
152                 It comes to life, spins around on its base, aims, and 
153                 quickly fires a series of three bright blue sparks at 
154                 you. You hear a small explosive sound as they impact 
155                 your chest. You feel a little disoriented as it 
156                 teleports you away.^";
157             if (destination == 1)
158                 PlayerTo(kitchen);
159             if (destination == 2)
160                 PlayerTo(livingroom);
161             if (destination == 3)
162                 PlayerTo(bedroom);
163         ],
164         shortout [;
165             if (machine hasnt visited) {
166                 score = score + 1;
167                 give machine visited;
168             }
169             move poker to self;
170             print "You put the poker into ", (the) self, 
171                 ". Sparks 
172                 fly wildly in every direction as it shorts out.^";
173         ],
174   has   scenery container open;