Esempio n. 1
0
    def __init__(self, spriterow_group_mappings, **kwargs):
        # no graphics processing for this gestalt
        super().__init__()
        # spriterow_group_mappings provided by subclass calling gestalt_graphics:
        # (1) consist-cargo types for which specific liveries are provided
        # (2) spriterow numbers for named positions in consist
        # spriterow numbers are zero-indexed *relative* to the start of the consist-cargo block, to reduce shuffling them all if new rows are inserted in future
        # *all* of the values in consist_positions_ordered must be provided in the mapping, set them to 0 if unused
        self.spriterow_group_mappings = spriterow_group_mappings
        # rulesets are used to define for different types of vehicle how sprites change depending on consist position
        self.consist_ruleset = kwargs.get("consist_ruleset", None)
        # it's nice to use a dict for the consist position->row mapping, but order matters for the spritesheet, so have an ordered set of keys
        # also, although rulesets allow fine-grained control, there are deliberately only 4 configuration options
        # this stops rules getting out of control and simplifies other methods
        self.consist_positions_ordered = [
            "default", "first", "last", "special"
        ]

        self.pipelines = pipelines.get_pipelines(
            ["extend_spriterows_for_composited_sprites_pipeline"])
        if kwargs.get("pantograph_type", None) is not None:
            self.pipelines.extend(
                pipelines.get_pipelines([
                    "generate_pantographs_up_spritesheet",
                    "generate_pantographs_down_spritesheet",
                ]))
            # this relies on DFLT mapping being safe to take
            # *and* assumes no gaps in the spriterows, so take the max spriterow num
            # *and* assumes 2 liveries are in use
            # note the +1 because livery rows are zero indexed
            self.num_pantograph_rows = 2 * (max(
                [int(i) + 1 for i in self.cargo_row_map["DFLT"]]))
Esempio n. 2
0
 def __init__(self, **kwargs):
     super().__init__()
     self.pipelines = pipelines.get_pipelines(["check_buy_menu_only"])
     # we need to run the spritelayer cargo pipelines separately from the vehicle pipelines, but we still use this gestalt as the entry point
     self.spritelayer_cargo_pipelines = pipelines.get_pipelines(
         ["generate_spritelayer_cargo_sets"])
     self.colour_mapping_switch = "_switch_colour_mapping"
     self.consist_ruleset = kwargs.get("consist_ruleset", None)
     self.flag_switch_set_layers_register_more_sprites = True
Esempio n. 3
0
 def __init__(self, **kwargs):
     super().__init__()
     self.pipelines = pipelines.get_pipelines(["check_buy_menu_only"])
     self.colour_mapping_switch = "_switch_colour_mapping"
     self.alternative_cc_livery = kwargs.get("alternative_cc_livery", None)
     self.default_livery_extra_docs_examples = kwargs.get(
         "default_livery_extra_docs_examples", [])
     if kwargs.get("pantograph_type", None) is not None:
         self.pipelines.extend(
             pipelines.get_pipelines([
                 "generate_pantographs_up_spritesheet",
                 "generate_pantographs_down_spritesheet",
             ]))
Esempio n. 4
0
 def __init__(self, recolour_maps, **kwargs):
     super().__init__()
     # as of Jan 2018 only one pipeline is used, but support is in place for alternative pipelines
     self.pipelines = pipelines.get_pipelines(
         ["extend_spriterows_for_composited_sprites_pipeline"])
     # recolour_maps map cargo labels to liveries, use 'DFLT' as the labe in the case of just one livery
     self.recolour_maps = recolour_maps
Esempio n. 5
0
 def __init__(self):
     # by default, pipelines are empty
     self.pipelines = pipelines.get_pipelines([])
     # specific alt livery for specific company colour choices
     # this is only used by engines as of July 2020, but we provide a default value here to avoid requiring getattr() in many places, which was masking errors
     self.alternative_cc_livery = None  # over-ride as needed in subclasses
     # over-ride layers flag as needed in subclasses
     self.flag_switch_set_layers_register_more_sprites = False
Esempio n. 6
0
 def __init__(self):
     # super appears to not be used, that may or may not be intentional, I didn't change it as of July 2020 as it risks introducing unexpected results
     # no graphics processing by default
     self.pipelines = pipelines.get_pipelines([
         "check_buy_menu_only",
         "generate_pantographs_up_spritesheet",
         "generate_pantographs_down_spritesheet",
     ])
Esempio n. 7
0
 def __init__(self, recolour_maps, **kwargs):
     super().__init__()
     # as of Jan 2018 only one pipeline is used, but support is in place for alternative pipelines
     self.pipelines = pipelines.get_pipelines(
         ["extend_spriterows_for_composited_sprites_pipeline"])
     # common format for recolour_maps provides multiple remaps
     # but just one livery remap is supported for this gestalt, and should be the first in the remap list
     self.recolour_map = recolour_maps[0][1]
     self.id_base = kwargs.get("id_base")
Esempio n. 8
0
 def __init__(self, num_generations, recolour_maps, **kwargs):
     super().__init__()
     # as of Jan 2018 only one pipeline is used, but support is in place for alternative pipelines
     self.pipelines = pipelines.get_pipelines(
         ['extend_spriterows_for_composited_sprites_pipeline'])
     self.num_generations = num_generations
     # common format for recolour_maps provides multiple remaps
     # but just one livery remap is supported for this gestalt, and should be the first in the remap list
     self.recolour_map_1 = recolour_maps[0][1]
     self.recolour_map_2 = recolour_maps[1][1]
