From 72c8cfaa417578804788244ea2be38f3cdab762c Mon Sep 17 00:00:00 2001 From: Gugubo <29143981+Gugubo@users.noreply.github.com> Date: Wed, 29 Nov 2023 22:50:55 +0100 Subject: [PATCH] Add default_factory to player_inventory --- src/modlunky2/mem/state.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/modlunky2/mem/state.py b/src/modlunky2/mem/state.py index c7824884..70e59a20 100644 --- a/src/modlunky2/mem/state.py +++ b/src/modlunky2/mem/state.py @@ -142,7 +142,9 @@ class Items: players: Tuple[Optional[Player], ...] = struct_field( 0x08, array(pointer(dc_struct), 4) ) - player_inventory: Tuple[Inventory, ...] = struct_field(0x28, array(dc_struct, 4)) + player_inventory: Tuple[Inventory, ...] = struct_field( + 0x28, array(dc_struct, 4), default_factory=lambda: (Inventory,) * 4 + ) @dataclass(frozen=True)