From 3dcae8ccfe634373aa1484ceb84814d583979e99 Mon Sep 17 00:00:00 2001 From: dyceron Date: Sun, 15 Dec 2024 10:07:26 -0500 Subject: [PATCH] Add new function to bmsmsd to get a tile by index --- .../formats/bmsmsd.py | 23 +++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) diff --git a/src/mercury_engine_data_structures/formats/bmsmsd.py b/src/mercury_engine_data_structures/formats/bmsmsd.py index 179cf22..f3b9da4 100644 --- a/src/mercury_engine_data_structures/formats/bmsmsd.py +++ b/src/mercury_engine_data_structures/formats/bmsmsd.py @@ -4,10 +4,26 @@ from typing import TYPE_CHECKING import construct -from construct.core import Const, Construct, Enum, FlagsEnum, Float32l, Int32sl, Int32ul, Struct +from construct.core import ( + Const, + Construct, + Container, + Enum, + FlagsEnum, + Float32l, + Int32sl, + Int32ul, + Struct, +) from mercury_engine_data_structures.base_resource import BaseResource -from mercury_engine_data_structures.common_types import CVector2D, CVector3D, StrId, VersionAdapter, make_vector +from mercury_engine_data_structures.common_types import ( + CVector2D, + CVector3D, + StrId, + VersionAdapter, + make_vector, +) if TYPE_CHECKING: from mercury_engine_data_structures.game_check import Game @@ -85,3 +101,6 @@ class Bmsmsd(BaseResource): @functools.lru_cache def construct_class(cls, target_game: Game) -> Construct: return BMSMSD + + def get_tile(self, tile_idx: int) -> Container: + return self.raw.tiles[tile_idx]