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. --- proto/CMakeLists.txt | 2 +- proto/common.proto | 38 ----------- proto/data.proto | 173 ++++++++++++++++++++++++++++++--------------------- proto/human.proto | 112 ++++++++++++++++----------------- 4 files changed, 160 insertions(+), 165 deletions(-) delete mode 100644 proto/common.proto (limited to 'proto') diff --git a/proto/CMakeLists.txt b/proto/CMakeLists.txt index c5abd46..95687d7 100644 --- a/proto/CMakeLists.txt +++ b/proto/CMakeLists.txt @@ -5,7 +5,7 @@ add_library(protos) protobuf_generate( LANGUAGE cpp TARGET protos - PROTOS human.proto data.proto common.proto + PROTOS human.proto data.proto ) target_link_libraries(protos PUBLIC protobuf::libprotobuf) diff --git a/proto/common.proto b/proto/common.proto deleted file mode 100644 index e37f670..0000000 --- a/proto/common.proto +++ /dev/null @@ -1,38 +0,0 @@ -edition = "2023"; - -package com.fourisland.lingo2_archipelago; - -message Proxy { - string answer = 1; - string path = 2; -} - -enum DoorType { - DOOR_TYPE_UNKNOWN = 0; - - // This door is a location unless panelsanity is on, and it is an item as long as door shuffle is on. - STANDARD = 1; - - // This door is never an item or a location. - EVENT = 2; - - // This door is never a location, and is an item as long as door shuffle is on. - ITEM_ONLY = 3; - - // This door is never a location, and is an item as long as control center color shuffle is on. - CONTROL_CENTER_COLOR = 4; - - // This door is never an item, and is a location as long as panelsanity is not on. - LOCATION_ONLY = 5; -} - -enum AxisDirection { - AXIS_DIRECTION_UNKNOWN = 0; - - X_PLUS = 1; - X_MINUS = 2; - Y_PLUS = 3; - Y_MINUS = 4; - Z_PLUS = 5; - Z_MINUS = 6; -} diff --git a/proto/data.proto b/proto/data.proto index b590454..f60d54f 100644 --- a/proto/data.proto +++ b/proto/data.proto @@ -1,23 +1,56 @@ -edition = "2023"; - -import "common.proto"; +syntax = "proto2"; package com.fourisland.lingo2_archipelago; +message Proxy { + optional string answer = 1; + optional string path = 2; +} + +enum DoorType { + DOOR_TYPE_UNKNOWN = 0; + + // This door is a location unless panelsanity is on, and it is an item as long as door shuffle is on. + STANDARD = 1; + + // This door is never an item or a location. + EVENT = 2; + + // This door is never a location, and is an item as long as door shuffle is on. + ITEM_ONLY = 3; + + // This door is never a location, and is an item as long as control center color shuffle is on. + CONTROL_CENTER_COLOR = 4; + + // This door is never an item, and is a location as long as panelsanity is not on. + LOCATION_ONLY = 5; +} + +enum AxisDirection { + AXIS_DIRECTION_UNKNOWN = 0; + + X_PLUS = 1; + X_MINUS = 2; + Y_PLUS = 3; + Y_MINUS = 4; + Z_PLUS = 5; + Z_MINUS = 6; +} + message ProxyIdentifier { - uint64 panel = 1; - string answer = 2; + optional uint64 panel = 1; + optional string answer = 2; } message KeyholderAnswer { - uint64 keyholder = 1; - string key = 2; + optional uint64 keyholder = 1; + optional string key = 2; } message Connection { - uint64 from_room = 1; - uint64 to_room = 2; - uint64 required_door = 3; + optional uint64 from_room = 1; + optional uint64 to_room = 2; + optional uint64 required_door = 3; oneof trigger { uint64 port = 4; @@ -27,105 +60,105 @@ message Connection { } message Door { - uint64 id = 1; - uint64 ap_id = 11; - uint64 map_id = 9; - uint64 room_id = 10; - string name = 2; + optional uint64 id = 1; + optional uint64 ap_id = 11; + optional uint64 map_id = 9; + optional uint64 room_id = 10; + optional string name = 2; repeated string receivers = 3; repeated uint64 move_paintings = 4; repeated ProxyIdentifier panels = 5; - uint64 complete_at = 12; + optional uint64 complete_at = 12; - string control_center_color = 6; + optional string control_center_color = 6; repeated string switches = 7; repeated KeyholderAnswer keyholders = 13; repeated uint64 rooms = 14; - DoorType type = 8; + optional DoorType type = 8; } -message Panel { - uint64 id = 1; - uint64 ap_id = 10; - uint64 room_id = 2; - string name = 3; +message PanelData { + optional uint64 id = 1; + optional uint64 ap_id = 10; + optional uint64 room_id = 2; + optional string name = 3; - string path = 4; - string clue = 5; - string answer = 6; + optional string path = 4; + optional string clue = 5; + optional string answer = 6; repeated string symbols = 7; repeated Proxy proxies = 8; - uint64 required_door = 9; - uint64 required_room = 11; + optional uint64 required_door = 9; + optional uint64 required_room = 11; } message Painting { - uint64 id = 1; - uint64 room_id = 2; - string name = 9; - - string path = 10; - string display_name = 4; - - string orientation = 3; - bool move = 6; - bool enter_only = 7; - AxisDirection gravity = 8 [default = Y_MINUS]; - bool exit_only = 11; + optional uint64 id = 1; + optional uint64 room_id = 2; + optional string name = 9; + + optional string path = 10; + optional string display_name = 4; + + optional string orientation = 3; + optional bool move = 6; + optional bool enter_only = 7; + optional AxisDirection gravity = 8; + optional bool exit_only = 11; - uint64 required_door = 5; + optional uint64 required_door = 5; } message Port { - uint64 id = 1; - uint64 room_id = 2; - string name = 3; + optional uint64 id = 1; + optional uint64 room_id = 2; + optional string name = 3; - string path = 4; - string orientation = 5; - AxisDirection gravity = 7 [default = Y_MINUS]; + optional string path = 4; + optional string orientation = 5; + optional AxisDirection gravity = 7; - uint64 required_door = 6; + optional uint64 required_door = 6; } message Keyholder { - uint64 id = 1; - uint64 room_id = 2; + optional uint64 id = 1; + optional uint64 room_id = 2; - string name = 3; - string path = 4; + optional string name = 3; + optional string path = 4; } message Letter { - uint64 id = 3; - uint64 ap_id = 5; - uint64 room_id = 4; + optional uint64 id = 3; + optional uint64 ap_id = 5; + optional uint64 room_id = 4; - string key = 1; - bool double = 2; + optional string key = 1; + optional bool level2 = 2; - string path = 6; + optional string path = 6; } message Mastery { - uint64 id = 1; - uint64 ap_id = 2; - uint64 room_id = 3; + optional uint64 id = 1; + optional uint64 ap_id = 2; + optional uint64 room_id = 3; - string name = 4; - string path = 5; + optional string name = 4; + optional string path = 5; } message Room { - uint64 id = 1; - uint64 map_id = 8; - string name = 2; - string display_name = 3; + optional uint64 id = 1; + optional uint64 map_id = 8; + optional string name = 2; + optional string display_name = 3; repeated uint64 panels = 4; repeated uint64 paintings = 5; @@ -137,15 +170,15 @@ message Room { } message Map { - uint64 id = 1; - string name = 2; + optional uint64 id = 1; + optional string name = 2; } message AllObjects { repeated Map maps = 7; repeated Room rooms = 1; repeated Door doors = 2; - repeated Panel panels = 3; + repeated PanelData panels = 3; repeated Painting paintings = 4; repeated Port ports = 5; repeated Keyholder keyholders = 11; diff --git a/proto/human.proto b/proto/human.proto index 858c88f..b420cb4 100644 --- a/proto/human.proto +++ b/proto/human.proto @@ -1,43 +1,43 @@ -edition = "2023"; +syntax = "proto2"; -import "common.proto"; +import "data.proto"; package com.fourisland.lingo2_archipelago; message RoomIdentifier { - string map = 1; - string name = 2; + optional string map = 1; + optional string name = 2; } message DoorIdentifier { - string map = 1; - string name = 2; + optional string map = 1; + optional string name = 2; } message PortIdentifier { - string map = 1; - string room = 2; - string name = 3; + optional string map = 1; + optional string room = 2; + optional string name = 3; } message PaintingIdentifier { - string map = 1; - string room = 2; - string name = 3; + optional string map = 1; + optional string room = 2; + optional string name = 3; } message PanelIdentifier { - string map = 1; - string room = 2; - string name = 3; - string answer = 4; + optional string map = 1; + optional string room = 2; + optional string name = 3; + optional string answer = 4; } message KeyholderIdentifier { - string map = 1; - string room = 2; - string name = 3; - string key = 4; + optional string map = 1; + optional string room = 2; + optional string name = 3; + optional string key = 4; } message HumanConnection { @@ -60,8 +60,8 @@ message HumanConnection { string to_room = 6; } - bool oneway = 3; - DoorIdentifier door = 4; + optional bool oneway = 3; + optional DoorIdentifier door = 4; } message HumanConnections { @@ -69,7 +69,7 @@ message HumanConnections { } message HumanDoor { - string name = 1; + optional string name = 1; repeated string receivers = 2; repeated PaintingIdentifier move_paintings = 8; @@ -79,15 +79,15 @@ message HumanDoor { // If set, the number of panels from the above set that need to be solved. // Warning: this is a messy kind of OR logic! Consider if there's another way. - uint64 complete_at = 9; + optional uint64 complete_at = 9; - string control_center_color = 6; + optional string control_center_color = 6; repeated string switches = 7; repeated KeyholderIdentifier keyholders = 10; repeated RoomIdentifier rooms = 11; - DoorType type = 4; - string location_room = 5; + optional DoorType type = 4; + optional string location_room = 5; } message HumanDoors { @@ -95,64 +95,64 @@ message HumanDoors { } message HumanPanel { - string name = 1; - string path = 5; + optional string name = 1; + optional string path = 5; - string clue = 2; - string answer = 3; + optional string clue = 2; + optional string answer = 3; repeated string symbols = 4; repeated Proxy proxies = 6; - DoorIdentifier required_door = 7; - RoomIdentifier required_room = 8; + optional DoorIdentifier required_door = 7; + optional RoomIdentifier required_room = 8; } message HumanPainting { - string name = 1; - string path = 2; + optional string name = 1; + optional string path = 2; - string display_name = 4; + optional string display_name = 4; - string orientation = 3; - bool move = 6; - bool enter_only = 7; - AxisDirection gravity = 8 [default = Y_MINUS]; - bool exit_only = 9; + optional string orientation = 3; + optional bool move = 6; + optional bool enter_only = 7; + optional AxisDirection gravity = 8 [default = Y_MINUS]; + optional bool exit_only = 9; - DoorIdentifier required_door = 5; + optional DoorIdentifier required_door = 5; } message HumanPort { - string name = 1; - string path = 2; + optional string name = 1; + optional string path = 2; - string orientation = 3; - AxisDirection gravity = 5 [default = Y_MINUS]; + optional string orientation = 3; + optional AxisDirection gravity = 5 [default = Y_MINUS]; - DoorIdentifier required_door = 4; + optional DoorIdentifier required_door = 4; } message HumanKeyholder { - string name = 1; - string path = 2; + optional string name = 1; + optional string path = 2; } message HumanLetter { - string key = 1; - bool double = 2; + optional string key = 1; + optional bool level2 = 2; - string path = 3; + optional string path = 3; } message HumanMastery { - string name = 1; - string path = 2; + optional string name = 1; + optional string path = 2; } message HumanRoom { - string name = 1; - string display_name = 2; + optional string name = 1; + optional string display_name = 2; repeated HumanPanel panels = 3; repeated HumanPainting paintings = 4; -- cgit 1.4.1