#! /usr/bin/python # -*- coding: utf-8 -*- # # Vladimír Slávik 2010-2011 # Python 2.6, 3.1 # # for Simutrans # http://www.simutrans.com # # code is public domain # # extract names of all present objects from __future__ import print_function import os import simutools Data = [] simutools.walkFiles(os.getcwd(), simutools.loadFile, cbparam=Data) simutools.pruneList(Data) names = [obj.ask("name", "") for obj in Data] names.sort() print("\n".join(names)) #----- # EOF
try : import pygame except ImportError : print("This script needs PyGame to work!") print("Visit http://www.pygame.org to get it.") else : pygame.font.init() if font_name : font = pygame.font.SysFont(font_name, font_size) else : font = pygame.font.Font(font_name, font_size) print("loading files...") simutools.walkFiles(os.getcwd(), simutools.loadFile, cbparam=Data) simutools.pruneList(Data) simutools.pruneObjs(Data, ["vehicle", "citycar"]) # remove citycars that share obj=type ! if filter_goods : print("filtering by cargo types:", " ".join(filter_goods)) simutools.pruneByParam(Data, "freight", filter_goods, filter_goods_invert) if filter_ways : print("filtering by way types:", " ".join(filter_ways)) simutools.pruneByParam(Data, "waytype", filter_ways) if filter_authors : auth_str = " ".join(filter_authors).lower() print("filtering by author names:", auth_str) i = len(Data) - 1; while i >= 0 :
area = pygame.Rect(tile.coords[1] * tile.paksize, tile.coords[0] * tile.paksize, tile.paksize, tile.paksize) bitmap.fill(pygame.Color(255,0,0,255), area) # used parts will get red, unused stay as is pygame.image.save(bitmap, img + ".usage.png") #----- # main() is this piece of code try : import pygame except ImportError : print "This script needs PyGame to work!" print "Visit http://www.pygame.org to get it." else : simutools.walkFiles(os.getcwd(), simutools.loadFile, cbparam=Objects) simutools.pruneList(Objects) for item in Objects : procObj(item) simutools.walkFiles(os.getcwd(), (lambda file: FoundImages.append(file[:-4])), extension="png") for item in FoundImages : procImg(item) print "Finished!" #----- # EOF