From 4c8a38dfc0121343396d2a0d734cf1445d05b60c Mon Sep 17 00:00:00 2001 From: Star Rauchenberger Date: Tue, 12 Aug 2025 16:55:17 -0400 Subject: Converted to proto2 This will let us use an older version of protobuf in Python, and allows us to use the Godot protobuf implementation at all. Scalar fields with custom defaults in data.proto were changed to not have a default, because Godot doesn't handle it properly. The equivalent fields in human.proto still have the defaults, and datapacker copies the default value in if necessary. The Panel message in data.proto was also renamed to PanelData because otherwise it conflicts with the native Godot class named Panel. The double field in Letter was renamed to level2, because Godot couldn't handle it well. Finally, common.proto was removed and its contents were moved into data.proto, which allows us to generate code for Python without needing to edit it. NOTE: I had to slightly modify the Godot protobuf code generator. I'll need to upload that somewhere. --- apworld/static_logic.py | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) (limited to 'apworld/static_logic.py') diff --git a/apworld/static_logic.py b/apworld/static_logic.py index ff58e96..6a05f3d 100644 --- a/apworld/static_logic.py +++ b/apworld/static_logic.py @@ -1,4 +1,3 @@ -from .generated import common_pb2 as common_pb2 from .generated import data_pb2 as data_pb2 import pkgutil @@ -18,20 +17,20 @@ class Lingo2StaticLogic: self.objects.ParseFromString(bytearray(file)) for door in self.objects.doors: - if door.type in [common_pb2.DoorType.STANDARD, common_pb2.DoorType.LOCATION_ONLY]: + if door.type in [data_pb2.DoorType.STANDARD, data_pb2.DoorType.LOCATION_ONLY]: location_name = f"{self.objects.maps[door.map_id].name} - {door.name}" self.location_id_to_name[door.ap_id] = location_name - if door.type not in [common_pb2.DoorType.EVENT, common_pb2.DoorType.LOCATION_ONLY]: + if door.type not in [data_pb2.DoorType.EVENT, data_pb2.DoorType.LOCATION_ONLY]: item_name = self.get_door_item_name(door.id) self.item_id_to_name[door.ap_id] = item_name for letter in self.objects.letters: - letter_name = f"{letter.key.upper()}{'' if letter.double else '2'}" + letter_name = f"{letter.key.upper()}{'' if letter.level2 else '2'}" location_name = f"{self.objects.maps[self.objects.rooms[letter.room_id].map_id].name} - {letter_name}" self.location_id_to_name[letter.ap_id] = location_name - if not letter.double: + if not letter.level2: self.item_id_to_name[letter.ap_id] = letter_name for mastery in self.objects.masteries: -- cgit 1.4.1