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