File tree Expand file tree Collapse file tree 1 file changed +17
-2
lines changed
addons/mod_loader/internal Expand file tree Collapse file tree 1 file changed +17
-2
lines changed Original file line number Diff line number Diff line change @@ -45,10 +45,10 @@ class InheritanceSorting:
45
45
return a_stack [index ] < b_stack [index ]
46
46
last_index = index
47
47
48
- if last_index < b_stack .size ():
48
+ if last_index < b_stack .size () - 1 :
49
49
return true
50
50
51
- return extension_a < extension_b
51
+ return compare_mods_order ( extension_a , extension_b )
52
52
53
53
# Returns a list of scripts representing all the ancestors of the extension
54
54
# script with the most recent ancestor last.
@@ -68,6 +68,21 @@ class InheritanceSorting:
68
68
69
69
stack_cache [extension_path ] = stack
70
70
return stack
71
+
72
+ # Secondary comparator function for resolving scripts extending the same vanilla script
73
+ # Will return whether a comes before b in the load order
74
+ func compare_mods_order (extension_a :String , extension_b :String )-> bool :
75
+ var mod_a_id = extension_a .trim_prefix (_ModLoaderPath .get_unpacked_mods_dir_path ()).get_slice ("/" , 0 )
76
+ var mod_b_id = extension_b .trim_prefix (_ModLoaderPath .get_unpacked_mods_dir_path ()).get_slice ("/" , 0 )
77
+
78
+ for mod in ModLoaderStore .mod_load_order :
79
+ if mod .dir_name == mod_a_id :
80
+ return true
81
+ elif mod .dir_name == mod_b_id :
82
+ return false
83
+
84
+ # Should never happen
85
+ return extension_a < extension_b
71
86
72
87
73
88
static func apply_extension (extension_path : String ) -> Script :
You can’t perform that action at this time.
0 commit comments