From 244dada40682f97612eaf619f3b12495e32948ba Mon Sep 17 00:00:00 2001 From: snake-biscuits <36507175+snake-biscuits@users.noreply.github.com> Date: Fri, 26 Apr 2024 15:02:04 +0100 Subject: [PATCH] (respawn.titanfall2) use local `PrimitiveType` for `Primitive.type` --- bsp_tool/branches/respawn/titanfall2.py | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/bsp_tool/branches/respawn/titanfall2.py b/bsp_tool/branches/respawn/titanfall2.py index edeb9fb4..04a8861d 100644 --- a/bsp_tool/branches/respawn/titanfall2.py +++ b/bsp_tool/branches/respawn/titanfall2.py @@ -469,18 +469,21 @@ def from_bytes(cls, raw_lump: bytes): def as_bytes(self) -> bytes: assert all([isinstance(p, self.StaticPropClass) for p in self.props]) assert all([len(u) == 64 for u in self.unknown_3]) - return b"".join([len(self.model_names).to_bytes(4, "little"), - *[struct.pack("128s", n.encode("ascii")) for n in self.model_names], - len(self.props).to_bytes(4, self.endianness), - self.unknown_1.to_bytes(4, self.endianness), - self.unknown_2.to_bytes(4, self.endianness), - *[p.as_bytes() for p in self.props], - len(self.unknown_3).to_bytes(4, "little"), - *self.unknown_3]) + return b"".join([ + len(self.model_names).to_bytes(4, "little"), + *[struct.pack("128s", n.encode("ascii")) for n in self.model_names], + len(self.props).to_bytes(4, self.endianness), + self.unknown_1.to_bytes(4, self.endianness), + self.unknown_2.to_bytes(4, self.endianness), + *[p.as_bytes() for p in self.props], + len(self.unknown_3).to_bytes(4, "little"), + *self.unknown_3]) # {"LUMP_NAME": {version: LumpClass}} BASIC_LUMP_CLASSES = titanfall.BASIC_LUMP_CLASSES.copy() +BASIC_LUMP_CLASSES.update({ + "CM_PRIMITIVES": {0: Primitive}}) LUMP_CLASSES = titanfall.LUMP_CLASSES.copy() LUMP_CLASSES.update({