Open cyn0x8 opened 5 months ago
If it's anything of use I found out StructureUtil was originally used in the SaveDataMigrator, but now it's been replaced by thx.Objects and uses its deepCombine function. I wonder if that could be used as a replacement for mods too.
Note: I'm in no way versed in FNF modding lol
If it's anything of use I found out StructureUtil was originally used in the SaveDataMigrator, but now it's been replaced by thx.Objects and uses its deepCombine function. I wonder if that could be used as a replacement for mods too.
Note: I'm in no way versed in FNF modding lol
this works!! i was able to get it working with thx.Objects
and thx.Types
// in utils hxc
public function obj_merge(a:Dynamic, b:Dynamic, exclusive:Bool = false):Dynamic {
var ret:Dynamic = Objects.clone(a);
for (path in obj_paths(exclusive ? a : b)) {
Objects.setPath(ret, path, Objects.getPath(b, path));
}
return ret;
}
public function obj_paths(obj:Dynamic):Array<String> {
var ret:Array<String> = [];
for (key in Objects.fields(obj)) {
ret.push(key);
var val:Dynamic = Objects.getPath(obj, key);
if (Types.isAnonymousObject(val)) {
for (sub_key in obj_paths(val)) {
ret.push(key + "." + sub_key);
}
}
}
return ret;
}
// in save hxc
save_data = ModuleHandler.getModule("SEVENTEEN_Util").scriptCall("obj_merge", [save_data, Save.instance.modOptions.get("17bucks"), clean_save]);
thoughhhh this essentially is doing what Reflect
would be doing... i hope these classes dont get blacklisted either lol
Please check for duplicates or similar issues before creating this issue.
What is your suggestion, and why should it be implemented?
StructureUtil
was removed in the latest release, leaving no easy way to dynamically merge/deep-merge structures (iircReflect
is blacklisted in hxc)i was using it for backwards-compatible save data for a mod im working on... re-implementing this class would be extremely helpful so i dont have to null check a ton of variables lol
or, if anyone knows an alternative, please reply with it !!