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
|
# File 'lib/IFMapper/IFMWriter.rb', line 133
def room(r)
return if @rooms.include?(r) or r == nil
@rooms << r
tag = get_tag(r, r.name)
@f.puts
@f.print "room \"#{r.name}\" tag #{tag}"
if not @link.empty?
if @link[3]
nolink(@last_room, r)
else
directions(@link[0], @link[1], @link[2])
if @last_room and @link[1] != @last_room
tag = get_tag(@link[1], @link[1].name)
@f.print " from #{tag}"
end
if @link[0].exitAtext != 0
dir = EXIT_TEXT[@link[0].exitAtext]
@f.print " go #{dir}"
end
if @link[0].dir == Connection::AtoB
@f.print " oneway"
end
if @link[0].type == Connection::SPECIAL
@f.print " style special"
end
end
end
@f.print ";\n"
@last_room = r
objs = r.objects.split("\n")
objs.each { |obj|
tag = get_tag(obj, obj)
@f.puts "\titem \"#{obj}\" tag #{tag};"
}
tasks = r.tasks.split("\n")
tasks.each { |task|
tag = get_tag(task, task)
@f.puts "\ttask \"#{task}\" tag #{tag};"
}
r.exits.each { |c|
next if not c or @links.include?(c)
if c.roomA == c.roomB
link(c)
next
end
if r == c.roomA
@link = [c, c.roomA, c.roomB]
room(c.roomB) else
@link = [c, c.roomB, c.roomA]
room(c.roomA) end
}
end
|