diff options
author | Star Rauchenberger <fefferburbia@gmail.com> | 2024-04-15 12:56:19 -0400 |
---|---|---|
committer | Star Rauchenberger <fefferburbia@gmail.com> | 2024-04-15 12:56:19 -0400 |
commit | 49d7ff22aae922ef081bac1aa2a4b47b2b079166 (patch) | |
tree | 19059b3cf48d3fbe34b71dffe32b3cbe7ed31866 /Archipelago | |
parent | e448f5b318f05cae1b40a949e11ef2d7fb613645 (diff) | |
download | lingo-archipelago-49d7ff22aae922ef081bac1aa2a4b47b2b079166.tar.gz lingo-archipelago-49d7ff22aae922ef081bac1aa2a4b47b2b079166.tar.bz2 lingo-archipelago-49d7ff22aae922ef081bac1aa2a4b47b2b079166.zip |
Backwards compatibility for games genned before panels mode options changes
Diffstat (limited to 'Archipelago')
-rw-r--r-- | Archipelago/client.gd | 25 |
1 files changed, 23 insertions, 2 deletions
diff --git a/Archipelago/client.gd b/Archipelago/client.gd index cafe2f9..63c82f4 100644 --- a/Archipelago/client.gd +++ b/Archipelago/client.gd | |||
@@ -128,6 +128,7 @@ var _item_name_to_id = {} # LINGO only | |||
128 | var _location_name_to_id = {} # LINGO only | 128 | var _location_name_to_id = {} # LINGO only |
129 | 129 | ||
130 | var _remote_version = {"major": 0, "minor": 0, "build": 0} | 130 | var _remote_version = {"major": 0, "minor": 0, "build": 0} |
131 | var _gen_version = {"major": 0, "minor": 0, "build": 0} | ||
131 | 132 | ||
132 | # TODO: caching per MW/slot, reset between connections | 133 | # TODO: caching per MW/slot, reset between connections |
133 | var _authenticated = false | 134 | var _authenticated = false |
@@ -265,6 +266,7 @@ func _on_data(): | |||
265 | if cmd == "RoomInfo": | 266 | if cmd == "RoomInfo": |
266 | _seed = message["seed_name"] | 267 | _seed = message["seed_name"] |
267 | _remote_version = message["version"] | 268 | _remote_version = message["version"] |
269 | _gen_version = message["generator_version"] | ||
268 | 270 | ||
269 | var needed_games = [] | 271 | var needed_games = [] |
270 | for game in message["datapackage_checksums"].keys(): | 272 | for game in message["datapackage_checksums"].keys(): |
@@ -313,8 +315,13 @@ func _on_data(): | |||
313 | if _slot_data.has("shuffle_colors"): | 315 | if _slot_data.has("shuffle_colors"): |
314 | _color_shuffle = _slot_data["shuffle_colors"] | 316 | _color_shuffle = _slot_data["shuffle_colors"] |
315 | if _slot_data.has("shuffle_doors"): | 317 | if _slot_data.has("shuffle_doors"): |
316 | _door_shuffle = (_slot_data["shuffle_doors"] == 2) | 318 | # TODO: This assumes that panels mode will be releaed in 0.4.6, which is untrue. |
317 | _panel_door_shuffle = (_slot_data["shuffle_doors"] == 1) | 319 | if wasGeneratedBeforeVersion({"major": 0, "minor": 4, "build": 6}): |
320 | _door_shuffle = (_slot_data["shuffle_doors"] > 0) | ||
321 | _panel_door_shuffle = false | ||
322 | else: | ||
323 | _door_shuffle = (_slot_data["shuffle_doors"] == 2) | ||
324 | _panel_door_shuffle = (_slot_data["shuffle_doors"] == 1) | ||
318 | if _slot_data.has("shuffle_paintings"): | 325 | if _slot_data.has("shuffle_paintings"): |
319 | _painting_shuffle = _slot_data["shuffle_paintings"] | 326 | _painting_shuffle = _slot_data["shuffle_paintings"] |
320 | if _slot_data.has("shuffle_panels"): | 327 | if _slot_data.has("shuffle_panels"): |
@@ -831,3 +838,17 @@ func colorForItemType(flags): | |||
831 | return "#d63a22" | 838 | return "#d63a22" |
832 | else: # filler | 839 | else: # filler |
833 | return "#14de9e" | 840 | return "#14de9e" |
841 | |||
842 | |||
843 | func compareVersion(lhs, rhs): | ||
844 | if lhs["major"] == rhs["major"]: | ||
845 | if lhs["minor"] == rhs["minor"]: | ||
846 | return lhs["build"] < rhs["build"] | ||
847 | else: | ||
848 | return lhs["minor"] < rhs["minor"] | ||
849 | else: | ||
850 | return lhs["major"] < rhs["major"] | ||
851 | |||
852 | |||
853 | func wasGeneratedBeforeVersion(rhs): | ||
854 | return compareVersion(_gen_version, rhs) | ||