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

Revision 395, 2.1 KB checked in by eliedebrauwer, 10 years ago (diff)

Ticket #137 and #138. Patch by Beliar (confirmed by eliedebrauwer). Fixes footlocker animation, added support for opening/closing footlocker animations, added footlocker onto the map, isolates contents of containers. Added copyright notice to layer_fill_utility.py. fixes[s:trac, t:137] fixes[s:trac, t:138]

  • Property svn:eol-style set to native
  • Property svn:executable set to *
Line 
1#!/usr/bin/env python
2
3#   This program is free software: you can redistribute it and/or modify
4#   it under the terms of the GNU General Public License as published by
5#   the Free Software Foundation, either version 3 of the License, or
6#   (at your option) any later version.
7
8#   This program is distributed in the hope that it will be useful,
9#   but WITHOUT ANY WARRANTY; without even the implied warranty of
10#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
11#   GNU General Public License for more details.
12
13#   You should have received a copy of the GNU General Public License
14#   along with this program.  If not, see <http://www.gnu.org/licenses/>.
15
16import sys
17if __name__ == '__main__':
18    base_string = """<i o="<object>" r="0" x="<X>.0" y="<Y>.0" z="0.0" />\n"""
19    try:
20        object = raw_input("Object Name: ")
21    except KeyboardInterrupt:
22        sys.exit(0)
23    xmin = None
24    while xmin == None:
25        try:
26            xmin = int(raw_input("xmin: "))
27        except ValueError:
28            pass
29        except KeyboardInterrupt:
30            sys.exit(0)
31    xmax = None
32    while xmax == None:
33        try:
34            xmax = int(raw_input("xmax: "))
35        except ValueError:
36            pass
37        except KeyboardInterrupt:
38            sys.exit(0)
39    ymin = None
40    while ymin == None:
41        try:
42            ymin = int(raw_input("ymin: "))
43        except ValueError:
44            pass
45        except KeyboardInterrupt:
46            sys.exit(0)
47    ymax = None
48    while ymax == None:
49        try:
50            ymax = int(raw_input("ymax: "))
51        except ValueError:
52            pass
53        except KeyboardInterrupt:
54            sys.exit(0)
55
56    try:
57        filename = raw_input("FileName - File will be overwritten without asking: ")
58    except KeyboardInterrupt:
59        sys.exit(0)
60
61    file = open(filename, "w")   
62    for i in range(xmin, xmax + 1):
63        for j in range(ymin, ymax + 1):
64            curlinestring = base_string.replace(
65                "<object>", object).replace(
66                    "<X>", str(i)).replace(
67                        "<Y>", str(j))
68            file.write(curlinestring)
69    file.close()
Note: See TracBrowser for help on using the repository browser.