source: trunk/game/utilities/layer_fill_utility.py @ 391

Revision 391, 1.5 KB checked in by barra_parpg, 10 years ago (diff)

Patch by beliar & mvbarracuda:

  • Layer fill utility by beliar to easily fill a larger section of the map with one specific instance
  • Map camera name changes for consistency (mapname_camera)
  • New ground level map for the techdemo featuring 250*250 = 62500 tiles; caution: performance is _very_ sluggish in the editor, we might need to downscale the map size or investigate how we can optimize the FIFE code to cope with such large maps
  • Fixes[t:196]
  • Property svn:eol-style set to native
  • Property svn:executable set to *
Line 
1#!/usr/bin/env python
2import sys
3if __name__ == '__main__':
4    base_string = """<i o="<object>" r="0" x="<X>.0" y="<Y>.0" z="0.0" />\n"""
5    try:
6        object = raw_input("Object Name:")
7    except KeyboardInterrupt:
8        sys.exit(0)
9    xmin = None
10    while xmin == None:
11        try:
12            xmin = int(raw_input("xmin:"))
13        except ValueError:
14            pass
15        except KeyboardInterrupt:
16            sys.exit(0)
17    xmax = None
18    while xmax == None:
19        try:
20            xmax = int(raw_input("xmax:"))
21        except ValueError:
22            pass
23        except KeyboardInterrupt:
24            sys.exit(0)
25    ymin = None
26    while ymin == None:
27        try:
28            ymin = int(raw_input("ymin:"))
29        except ValueError:
30            pass
31        except KeyboardInterrupt:
32            sys.exit(0)
33    ymax = None
34    while ymax == None:
35        try:
36            ymax = int(raw_input("ymax:"))
37        except ValueError:
38            pass
39        except KeyboardInterrupt:
40            sys.exit(0)
41
42    try:
43        filename = raw_input("FileName - File will be overwritten without asking:")
44    except KeyboardInterrupt:
45        sys.exit(0)
46
47    file = open(filename, "w")   
48    for i in range(xmin, xmax + 1):
49        for j in range(ymin, ymax + 1):
50            curlinestring = base_string.replace(
51                "<object>", object).replace(
52                    "<X>", str(i)).replace(
53                        "<Y>", str(j))
54            file.write(curlinestring)
55    file.close()
Note: See TracBrowser for help on using the repository browser.