diff options
author | Star Rauchenberger <fefferburbia@gmail.com> | 2025-08-12 16:55:17 -0400 |
---|---|---|
committer | Star Rauchenberger <fefferburbia@gmail.com> | 2025-08-12 16:55:17 -0400 |
commit | 4c8a38dfc0121343396d2a0d734cf1445d05b60c (patch) | |
tree | ccaf6dd1dc6fee60ced5ae19c5d0bb5db1217fcb | |
parent | 447a222b57e498f7904033c59e68d21d6a246abd (diff) | |
download | lingo2-archipelago-4c8a38dfc0121343396d2a0d734cf1445d05b60c.tar.gz lingo2-archipelago-4c8a38dfc0121343396d2a0d734cf1445d05b60c.tar.bz2 lingo2-archipelago-4c8a38dfc0121343396d2a0d734cf1445d05b60c.zip |
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.
-rw-r--r-- | apworld/player_logic.py | 8 | ||||
-rw-r--r-- | apworld/static_logic.py | 9 | ||||
-rw-r--r-- | data/maps/four_rooms/rooms/A2 Room.txtpb | 2 | ||||
-rw-r--r-- | data/maps/the_bearer/rooms/Q2 Room.txtpb | 2 | ||||
-rw-r--r-- | data/maps/the_between/rooms/B2 Room.txtpb | 2 | ||||
-rw-r--r-- | data/maps/the_colorful/rooms/P2 Room.txtpb | 2 | ||||
-rw-r--r-- | data/maps/the_congruent/rooms/C2 Room.txtpb | 2 | ||||
-rw-r--r-- | data/maps/the_congruent/rooms/G2 Room.txtpb | 2 | ||||
-rw-r--r-- | proto/CMakeLists.txt | 2 | ||||
-rw-r--r-- | proto/common.proto | 38 | ||||
-rw-r--r-- | proto/data.proto | 173 | ||||
-rw-r--r-- | proto/human.proto | 112 | ||||
-rw-r--r-- | tools/assign_ids/main.cpp | 3 | ||||
-rw-r--r-- | tools/datapacker/container.cpp | 10 | ||||
-rw-r--r-- | tools/datapacker/container.h | 2 | ||||
-rw-r--r-- | tools/datapacker/main.cpp | 16 | ||||
-rw-r--r-- | tools/util/naming.cpp | 4 | ||||
-rw-r--r-- | tools/util/naming.h | 2 |
18 files changed, 192 insertions, 199 deletions
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 @@ | |||
1 | from .generated import common_pb2 as common_pb2 | 1 | from .generated import data_pb2 as data_pb2 |
2 | from typing import TYPE_CHECKING, NamedTuple | 2 | from typing import TYPE_CHECKING, NamedTuple |
3 | 3 | ||
4 | if TYPE_CHECKING: | 4 | if TYPE_CHECKING: |
@@ -79,11 +79,11 @@ class Lingo2PlayerLogic: | |||
79 | self.real_items = list() | 79 | self.real_items = list() |
80 | 80 | ||
81 | for door in world.static_logic.objects.doors: | 81 | for door in world.static_logic.objects.doors: |
82 | if door.type in [common_pb2.DoorType.STANDARD, common_pb2.DoorType.LOCATION_ONLY]: | 82 | if door.type in [data_pb2.DoorType.STANDARD, data_pb2.DoorType.LOCATION_ONLY]: |
83 | self.locations_by_room.setdefault(door.room_id, []).append(PlayerLocation(door.ap_id, | 83 | self.locations_by_room.setdefault(door.room_id, []).append(PlayerLocation(door.ap_id, |
84 | self.get_door_reqs(door.id))) | 84 | self.get_door_reqs(door.id))) |
85 | 85 | ||
86 | if door.type in [common_pb2.DoorType.STANDARD, common_pb2.DoorType.ITEM_ONLY] and self.world.options.shuffle_doors: | 86 | if door.type in [data_pb2.DoorType.STANDARD, data_pb2.DoorType.ITEM_ONLY] and self.world.options.shuffle_doors: |
87 | self.real_items.append(self.world.static_logic.get_door_item_name(door.id)) | 87 | self.real_items.append(self.world.static_logic.get_door_item_name(door.id)) |
88 | 88 | ||
89 | for letter in world.static_logic.objects.letters: | 89 | for letter in world.static_logic.objects.letters: |
@@ -146,7 +146,7 @@ class Lingo2PlayerLogic: | |||
146 | reqs = AccessRequirements() | 146 | reqs = AccessRequirements() |
147 | 147 | ||
148 | use_item = False | 148 | use_item = False |
149 | if door.type in [common_pb2.DoorType.STANDARD, common_pb2.DoorType.ITEM_ONLY] and self.world.options.shuffle_doors: | 149 | if door.type in [data_pb2.DoorType.STANDARD, data_pb2.DoorType.ITEM_ONLY] and self.world.options.shuffle_doors: |
150 | use_item = True | 150 | use_item = True |
151 | 151 | ||
152 | if use_item: | 152 | if use_item: |
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 @@ | |||
1 | from .generated import common_pb2 as common_pb2 | ||
2 | from .generated import data_pb2 as data_pb2 | 1 | from .generated import data_pb2 as data_pb2 |
3 | import pkgutil | 2 | import pkgutil |
4 | 3 | ||
@@ -18,20 +17,20 @@ class Lingo2StaticLogic: | |||
18 | self.objects.ParseFromString(bytearray(file)) | 17 | self.objects.ParseFromString(bytearray(file)) |
19 | 18 | ||
20 | for door in self.objects.doors: | 19 | for door in self.objects.doors: |
21 | if door.type in [common_pb2.DoorType.STANDARD, common_pb2.DoorType.LOCATION_ONLY]: | 20 | if door.type in [data_pb2.DoorType.STANDARD, data_pb2.DoorType.LOCATION_ONLY]: |
22 | location_name = f"{self.objects.maps[door.map_id].name} - {door.name}" | 21 | location_name = f"{self.objects.maps[door.map_id].name} - {door.name}" |
23 | self.location_id_to_name[door.ap_id] = location_name | 22 | self.location_id_to_name[door.ap_id] = location_name |
24 | 23 | ||
25 | if door.type not in [common_pb2.DoorType.EVENT, common_pb2.DoorType.LOCATION_ONLY]: | 24 | if door.type not in [data_pb2.DoorType.EVENT, data_pb2.DoorType.LOCATION_ONLY]: |
26 | item_name = self.get_door_item_name(door.id) | 25 | item_name = self.get_door_item_name(door.id) |
27 | self.item_id_to_name[door.ap_id] = item_name | 26 | self.item_id_to_name[door.ap_id] = item_name |
28 | 27 | ||
29 | for letter in self.objects.letters: | 28 | for letter in self.objects.letters: |
30 | letter_name = f"{letter.key.upper()}{'' if letter.double else '2'}" | 29 | letter_name = f"{letter.key.upper()}{'' if letter.level2 else '2'}" |
31 | location_name = f"{self.objects.maps[self.objects.rooms[letter.room_id].map_id].name} - {letter_name}" | 30 | location_name = f"{self.objects.maps[self.objects.rooms[letter.room_id].map_id].name} - {letter_name}" |
32 | self.location_id_to_name[letter.ap_id] = location_name | 31 | self.location_id_to_name[letter.ap_id] = location_name |
33 | 32 | ||
34 | if not letter.double: | 33 | if not letter.level2: |
35 | self.item_id_to_name[letter.ap_id] = letter_name | 34 | self.item_id_to_name[letter.ap_id] = letter_name |
36 | 35 | ||
37 | for mastery in self.objects.masteries: | 36 | for mastery in self.objects.masteries: |
diff --git a/data/maps/four_rooms/rooms/A2 Room.txtpb b/data/maps/four_rooms/rooms/A2 Room.txtpb index 20c9838..236ce01 100644 --- a/data/maps/four_rooms/rooms/A2 Room.txtpb +++ b/data/maps/four_rooms/rooms/A2 Room.txtpb | |||
@@ -2,6 +2,6 @@ name: "A2 Room" | |||
2 | display_name: "Hallway" | 2 | display_name: "Hallway" |
3 | letters { | 3 | letters { |
4 | key: "a" | 4 | key: "a" |
5 | double: true | 5 | level2: true |
6 | path: "Components/Collectables/a2" | 6 | path: "Components/Collectables/a2" |
7 | } | 7 | } |
diff --git a/data/maps/the_bearer/rooms/Q2 Room.txtpb b/data/maps/the_bearer/rooms/Q2 Room.txtpb index 2c0c276..ab5032a 100644 --- a/data/maps/the_bearer/rooms/Q2 Room.txtpb +++ b/data/maps/the_bearer/rooms/Q2 Room.txtpb | |||
@@ -2,6 +2,6 @@ name: "Q2 Room" | |||
2 | display_name: "Back Area" | 2 | display_name: "Back Area" |
3 | letters { | 3 | letters { |
4 | key: "q" | 4 | key: "q" |
5 | double: true | 5 | level2: true |
6 | path: "Components/Collectables/collectable" | 6 | path: "Components/Collectables/collectable" |
7 | } | 7 | } |
diff --git a/data/maps/the_between/rooms/B2 Room.txtpb b/data/maps/the_between/rooms/B2 Room.txtpb index 97b4684..aad5d15 100644 --- a/data/maps/the_between/rooms/B2 Room.txtpb +++ b/data/maps/the_between/rooms/B2 Room.txtpb | |||
@@ -2,7 +2,7 @@ name: "B2 Room" | |||
2 | display_name: "B2 Room" | 2 | display_name: "B2 Room" |
3 | letters { | 3 | letters { |
4 | key: "b" | 4 | key: "b" |
5 | double: true | 5 | level2: true |
6 | path: "Components/Collectables/collectable" | 6 | path: "Components/Collectables/collectable" |
7 | } | 7 | } |
8 | # Uhh idk if the paintings and door in here should be randomized. | 8 | # Uhh idk if the paintings and door in here should be randomized. |
diff --git a/data/maps/the_colorful/rooms/P2 Room.txtpb b/data/maps/the_colorful/rooms/P2 Room.txtpb index 8c7e0f1..85dbf20 100644 --- a/data/maps/the_colorful/rooms/P2 Room.txtpb +++ b/data/maps/the_colorful/rooms/P2 Room.txtpb | |||
@@ -2,6 +2,6 @@ name: "P2 Room" | |||
2 | display_name: "Cyan Room" | 2 | display_name: "Cyan Room" |
3 | letters { | 3 | letters { |
4 | key: "p" | 4 | key: "p" |
5 | double: true | 5 | level2: true |
6 | path: "Components/Collectables/p2" | 6 | path: "Components/Collectables/p2" |
7 | } | 7 | } |
diff --git a/data/maps/the_congruent/rooms/C2 Room.txtpb b/data/maps/the_congruent/rooms/C2 Room.txtpb index 69c9a46..852d4e2 100644 --- a/data/maps/the_congruent/rooms/C2 Room.txtpb +++ b/data/maps/the_congruent/rooms/C2 Room.txtpb | |||
@@ -2,6 +2,6 @@ name: "C2 Room" | |||
2 | display_name: "Main Area" | 2 | display_name: "Main Area" |
3 | letters { | 3 | letters { |
4 | key: "c" | 4 | key: "c" |
5 | double: true | 5 | level2: true |
6 | path: "Components/Collectables/collectable2" | 6 | path: "Components/Collectables/collectable2" |
7 | } | 7 | } |
diff --git a/data/maps/the_congruent/rooms/G2 Room.txtpb b/data/maps/the_congruent/rooms/G2 Room.txtpb index ba9d772..80a23cb 100644 --- a/data/maps/the_congruent/rooms/G2 Room.txtpb +++ b/data/maps/the_congruent/rooms/G2 Room.txtpb | |||
@@ -2,6 +2,6 @@ name: "G2 Room" | |||
2 | display_name: "Main Area" | 2 | display_name: "Main Area" |
3 | letters { | 3 | letters { |
4 | key: "g" | 4 | key: "g" |
5 | double: true | 5 | level2: true |
6 | path: "Components/Collectables/collectable" | 6 | path: "Components/Collectables/collectable" |
7 | } | 7 | } |
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) | |||
5 | protobuf_generate( | 5 | protobuf_generate( |
6 | LANGUAGE cpp | 6 | LANGUAGE cpp |
7 | TARGET protos | 7 | TARGET protos |
8 | PROTOS human.proto data.proto common.proto | 8 | PROTOS human.proto data.proto |
9 | ) | 9 | ) |
10 | 10 | ||
11 | target_link_libraries(protos PUBLIC protobuf::libprotobuf) | 11 | 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 @@ | |||
1 | edition = "2023"; | ||
2 | |||
3 | package com.fourisland.lingo2_archipelago; | ||
4 | |||
5 | message Proxy { | ||
6 | string answer = 1; | ||
7 | string path = 2; | ||
8 | } | ||
9 | |||
10 | enum DoorType { | ||
11 | DOOR_TYPE_UNKNOWN = 0; | ||
12 | |||
13 | // This door is a location unless panelsanity is on, and it is an item as long as door shuffle is on. | ||
14 | STANDARD = 1; | ||
15 | |||
16 | // This door is never an item or a location. | ||
17 | EVENT = 2; | ||
18 | |||
19 | // This door is never a location, and is an item as long as door shuffle is on. | ||
20 | ITEM_ONLY = 3; | ||
21 | |||
22 | // This door is never a location, and is an item as long as control center color shuffle is on. | ||
23 | CONTROL_CENTER_COLOR = 4; | ||
24 | |||
25 | // This door is never an item, and is a location as long as panelsanity is not on. | ||
26 | LOCATION_ONLY = 5; | ||
27 | } | ||
28 | |||
29 | enum AxisDirection { | ||
30 | AXIS_DIRECTION_UNKNOWN = 0; | ||
31 | |||
32 | X_PLUS = 1; | ||
33 | X_MINUS = 2; | ||
34 | Y_PLUS = 3; | ||
35 | Y_MINUS = 4; | ||
36 | Z_PLUS = 5; | ||
37 | Z_MINUS = 6; | ||
38 | } | ||
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 @@ | |||
1 | edition = "2023"; | 1 | syntax = "proto2"; |
2 | |||
3 | import "common.proto"; | ||
4 | 2 | ||
5 | package com.fourisland.lingo2_archipelago; | 3 | package com.fourisland.lingo2_archipelago; |
6 | 4 | ||
5 | message Proxy { | ||
6 | optional string answer = 1; | ||
7 | optional string path = 2; | ||
8 | } | ||
9 | |||
10 | enum DoorType { | ||
11 | DOOR_TYPE_UNKNOWN = 0; | ||
12 | |||
13 | // This door is a location unless panelsanity is on, and it is an item as long as door shuffle is on. | ||
14 | STANDARD = 1; | ||
15 | |||
16 | // This door is never an item or a location. | ||
17 | EVENT = 2; | ||
18 | |||
19 | // This door is never a location, and is an item as long as door shuffle is on. | ||
20 | ITEM_ONLY = 3; | ||
21 | |||
22 | // This door is never a location, and is an item as long as control center color shuffle is on. | ||
23 | CONTROL_CENTER_COLOR = 4; | ||
24 | |||
25 | // This door is never an item, and is a location as long as panelsanity is not on. | ||
26 | LOCATION_ONLY = 5; | ||
27 | } | ||
28 | |||
29 | enum AxisDirection { | ||
30 | AXIS_DIRECTION_UNKNOWN = 0; | ||
31 | |||
32 | X_PLUS = 1; | ||
33 | X_MINUS = 2; | ||
34 | Y_PLUS = 3; | ||
35 | Y_MINUS = 4; | ||
36 | Z_PLUS = 5; | ||
37 | Z_MINUS = 6; | ||
38 | } | ||
39 | |||
7 | message ProxyIdentifier { | 40 | message ProxyIdentifier { |
8 | uint64 panel = 1; | 41 | optional uint64 panel = 1; |
9 | string answer = 2; | 42 | optional string answer = 2; |
10 | } | 43 | } |
11 | 44 | ||
12 | message KeyholderAnswer { | 45 | message KeyholderAnswer { |
13 | uint64 keyholder = 1; | 46 | optional uint64 keyholder = 1; |
14 | string key = 2; | 47 | optional string key = 2; |
15 | } | 48 | } |
16 | 49 | ||
17 | message Connection { | 50 | message Connection { |
18 | uint64 from_room = 1; | 51 | optional uint64 from_room = 1; |
19 | uint64 to_room = 2; | 52 | optional uint64 to_room = 2; |
20 | uint64 required_door = 3; | 53 | optional uint64 required_door = 3; |
21 | 54 | ||
22 | oneof trigger { | 55 | oneof trigger { |
23 | uint64 port = 4; | 56 | uint64 port = 4; |
@@ -27,105 +60,105 @@ message Connection { | |||
27 | } | 60 | } |
28 | 61 | ||
29 | message Door { | 62 | message Door { |
30 | uint64 id = 1; | 63 | optional uint64 id = 1; |
31 | uint64 ap_id = 11; | 64 | optional uint64 ap_id = 11; |
32 | uint64 map_id = 9; | 65 | optional uint64 map_id = 9; |
33 | uint64 room_id = 10; | 66 | optional uint64 room_id = 10; |
34 | string name = 2; | 67 | optional string name = 2; |
35 | 68 | ||
36 | repeated string receivers = 3; | 69 | repeated string receivers = 3; |
37 | repeated uint64 move_paintings = 4; | 70 | repeated uint64 move_paintings = 4; |
38 | 71 | ||
39 | repeated ProxyIdentifier panels = 5; | 72 | repeated ProxyIdentifier panels = 5; |
40 | uint64 complete_at = 12; | 73 | optional uint64 complete_at = 12; |
41 | 74 | ||
42 | string control_center_color = 6; | 75 | optional string control_center_color = 6; |
43 | repeated string switches = 7; | 76 | repeated string switches = 7; |
44 | repeated KeyholderAnswer keyholders = 13; | 77 | repeated KeyholderAnswer keyholders = 13; |
45 | repeated uint64 rooms = 14; | 78 | repeated uint64 rooms = 14; |
46 | 79 | ||
47 | DoorType type = 8; | 80 | optional DoorType type = 8; |
48 | } | 81 | } |
49 | 82 | ||
50 | message Panel { | 83 | message PanelData { |
51 | uint64 id = 1; | 84 | optional uint64 id = 1; |
52 | uint64 ap_id = 10; | 85 | optional uint64 ap_id = 10; |
53 | uint64 room_id = 2; | 86 | optional uint64 room_id = 2; |
54 | string name = 3; | 87 | optional string name = 3; |
55 | 88 | ||
56 | string path = 4; | 89 | optional string path = 4; |
57 | string clue = 5; | 90 | optional string clue = 5; |
58 | string answer = 6; | 91 | optional string answer = 6; |
59 | repeated string symbols = 7; | 92 | repeated string symbols = 7; |
60 | 93 | ||
61 | repeated Proxy proxies = 8; | 94 | repeated Proxy proxies = 8; |
62 | 95 | ||
63 | uint64 required_door = 9; | 96 | optional uint64 required_door = 9; |
64 | uint64 required_room = 11; | 97 | optional uint64 required_room = 11; |
65 | } | 98 | } |
66 | 99 | ||
67 | message Painting { | 100 | message Painting { |
68 | uint64 id = 1; | 101 | optional uint64 id = 1; |
69 | uint64 room_id = 2; | 102 | optional uint64 room_id = 2; |
70 | string name = 9; | 103 | optional string name = 9; |
71 | 104 | ||
72 | string path = 10; | 105 | optional string path = 10; |
73 | string display_name = 4; | 106 | optional string display_name = 4; |
74 | 107 | ||
75 | string orientation = 3; | 108 | optional string orientation = 3; |
76 | bool move = 6; | 109 | optional bool move = 6; |
77 | bool enter_only = 7; | 110 | optional bool enter_only = 7; |
78 | AxisDirection gravity = 8 [default = Y_MINUS]; | 111 | optional AxisDirection gravity = 8; |
79 | bool exit_only = 11; | 112 | optional bool exit_only = 11; |
80 | 113 | ||
81 | uint64 required_door = 5; | 114 | optional uint64 required_door = 5; |
82 | } | 115 | } |
83 | 116 | ||
84 | message Port { | 117 | message Port { |
85 | uint64 id = 1; | 118 | optional uint64 id = 1; |
86 | uint64 room_id = 2; | 119 | optional uint64 room_id = 2; |
87 | string name = 3; | 120 | optional string name = 3; |
88 | 121 | ||
89 | string path = 4; | 122 | optional string path = 4; |
90 | string orientation = 5; | 123 | optional string orientation = 5; |
91 | AxisDirection gravity = 7 [default = Y_MINUS]; | 124 | optional AxisDirection gravity = 7; |
92 | 125 | ||
93 | uint64 required_door = 6; | 126 | optional uint64 required_door = 6; |
94 | } | 127 | } |
95 | 128 | ||
96 | message Keyholder { | 129 | message Keyholder { |
97 | uint64 id = 1; | 130 | optional uint64 id = 1; |
98 | uint64 room_id = 2; | 131 | optional uint64 room_id = 2; |
99 | 132 | ||
100 | string name = 3; | 133 | optional string name = 3; |
101 | string path = 4; | 134 | optional string path = 4; |
102 | } | 135 | } |
103 | 136 | ||
104 | message Letter { | 137 | message Letter { |
105 | uint64 id = 3; | 138 | optional uint64 id = 3; |
106 | uint64 ap_id = 5; | 139 | optional uint64 ap_id = 5; |
107 | uint64 room_id = 4; | 140 | optional uint64 room_id = 4; |
108 | 141 | ||
109 | string key = 1; | 142 | optional string key = 1; |
110 | bool double = 2; | 143 | optional bool level2 = 2; |
111 | 144 | ||
112 | string path = 6; | 145 | optional string path = 6; |
113 | } | 146 | } |
114 | 147 | ||
115 | message Mastery { | 148 | message Mastery { |
116 | uint64 id = 1; | 149 | optional uint64 id = 1; |
117 | uint64 ap_id = 2; | 150 | optional uint64 ap_id = 2; |
118 | uint64 room_id = 3; | 151 | optional uint64 room_id = 3; |
119 | 152 | ||
120 | string name = 4; | 153 | optional string name = 4; |
121 | string path = 5; | 154 | optional string path = 5; |
122 | } | 155 | } |
123 | 156 | ||
124 | message Room { | 157 | message Room { |
125 | uint64 id = 1; | 158 | optional uint64 id = 1; |
126 | uint64 map_id = 8; | 159 | optional uint64 map_id = 8; |
127 | string name = 2; | 160 | optional string name = 2; |
128 | string display_name = 3; | 161 | optional string display_name = 3; |
129 | 162 | ||
130 | repeated uint64 panels = 4; | 163 | repeated uint64 panels = 4; |
131 | repeated uint64 paintings = 5; | 164 | repeated uint64 paintings = 5; |
@@ -137,15 +170,15 @@ message Room { | |||
137 | } | 170 | } |
138 | 171 | ||
139 | message Map { | 172 | message Map { |
140 | uint64 id = 1; | 173 | optional uint64 id = 1; |
141 | string name = 2; | 174 | optional string name = 2; |
142 | } | 175 | } |
143 | 176 | ||
144 | message AllObjects { | 177 | message AllObjects { |
145 | repeated Map maps = 7; | 178 | repeated Map maps = 7; |
146 | repeated Room rooms = 1; | 179 | repeated Room rooms = 1; |
147 | repeated Door doors = 2; | 180 | repeated Door doors = 2; |
148 | repeated Panel panels = 3; | 181 | repeated PanelData panels = 3; |
149 | repeated Painting paintings = 4; | 182 | repeated Painting paintings = 4; |
150 | repeated Port ports = 5; | 183 | repeated Port ports = 5; |
151 | repeated Keyholder keyholders = 11; | 184 | 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 @@ | |||
1 | edition = "2023"; | 1 | syntax = "proto2"; |
2 | 2 | ||
3 | import "common.proto"; | 3 | import "data.proto"; |
4 | 4 | ||
5 | package com.fourisland.lingo2_archipelago; | 5 | package com.fourisland.lingo2_archipelago; |
6 | 6 | ||
7 | message RoomIdentifier { | 7 | message RoomIdentifier { |
8 | string map = 1; | 8 | optional string map = 1; |
9 | string name = 2; | 9 | optional string name = 2; |
10 | } | 10 | } |
11 | 11 | ||
12 | message DoorIdentifier { | 12 | message DoorIdentifier { |
13 | string map = 1; | 13 | optional string map = 1; |
14 | string name = 2; | 14 | optional string name = 2; |
15 | } | 15 | } |
16 | 16 | ||
17 | message PortIdentifier { | 17 | message PortIdentifier { |
18 | string map = 1; | 18 | optional string map = 1; |
19 | string room = 2; | 19 | optional string room = 2; |
20 | string name = 3; | 20 | optional string name = 3; |
21 | } | 21 | } |
22 | 22 | ||
23 | message PaintingIdentifier { | 23 | message PaintingIdentifier { |
24 | string map = 1; | 24 | optional string map = 1; |
25 | string room = 2; | 25 | optional string room = 2; |
26 | string name = 3; | 26 | optional string name = 3; |
27 | } | 27 | } |
28 | 28 | ||
29 | message PanelIdentifier { | 29 | message PanelIdentifier { |
30 | string map = 1; | 30 | optional string map = 1; |
31 | string room = 2; | 31 | optional string room = 2; |
32 | string name = 3; | 32 | optional string name = 3; |
33 | string answer = 4; | 33 | optional string answer = 4; |
34 | } | 34 | } |
35 | 35 | ||
36 | message KeyholderIdentifier { | 36 | message KeyholderIdentifier { |
37 | string map = 1; | 37 | optional string map = 1; |
38 | string room = 2; | 38 | optional string room = 2; |
39 | string name = 3; | 39 | optional string name = 3; |
40 | string key = 4; | 40 | optional string key = 4; |
41 | } | 41 | } |
42 | 42 | ||
43 | message HumanConnection { | 43 | message HumanConnection { |
@@ -60,8 +60,8 @@ message HumanConnection { | |||
60 | string to_room = 6; | 60 | string to_room = 6; |
61 | } | 61 | } |
62 | 62 | ||
63 | bool oneway = 3; | 63 | optional bool oneway = 3; |
64 | DoorIdentifier door = 4; | 64 | optional DoorIdentifier door = 4; |
65 | } | 65 | } |
66 | 66 | ||
67 | message HumanConnections { | 67 | message HumanConnections { |
@@ -69,7 +69,7 @@ message HumanConnections { | |||
69 | } | 69 | } |
70 | 70 | ||
71 | message HumanDoor { | 71 | message HumanDoor { |
72 | string name = 1; | 72 | optional string name = 1; |
73 | 73 | ||
74 | repeated string receivers = 2; | 74 | repeated string receivers = 2; |
75 | repeated PaintingIdentifier move_paintings = 8; | 75 | repeated PaintingIdentifier move_paintings = 8; |
@@ -79,15 +79,15 @@ message HumanDoor { | |||
79 | 79 | ||
80 | // If set, the number of panels from the above set that need to be solved. | 80 | // If set, the number of panels from the above set that need to be solved. |
81 | // Warning: this is a messy kind of OR logic! Consider if there's another way. | 81 | // Warning: this is a messy kind of OR logic! Consider if there's another way. |
82 | uint64 complete_at = 9; | 82 | optional uint64 complete_at = 9; |
83 | 83 | ||
84 | string control_center_color = 6; | 84 | optional string control_center_color = 6; |
85 | repeated string switches = 7; | 85 | repeated string switches = 7; |
86 | repeated KeyholderIdentifier keyholders = 10; | 86 | repeated KeyholderIdentifier keyholders = 10; |
87 | repeated RoomIdentifier rooms = 11; | 87 | repeated RoomIdentifier rooms = 11; |
88 | 88 | ||
89 | DoorType type = 4; | 89 | optional DoorType type = 4; |
90 | string location_room = 5; | 90 | optional string location_room = 5; |
91 | } | 91 | } |
92 | 92 | ||
93 | message HumanDoors { | 93 | message HumanDoors { |
@@ -95,64 +95,64 @@ message HumanDoors { | |||
95 | } | 95 | } |
96 | 96 | ||
97 | message HumanPanel { | 97 | message HumanPanel { |
98 | string name = 1; | 98 | optional string name = 1; |
99 | string path = 5; | 99 | optional string path = 5; |
100 | 100 | ||
101 | string clue = 2; | 101 | optional string clue = 2; |
102 | string answer = 3; | 102 | optional string answer = 3; |
103 | repeated string symbols = 4; | 103 | repeated string symbols = 4; |
104 | 104 | ||
105 | repeated Proxy proxies = 6; | 105 | repeated Proxy proxies = 6; |
106 | 106 | ||
107 | DoorIdentifier required_door = 7; | 107 | optional DoorIdentifier required_door = 7; |
108 | RoomIdentifier required_room = 8; | 108 | optional RoomIdentifier required_room = 8; |
109 | } | 109 | } |
110 | 110 | ||
111 | message HumanPainting { | 111 | message HumanPainting { |
112 | string name = 1; | 112 | optional string name = 1; |
113 | string path = 2; | 113 | optional string path = 2; |
114 | 114 | ||
115 | string display_name = 4; | 115 | optional string display_name = 4; |
116 | 116 | ||
117 | string orientation = 3; | 117 | optional string orientation = 3; |
118 | bool move = 6; | 118 | optional bool move = 6; |
119 | bool enter_only = 7; | 119 | optional bool enter_only = 7; |
120 | AxisDirection gravity = 8 [default = Y_MINUS]; | 120 | optional AxisDirection gravity = 8 [default = Y_MINUS]; |
121 | bool exit_only = 9; | 121 | optional bool exit_only = 9; |
122 | 122 | ||
123 | DoorIdentifier required_door = 5; | 123 | optional DoorIdentifier required_door = 5; |
124 | } | 124 | } |
125 | 125 | ||
126 | message HumanPort { | 126 | message HumanPort { |
127 | string name = 1; | 127 | optional string name = 1; |
128 | string path = 2; | 128 | optional string path = 2; |
129 | 129 | ||
130 | string orientation = 3; | 130 | optional string orientation = 3; |
131 | AxisDirection gravity = 5 [default = Y_MINUS]; | 131 | optional AxisDirection gravity = 5 [default = Y_MINUS]; |
132 | 132 | ||
133 | DoorIdentifier required_door = 4; | 133 | optional DoorIdentifier required_door = 4; |
134 | } | 134 | } |
135 | 135 | ||
136 | message HumanKeyholder { | 136 | message HumanKeyholder { |
137 | string name = 1; | 137 | optional string name = 1; |
138 | string path = 2; | 138 | optional string path = 2; |
139 | } | 139 | } |
140 | 140 | ||
141 | message HumanLetter { | 141 | message HumanLetter { |
142 | string key = 1; | 142 | optional string key = 1; |
143 | bool double = 2; | 143 | optional bool level2 = 2; |
144 | 144 | ||
145 | string path = 3; | 145 | optional string path = 3; |
146 | } | 146 | } |
147 | 147 | ||
148 | message HumanMastery { | 148 | message HumanMastery { |
149 | string name = 1; | 149 | optional string name = 1; |
150 | string path = 2; | 150 | optional string path = 2; |
151 | } | 151 | } |
152 | 152 | ||
153 | message HumanRoom { | 153 | message HumanRoom { |
154 | string name = 1; | 154 | optional string name = 1; |
155 | string display_name = 2; | 155 | optional string display_name = 2; |
156 | 156 | ||
157 | repeated HumanPanel panels = 3; | 157 | repeated HumanPanel panels = 3; |
158 | repeated HumanPainting paintings = 4; | 158 | repeated HumanPainting paintings = 4; |
diff --git a/tools/assign_ids/main.cpp b/tools/assign_ids/main.cpp index 349c258..2617cf7 100644 --- a/tools/assign_ids/main.cpp +++ b/tools/assign_ids/main.cpp | |||
@@ -170,8 +170,7 @@ class AssignIds { | |||
170 | } | 170 | } |
171 | 171 | ||
172 | for (const HumanLetter& h_letter : h_room.letters()) { | 172 | for (const HumanLetter& h_letter : h_room.letters()) { |
173 | std::string lettername = | 173 | std::string lettername = GetLetterName(h_letter.key(), h_letter.level2()); |
174 | GetLetterName(h_letter.key(), h_letter.double_()); | ||
175 | 174 | ||
176 | if (!id_mappings_.letters().contains(lettername)) { | 175 | if (!id_mappings_.letters().contains(lettername)) { |
177 | auto& letters = *id_mappings_.mutable_letters(); | 176 | auto& letters = *id_mappings_.mutable_letters(); |
diff --git a/tools/datapacker/container.cpp b/tools/datapacker/container.cpp index bb58ec5..ffcb75a 100644 --- a/tools/datapacker/container.cpp +++ b/tools/datapacker/container.cpp | |||
@@ -160,7 +160,7 @@ uint64_t Container::FindOrAddPanel(std::optional<std::string> map_name, | |||
160 | auto it = room_container.find(panel_name); | 160 | auto it = room_container.find(panel_name); |
161 | if (it == room_container.end()) { | 161 | if (it == room_container.end()) { |
162 | uint64_t new_id = all_objects_.panels_size(); | 162 | uint64_t new_id = all_objects_.panels_size(); |
163 | Panel* panel = all_objects_.add_panels(); | 163 | PanelData* panel = all_objects_.add_panels(); |
164 | panel->set_id(new_id); | 164 | panel->set_id(new_id); |
165 | panel->set_room_id(FindOrAddRoom(map_name, *room_name, std::nullopt)); | 165 | panel->set_room_id(FindOrAddRoom(map_name, *room_name, std::nullopt)); |
166 | panel->set_name(panel_name); | 166 | panel->set_name(panel_name); |
@@ -173,8 +173,8 @@ uint64_t Container::FindOrAddPanel(std::optional<std::string> map_name, | |||
173 | } | 173 | } |
174 | } | 174 | } |
175 | 175 | ||
176 | uint64_t Container::FindOrAddLetter(std::string key, bool double_) { | 176 | uint64_t Container::FindOrAddLetter(std::string key, bool level2) { |
177 | std::string letter_name = GetLetterName(key, double_); | 177 | std::string letter_name = GetLetterName(key, level2); |
178 | 178 | ||
179 | auto it = letter_id_by_name_.find(letter_name); | 179 | auto it = letter_id_by_name_.find(letter_name); |
180 | if (it == letter_id_by_name_.end()) { | 180 | if (it == letter_id_by_name_.end()) { |
@@ -183,8 +183,8 @@ uint64_t Container::FindOrAddLetter(std::string key, bool double_) { | |||
183 | letter->set_id(new_id); | 183 | letter->set_id(new_id); |
184 | letter->set_key(key); | 184 | letter->set_key(key); |
185 | 185 | ||
186 | if (double_) { | 186 | if (level2) { |
187 | letter->set_double_(double_); | 187 | letter->set_level2(level2); |
188 | } | 188 | } |
189 | 189 | ||
190 | letter_id_by_name_[letter_name] = new_id; | 190 | letter_id_by_name_[letter_name] = new_id; |
diff --git a/tools/datapacker/container.h b/tools/datapacker/container.h index 7ee5b5b..e1a84d8 100644 --- a/tools/datapacker/container.h +++ b/tools/datapacker/container.h | |||
@@ -36,7 +36,7 @@ class Container { | |||
36 | std::optional<std::string> map_fallback, | 36 | std::optional<std::string> map_fallback, |
37 | std::optional<std::string> room_fallback); | 37 | std::optional<std::string> room_fallback); |
38 | 38 | ||
39 | uint64_t FindOrAddLetter(std::string key, bool double_); | 39 | uint64_t FindOrAddLetter(std::string key, bool level2); |
40 | 40 | ||
41 | uint64_t FindLetterByName(std::string letter_name); | 41 | uint64_t FindLetterByName(std::string letter_name); |
42 | 42 | ||
diff --git a/tools/datapacker/main.cpp b/tools/datapacker/main.cpp index d3908b4..8b87ab1 100644 --- a/tools/datapacker/main.cpp +++ b/tools/datapacker/main.cpp | |||
@@ -122,7 +122,7 @@ class DataPacker { | |||
122 | uint64_t panel_id = | 122 | uint64_t panel_id = |
123 | container_.FindOrAddPanel(current_map_name, current_room_name, | 123 | container_.FindOrAddPanel(current_map_name, current_room_name, |
124 | h_panel.name(), std::nullopt, std::nullopt); | 124 | h_panel.name(), std::nullopt, std::nullopt); |
125 | Panel& panel = *container_.all_objects().mutable_panels(panel_id); | 125 | PanelData& panel = *container_.all_objects().mutable_panels(panel_id); |
126 | 126 | ||
127 | panel.set_path(h_panel.path()); | 127 | panel.set_path(h_panel.path()); |
128 | panel.set_clue(h_panel.clue()); | 128 | panel.set_clue(h_panel.clue()); |
@@ -169,9 +169,9 @@ class DataPacker { | |||
169 | painting.set_display_name(h_painting.display_name()); | 169 | painting.set_display_name(h_painting.display_name()); |
170 | painting.set_orientation(h_painting.orientation()); | 170 | painting.set_orientation(h_painting.orientation()); |
171 | 171 | ||
172 | if (h_painting.has_gravity()) { | 172 | // Setting this explicitly because the Godot protobuf doesn't support |
173 | painting.set_gravity(h_painting.gravity()); | 173 | // custom defaults. |
174 | } | 174 | painting.set_gravity(h_painting.gravity()); |
175 | 175 | ||
176 | if (h_painting.has_move()) { | 176 | if (h_painting.has_move()) { |
177 | painting.set_move(h_painting.move()); | 177 | painting.set_move(h_painting.move()); |
@@ -208,9 +208,9 @@ class DataPacker { | |||
208 | port.set_path(h_port.path()); | 208 | port.set_path(h_port.path()); |
209 | port.set_orientation(h_port.orientation()); | 209 | port.set_orientation(h_port.orientation()); |
210 | 210 | ||
211 | if (h_port.has_gravity()) { | 211 | // Setting this explicitly because the Godot protobuf doesn't support |
212 | port.set_gravity(h_port.gravity()); | 212 | // custom defaults. |
213 | } | 213 | port.set_gravity(h_port.gravity()); |
214 | 214 | ||
215 | if (h_port.has_required_door()) { | 215 | if (h_port.has_required_door()) { |
216 | std::optional<std::string> map_name = | 216 | std::optional<std::string> map_name = |
@@ -228,7 +228,7 @@ class DataPacker { | |||
228 | const std::string& current_map_name, | 228 | const std::string& current_map_name, |
229 | const std::string& current_room_name) { | 229 | const std::string& current_room_name) { |
230 | uint64_t letter_id = | 230 | uint64_t letter_id = |
231 | container_.FindOrAddLetter(h_letter.key(), h_letter.double_()); | 231 | container_.FindOrAddLetter(h_letter.key(), h_letter.level2()); |
232 | Letter& letter = *container_.all_objects().mutable_letters(letter_id); | 232 | Letter& letter = *container_.all_objects().mutable_letters(letter_id); |
233 | 233 | ||
234 | letter.set_room_id(container_.FindOrAddRoom( | 234 | letter.set_room_id(container_.FindOrAddRoom( |
diff --git a/tools/util/naming.cpp b/tools/util/naming.cpp index 12594c5..0ae99f6 100644 --- a/tools/util/naming.cpp +++ b/tools/util/naming.cpp | |||
@@ -2,10 +2,10 @@ | |||
2 | 2 | ||
3 | #include <sstream> | 3 | #include <sstream> |
4 | 4 | ||
5 | std::string GetLetterName(std::string key, bool double_) { | 5 | std::string GetLetterName(std::string key, bool level2) { |
6 | std::ostringstream lettername_s; | 6 | std::ostringstream lettername_s; |
7 | lettername_s << key; | 7 | lettername_s << key; |
8 | lettername_s << (double_ ? "2" : "1"); | 8 | lettername_s << (level2 ? "2" : "1"); |
9 | 9 | ||
10 | return lettername_s.str(); | 10 | return lettername_s.str(); |
11 | } | 11 | } |
diff --git a/tools/util/naming.h b/tools/util/naming.h index 7d61309..9a68851 100644 --- a/tools/util/naming.h +++ b/tools/util/naming.h | |||
@@ -3,6 +3,6 @@ | |||
3 | 3 | ||
4 | #include <string> | 4 | #include <string> |
5 | 5 | ||
6 | std::string GetLetterName(std::string key, bool double_); | 6 | std::string GetLetterName(std::string key, bool level2); |
7 | 7 | ||
8 | #endif /* TOOLS_UTIL_NAMING_H_ */ | 8 | #endif /* TOOLS_UTIL_NAMING_H_ */ |