diff options
Diffstat (limited to 'apworld/client/manager.gd')
-rw-r--r-- | apworld/client/manager.gd | 16 |
1 files changed, 16 insertions, 0 deletions
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 | |||
75 | var strict_purple_ending = false | 75 | var strict_purple_ending = false |
76 | var victory_condition = -1 | 76 | var victory_condition = -1 |
77 | 77 | ||
78 | var color_by_material_path = {} | ||
79 | |||
78 | signal could_not_connect | 80 | signal could_not_connect |
79 | signal connect_status | 81 | signal connect_status |
80 | signal ap_connected | 82 | signal ap_connected |
@@ -112,6 +114,20 @@ func _init(): | |||
112 | if data.size() > 6: | 114 | if data.size() > 6: |
113 | show_minimap = data[6] | 115 | show_minimap = data[6] |
114 | 116 | ||
117 | # We need to create a mapping from material paths to the original colors of | ||
118 | # those materials. We force reload the materials, overwriting any custom | ||
119 | # textures, and create the mapping. We then reload the textures in case the | ||
120 | # player had a custom one enabled. | ||
121 | var directory = DirAccess.open("res://assets/materials") | ||
122 | for material_name in directory.get_files(): | ||
123 | var material = ResourceLoader.load( | ||
124 | "res://assets/materials/" + material_name, "", ResourceLoader.CACHE_MODE_REPLACE | ||
125 | ) | ||
126 | |||
127 | color_by_material_path[material.resource_path] = Color(material.albedo_color) | ||
128 | |||
129 | settings.load_user_textures() | ||
130 | |||
115 | 131 | ||
116 | func _ready(): | 132 | func _ready(): |
117 | client = SCRIPT_client.new() | 133 | client = SCRIPT_client.new() |