34 lines
735 B
Python
34 lines
735 B
Python
import json
|
|
|
|
from extract_common import *
|
|
|
|
writer = ExtractFileWriter("")
|
|
|
|
writer.include("<breeze.h>")
|
|
|
|
|
|
def extract_by_property(tiles, key):
|
|
extracted = []
|
|
for tile in tiles:
|
|
if 'properties' not in tile:
|
|
continue
|
|
props = tile['properties']
|
|
props = [True for prop in props if prop['name'] == key]
|
|
if any(props):
|
|
extracted.append(tile)
|
|
return extracted
|
|
|
|
|
|
content = open("../rawAssets/game.tsj").read()
|
|
tiles = json.loads(content)["tiles"]
|
|
terrain = extract_by_property(tiles, "terrain")
|
|
building = extract_by_property(tiles, "building")
|
|
entity = extract_by_property(tiles, "entity")
|
|
print(terrain)
|
|
|
|
|
|
writer.output(f"// This file was generated by: {__file__}\n\n")
|
|
|
|
|
|
|