-
Notifications
You must be signed in to change notification settings - Fork 2.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Enhancement: re-implement StructureUtil #2716
Comments
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 // 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 |
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 !!
The text was updated successfully, but these errors were encountered: