def get_system_links_by_name(self, system_name):
        """given a system_name return its link tuples. returns tuples of attributes.
        """

        system = self.get_system_by_name(system_name)
        links = es.endless_type_grep(system, 'link')
        return links
Exemple #2
0
def get_intro_systems():
    intro = es.parse_endless_sky_file("data.orig/intro missions.txt")
    intro_missions = es.endless_type_grep(intro, "mission")
    sources = [ es.endless_first(x, "source")[1] for x in intro_missions ]
    dests   = [ es.endless_first(x, "destination")[1] for x in intro_missions ]
    intro_planets = list(set(sources + dests))
    intro_systems = [obj_to_system_name[planet] for planet in intro_planets]
    return intro_systems
    def systems(self):
        """return a list of the systems from the endless sky document
        
        Returns
        -------
        list
            a list of all the system objects in the loaded document
        """

        systems = es.endless_type_grep(self.maps, "system")
        self._systems = systems
        return systems
This was a first attempt at rewriting the maps.txt. It places everything into a random grid. It is quite random and not as fun as graph Map.

Essentially the systems are shuffled, their links are removed, and then they are placed into a grid and their links to their neighbors are replaced.
"""

import trulyendlesssky.larkendless as es
import random
import math

start_system = 'Rutilicus'

maps = es.parse_endless_sky_file("data.orig/map.txt.original")
print(len(maps))
print(maps[1])
systems = es.endless_type_grep(maps, "system")
n_systems = len(systems)
width = 16
pw = 75
ph = 75

print(len(systems))
print(len(systems[0]))
print(len(systems[0][0]))

random.shuffle(systems)


def move_system(system, x, y):
    system = es.endless_replace(system, 'pos', (x, y))
    return system
    def get_system_position_by_name(self, system_name):
        """get the position tuple of a system
        """

        system = self.get_system_by_name(system_name)
        return es.endless_type_grep(system, 'pos')[0][1:]
    def planets(self):
        """returns all the planets in the endless sky document
        """

        planets = es.endless_type_grep(self.maps, "planet")
        return planets