From a2138459de0ef60fa446be9b70310b11aaf78610 Mon Sep 17 00:00:00 2001 From: Star Rauchenberger Date: Tue, 22 Aug 2023 12:20:28 -0400 Subject: Only necessary checks are sent out now i.e. the checks for every individual panel are not sent out if you are not playing panelsanity. --- Archipelago/client.gd | 16 ++++++++++++++++ Archipelago/load.gd | 1 + Archipelago/location.gd | 4 +++- util/generate_gamedata.rb | 27 ++++++++++++++++++++++++++- 4 files changed, 46 insertions(+), 2 deletions(-) diff --git a/Archipelago/client.gd b/Archipelago/client.gd index ad37ef0..17c6063 100644 --- a/Archipelago/client.gd +++ b/Archipelago/client.gd @@ -48,6 +48,14 @@ const kLEVEL_2 = 2 const kNO_PANEL_SHUFFLE = 0 const kREARRANGE_PANELS = 1 +const kCLASSIFICATION_LOCAL_NORMAL = 1 +const kCLASSIFICATION_LOCAL_REDUCED = 2 +const kCLASSIFICATION_LOCAL_INSANITY = 4 + +const kCLASSIFICATION_REMOTE_NORMAL = 0 +const kCLASSIFICATION_REMOTE_REDUCED = 1 +const kCLASSIFICATION_REMOTE_INSANITY = 2 + var _client = WebSocketClient.new() var _should_process = false var _initiated_disconnect = false @@ -83,6 +91,7 @@ var _panel_shuffle = 0 # none, rearrange var _painting_shuffle = false var _mastery_achievements = 21 var _level_2_requirement = 223 +var _location_classification_bit = 0 var _slot_seed = 0 var _map_loaded = false @@ -248,6 +257,13 @@ func _on_data(): _mastery_achievements = _slot_data["mastery_achievements"] if _slot_data.has("level_2_requirement"): _level_2_requirement = _slot_data["level_2_requirement"] + if _slot_data.has("location_checks"): + if _slot_data["location_checks"] == kCLASSIFICATION_REMOTE_NORMAL: + _location_classification_bit = kCLASSIFICATION_LOCAL_NORMAL + elif _slot_data["location_checks"] == kCLASSIFICATION_REMOTE_REDUCED: + _location_classification_bit = kCLASSIFICATION_LOCAL_REDUCED + elif _slot_data["location_checks"] == kCLASSIFICATION_REMOTE_INSANITY: + _location_classification_bit = kCLASSIFICATION_LOCAL_INSANITY _puzzle_skips = 0 diff --git a/Archipelago/load.gd b/Archipelago/load.gd index 33a5846..876910b 100644 --- a/Archipelago/load.gd +++ b/Archipelago/load.gd @@ -118,6 +118,7 @@ func _load(): var location = location_script.new() location.ap_id = int(apclient._location_name_to_id[location_id]) location.name = "AP_location_%d" % location.ap_id + location.classification = gamedata.classification_by_location_id[location_id] self.add_child(location) var panels = gamedata.panel_ids_by_location_id[location_id] diff --git a/Archipelago/location.gd b/Archipelago/location.gd index b85b5c4..7e76427 100644 --- a/Archipelago/location.gd +++ b/Archipelago/location.gd @@ -4,6 +4,7 @@ var ap_name = "" var ap_id = 0 var total = 0 var solved = 0 +var classification = 0 var ran = false @@ -14,4 +15,5 @@ func handle_correct(): ran = true var apclient = global.get_node("Archipelago") - apclient.sendLocation(ap_id) + if classification & apclient._location_classification_bit: + apclient.sendLocation(ap_id) diff --git a/util/generate_gamedata.rb b/util/generate_gamedata.rb index bf8e3ae..72f0932 100644 --- a/util/generate_gamedata.rb +++ b/util/generate_gamedata.rb @@ -4,6 +4,10 @@ require 'yaml' configpath = ARGV[0] outputpath = ARGV[1] +CLASSIFICATION_NORMAL = 1 +CLASSIFICATION_REDUCED = 2 +CLASSIFICATION_INSANITY = 4 + panel_to_id = {} door_groups = {} @@ -11,6 +15,7 @@ panel_output = [] door_ids_by_item_id = {} painting_ids_by_item_id = {} panel_ids_by_location_id = {} +classification_by_location_id = {} mentioned_doors = Set[] mentioned_paintings = Set[] painting_output = {} @@ -54,8 +59,17 @@ config.each do |room_name, room_data| end panel_output << ret + panel_ids_by_location_id[full_name] = [panel["id"]] + + classification_by_location_id[full_name] ||= 0 + classification_by_location_id[full_name] += CLASSIFICATION_INSANITY + if panel.include? "check" and panel["check"] - panel_ids_by_location_id[full_name] = [panel["id"]] + classification_by_location_id[full_name] += CLASSIFICATION_NORMAL + + unless panel.include? "exclude_reduce" and panel["exclude_reduce"] + classification_by_location_id[full_name] += CLASSIFICATION_REDUCED + end end end end @@ -105,6 +119,13 @@ config.each do |room_name, room_data| end panel_to_id[other_name] end + + classification_by_location_id[chosen_name] ||= 0 + classification_by_location_id[chosen_name] += CLASSIFICATION_NORMAL + + if door.include? "include_reduce" and door["include_reduce"] + classification_by_location_id[chosen_name] += CLASSIFICATION_REDUCED + end end if not (door.include? "skip_item" and door["skip_item"]) and @@ -189,5 +210,9 @@ File.open(outputpath, "w") do |f| f.write(painting_output.map do |painting_id, painting| "\"#{painting_id}\":{\"orientation\":\"#{painting["orientation"]}\",\"move\":#{painting.include? "move" and painting["move"]}}" end.join(",")) + f.write "}\nvar classification_by_location_id = {" + f.write(classification_by_location_id.map do |location_id, classification| + "\"#{location_id}\":#{classification}" + end.join(",")) f.write "}" end -- cgit 1.4.1