Loading

Paste #pb4b1zhuy

  1.     @property
  2.     def spriterow_num(self):
  3.         # ugly forcing of over-ride for out-of-sequence repeating vehicles
  4.         if self.unit_num_providing_spriterow_num is not None:
  5.             return self.unit_num_providing_spriterow_num
  6.         # larks!! Magic is hard!! (a lot of code was deleted to get to this relatively simple calculation)
  7.         num_preceding_units_with_cargo_sprites = self.num_preceding_units - self.num_preceding_units_with_same_spriterow_flag_set
  8.  
  9.         # some units have multiple spriterows, which can be assumed to be cargo
  10.         num_preceding_cargo_rows = num_preceding_units_with_cargo_sprites * self.num_spriterows_per_cargo_variant * self.num_cargo_sprite_variants
  11.         # not all units with cargo have specific empty state rows, so calculate correct number of empty state rows
  12.         num_preceding_empty_state_rows = self.has_empty_state_spriterow * num_preceding_units_with_cargo_sprites
  13.  
  14.         return self.num_preceding_units_with_same_spriterow_flag_set + num_preceding_cargo_rows + num_preceding_empty_state_rows

Comments