Esempio n. 9
0
 def __init__(self,
              _nml_template,
              cargo_row_map=None,
              generic_rows=None,
              unique_spritesets=None):
     super().__init__()
     self.pipelines = pipelines.get_pipelines(['pass_through_pipeline'])
     # options
     self._nml_template = _nml_template
     self._cargo_row_map = cargo_row_map
     self._generic_rows = generic_rows
     self._unique_spritesets = unique_spritesets
Esempio n. 10
0
 def __init__(self, recolour_maps, **kwargs):
     super().__init__()
     # optionally provide a second source input row, with specific sprite for cargo-specific graphics
     # this is used when the cargo-specific sprites vary from the company colour livery option
     self.cargo_specific_livery_uses_dedicated_input_row = kwargs.get(
         'cargo_specific_livery_uses_dedicated_input_row', False)
     self.cargo_specific_livery_uses_2CC = kwargs.get(
         'cargo_specific_livery_uses_2CC', False)
     # as of Jan 2018 only one pipeline is used, but support is in place for alternative pipelines
     self.pipelines = pipelines.get_pipelines(
         ['extend_spriterows_for_composited_sprites_pipeline'])
     # recolour_maps map cargo labels to liveries, use 'DFLT' as the labe in the case of just one livery
     self.recolour_maps = recolour_maps
Esempio n. 11
0
 def __init__(self, **kwargs):
     super().__init__()
     # we use the composited sprites pipeline so we can make use of chassis compositing
     self.pipelines = pipelines.get_pipelines(
         ["extend_spriterows_for_composited_sprites_pipeline"])
     # we need to run the spritelayer cargo pipelines separately from the vehicle pipelines, but we still use this gestalt as the entry point
     self.spritelayer_cargo_pipelines = pipelines.get_pipelines(
         ["generate_spritelayer_cargo_sets"])
     self.colour_mapping_switch = "_switch_colour_mapping"
     self.consist_ruleset = kwargs.get("consist_ruleset", None)
     self.flag_switch_set_layers_register_more_sprites = True
     # intermodal cars are asymmetric, sprites are drawn in second col, first col needs populated, map is [col 1 dest]: [col 2 source]
     # two liveries
     self.asymmetric_row_map = {
         1: 1,
         2: 2,  # default: default
         3: 5,
         4: 6,  # first: last
         5: 3,
         6: 4,  # last: first
         7: 7,
         8: 8,
     }  # middle: middle
Esempio n. 12
0
 def __init__(self, **kwargs):
     super().__init__()
     self.pipelines = pipelines.get_pipelines(
         ["extend_spriterows_for_composited_sprites_pipeline"])
     # default body recolour to CC1, pass param to over-ride as needed
     self.body_recolour_map = kwargs.get(
         "body_recolour_map", graphics_constants.body_recolour_CC1)
     # option for alternative livery, will be selected by player flip on depot, default to 1 if not set
     self.num_visible_cargo_liveries = (2 if kwargs.get(
         "has_alt_livery", False) else 1)
     # cargo flags
     self.has_cover = kwargs.get("has_cover", False)
     self.has_bulk = kwargs.get("bulk", False)
     self.has_piece = kwargs.get("piece", None) is not None
     if self.has_piece:
         self.piece_type = kwargs.get("piece")
Esempio n. 13
0
 def __init__(self, **kwargs):
     # we use the composited sprites pipeline so we can make use of chassis compositing
     self.pipelines = pipelines.get_pipelines(
         ['extend_spriterows_for_composited_sprites_pipeline'])
     self.consist_ruleset = kwargs.get('consist_ruleset', None)
     # intermodal cars are asymmetric, sprites are drawn in second col, first col needs populated, map is [col 1 dest]: [col 2 source]
     # two liveries
     self.asymmetric_row_map = {
         1: 1,
         2: 2,  # default: default
         3: 5,
         4: 6,  # first: last
         5: 3,
         6: 4,  # last: first
         7: 7,
         8: 8
     }  # middle: middle
Esempio n. 14
0
 def __init__(
     self,
     _nml_template,
     cargo_row_map=None,
     generic_rows=None,
     unique_spritesets=None,
     cargo_label_mapping=None,
     flag_switch_set_layers_register_more_sprites=False,
 ):
     super().__init__()
     self.pipelines = pipelines.get_pipelines(["pass_through_pipeline"])
     # options
     self.flag_switch_set_layers_register_more_sprites = (
         flag_switch_set_layers_register_more_sprites)
     self._nml_template = _nml_template
     self._cargo_row_map = cargo_row_map
     self._generic_rows = generic_rows
     self._unique_spritesets = unique_spritesets
     self._cargo_label_mapping = cargo_label_mapping
Esempio n. 15
0
 def __init__(self, **kwargs):
     super().__init__()
     # we use the composited sprites pipeline so we can make use of chassis compositing
     self.pipelines = pipelines.get_pipelines(
         ["extend_spriterows_for_composited_sprites_pipeline"])
     self.colour_mapping_switch = "_switch_colour_mapping"
     self.flag_switch_set_layers_register_more_sprites = True
     # vehicle transporter cars are asymmetric, sprites are drawn in second col, first col needs populated, map is [col 1 dest]: [col 2 source]
     # two liveries
     self.asymmetric_row_map = {
         1: 1,
         2: 2,  # default: default
         3: 5,
         4: 6,  # first: last
         5: 3,
         6: 4,  # last: first
         7: 7,
         8: 8,
     }  # middle: middle
Esempio n. 16
0
 def __init__(self):
     # by default, check for buy menu only
     self.pipelines = pipelines.get_pipelines(['check_buy_menu_only'])
Esempio n. 17
0
 def __init__(self):
     # no graphics processing by default
     self.pipelines = pipelines.get_pipelines([
         'check_buy_menu_only', 'generate_pantographs_up_spritesheet',
         'generate_pantographs_down_spritesheet'
     ])