def name_planets(system): """ Sets the names of the planets of the specified system. Planet name is system name + planet number (as roman number) unless it's an asteroid belt, in that case name is system name + 'asteroid belt' (localized). """ planet_number = 1 # iterate over all planets in the system for planet in fo.sys_get_planets(system): # use different naming methods for "normal" planets and asteroid belts if fo.planet_get_type(planet) == fo.planetType.asteroids: # get localized text from stringtable name = fo.user_string("PL_ASTEROID_BELT_OF_SYSTEM") # %1% parameter in the localized string is the system name name = name.replace("%1%", fo.get_name(system)) else: # set name to system name + planet number as roman number... name = fo.get_name(system) + " " + fo.roman_number(planet_number) # ...and increase planet number planet_number += 1 # do the actual renaming fo.set_name(planet, name)
def get_name_list(name_list): """ Retrieves a list of names from the string tables. """ return fo.user_string(name_list).splitlines()