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/player_logic.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'apworld/player_logic.py') diff --git a/apworld/player_logic.py b/apworld/player_logic.py index 958abc5..8b240b5 100644 --- a/apworld/player_logic.py +++ b/apworld/player_logic.py @@ -1,4 +1,4 @@ -from .generated import common_pb2 as common_pb2 +from .generated import data_pb2 as data_pb2 from typing import TYPE_CHECKING, NamedTuple if TYPE_CHECKING: @@ -79,11 +79,11 @@ class Lingo2PlayerLogic: self.real_items = list() for door in world.static_logic.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]: self.locations_by_room.setdefault(door.room_id, []).append(PlayerLocation(door.ap_id, self.get_door_reqs(door.id))) - if door.type in [common_pb2.DoorType.STANDARD, common_pb2.DoorType.ITEM_ONLY] and self.world.options.shuffle_doors: + if door.type in [data_pb2.DoorType.STANDARD, data_pb2.DoorType.ITEM_ONLY] and self.world.options.shuffle_doors: self.real_items.append(self.world.static_logic.get_door_item_name(door.id)) for letter in world.static_logic.objects.letters: @@ -146,7 +146,7 @@ class Lingo2PlayerLogic: reqs = AccessRequirements() use_item = False - if door.type in [common_pb2.DoorType.STANDARD, common_pb2.DoorType.ITEM_ONLY] and self.world.options.shuffle_doors: + if door.type in [data_pb2.DoorType.STANDARD, data_pb2.DoorType.ITEM_ONLY] and self.world.options.shuffle_doors: use_item = True if use_item: -- cgit 1.4.1