diff --git a/station/stations/platforms.py b/station/stations/platforms.py index 52b39c41..71b430bf 100644 --- a/station/stations/platforms.py +++ b/station/stations/platforms.py @@ -6,6 +6,8 @@ BuildingFull, Demo, AParentSprite, + AChildSprite, + Registers, ) from station.lib.parameters import parameter_list from agrf.graphics.voxel import LazyVoxel @@ -21,6 +23,7 @@ concourse_tiles, entries, ) +from agrf.graphics.recolour import NON_RENDERABLE_COLOUR gray_ps = ground_ps.gray @@ -46,6 +49,7 @@ def __init__(self): voxel_getter=lambda path="station/voxels/cns/concourse.vox": path, load_from="station/files/cns-gorender.json", ) + self.snow_sprites = {} @property def name(self): @@ -57,6 +61,34 @@ def get_platform_classes(self): def get_shelter_classes(self): return ["shelter_1", "shelter_2"] + def _get_snow_sprite(self, location, shelter_class): + key = location + "_" + shelter_class + if key in self.snow_sprites: + return self.snow_sprites[key] + + if location in ["building"]: + symmetry = BuildingFull + else: + symmetry = BuildingSymmetricalX + + s = shelter_class + ("_" if location != "" else "") + location + skeeps = {s, s + "_snow"} + v2 = self.v.discard_layers( + tuple(sorted(tuple(platform_components) + tuple(shelter_components - skeeps))), f"subset_{s}_snow_base" + ) + v3 = self.v.discard_layers( + tuple(sorted(tuple(platform_components) + tuple(shelter_components - {s + "_snow"}))), + f"subset_{s}_snow_only", + ) + v = v3.compose(v2, "merge", ignore_mask=True, colour_map=NON_RENDERABLE_COLOUR) + v.config["overlap"] = 1.3 + v.config["agrf_childsprite"] = (0, -10) + v.in_place_subset(symmetry.render_indices()) + s = symmetry.create_variants(v.spritesheet()) + self.snow_sprites[key] = AChildSprite(s, (0, 0), flags={"dodraw": Registers.SNOW}) + + return self.snow_sprites[key] + def get_sprite(self, location, rail_facing, platform_class, shelter_class): if platform_class == "": pkeeps = set() @@ -80,6 +112,7 @@ def get_sprite(self, location, rail_facing, platform_class, shelter_class): tuple(sorted(tuple(platform_components - pkeeps) + tuple(shelter_components - skeeps))), f"subset_{platform_class}_{rail_facing}_{shelter_class}_{location}", ) + v2.config["agrf_manual_crop"] = (0, 10) if location in ["building", "building_narrow"]: symmetry = BuildingFull else: @@ -91,8 +124,18 @@ def get_sprite(self, location, rail_facing, platform_class, shelter_class): ) height = max((platform_height if platform_class != "" else 0), (shelter_height if shelter_class != "" else 0)) + if shelter_class in ["shelter_1", "shelter_2"]: + child_sprites = [self._get_snow_sprite(location.replace("_narrow", ""), shelter_class)] + + # XXX Temporarily disable snow sprites until WenSim adds them in CNS + child_sprites = [] + else: + child_sprites = [] return AParentSprite( - sprite, (16, platform_width, height - foundation_height), (0, 16 - platform_width, foundation_height) + sprite, + (16, platform_width, height - foundation_height), + (0, 16 - platform_width, foundation_height), + child_sprites=child_sprites, ) def get_concourse_sprite(self, platform_class, side): @@ -126,6 +169,12 @@ def get_concourse_sprite(self, platform_class, side): "shelter_2", "shelter_2_building", "shelter_2_building_v", + "shelter_1_snow", + "shelter_1_building_snow", + "shelter_1_building_v_snow", + "shelter_2_snow", + "shelter_2_building_snow", + "shelter_2_building_v_snow", "pillar", "pillar_building", "pillar_central", diff --git a/station/voxels/cns/cns.vox b/station/voxels/cns/cns.vox index 36ccc71b..8649a140 100644 Binary files a/station/voxels/cns/cns.vox and b/station/voxels/cns/cns.vox differ diff --git a/station/voxels/cns/concourse.vox b/station/voxels/cns/concourse.vox index cd7f2e9c..2b8db925 100644 Binary files a/station/voxels/cns/concourse.vox and b/station/voxels/cns/concourse.vox differ