From 1ea81f593eda16e9ae93731041a9b7c7f77f8d8b Mon Sep 17 00:00:00 2001 From: Star Rauchenberger Date: Tue, 7 Oct 2025 18:24:54 -0400 Subject: Fix minimap colors when using a texture pack --- apworld/client/manager.gd | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'apworld/client/manager.gd') diff --git a/apworld/client/manager.gd b/apworld/client/manager.gd index 4f5018f..dac09b2 100644 --- a/apworld/client/manager.gd +++ b/apworld/client/manager.gd @@ -75,6 +75,8 @@ var strict_cyan_ending = false var strict_purple_ending = false var victory_condition = -1 +var color_by_material_path = {} + signal could_not_connect signal connect_status signal ap_connected @@ -112,6 +114,20 @@ func _init(): if data.size() > 6: show_minimap = data[6] + # We need to create a mapping from material paths to the original colors of + # those materials. We force reload the materials, overwriting any custom + # textures, and create the mapping. We then reload the textures in case the + # player had a custom one enabled. + var directory = DirAccess.open("res://assets/materials") + for material_name in directory.get_files(): + var material = ResourceLoader.load( + "res://assets/materials/" + material_name, "", ResourceLoader.CACHE_MODE_REPLACE + ) + + color_by_material_path[material.resource_path] = Color(material.albedo_color) + + settings.load_user_textures() + func _ready(): client = SCRIPT_client.new() -- cgit 1.4.1