forked from GodotModding/godot-mod-loader
-
Couldn't load subscription status.
- Fork 0
feat: 🚧 hook creation and loading #3
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
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
KANAjetzt
added a commit
that referenced
this pull request
Nov 5, 2024
* feat: 🚧 hook creation and loading * feat: ✨ hook creation and loading
KANAjetzt
added a commit
that referenced
this pull request
Nov 13, 2024
* feat: 🚧 first draft of the export plugin The plan is to automate the creation of hooks for each function in all GDScripts. * feat: 🚧 wip callable_stack * refactor: 🚧 rename vanilla functions Vanilla functions are renamed, and at the bottom of the script, mod loader hooks are generated. These hooks replace the vanilla functions and handle calls to the `callable_stack`. * feat: 🚧 added return with types to hook Currently, I'm stuck on this approach because the method list's return property does not contain any information if there is no return type defined for the method. * refactor: 🚧 reworked callable_sack funcs * refactor: 🚧 added return usage check That seems to work for filtering out methods that have a return. * refactor: 🚧 remove and add back class_name Without removing the `class_name` before initializing the script on export, I get this parse error: `hides a global script class`. With these code changes, I get `Value of type [script_path] cannot be assigned to a variable of type [class_name]` if there is a self-assignment somewhere in the script. * refactor: 🚧 No new script instance - load() the script 😶🌫️ Also added a check for static functions and currently working on recognizing inner classes. * refactor: 🚧 added `get_return_type_string` check the `type_hint` and add it if it's present. * refactor: 🚧 added `is_top_level_func` To check if the function has no space before `func` or `static`, used to ignore functions in inner classes. Later, we might want to figure out a way to include these. * fix: 🚧 corrected return type in generated methods Also removed extra comma in args list * feat: 🚧 only add modloader text to modified scripts until now all scripts received the "Mod Loader Hooks" header at the bottom even when no changes where made. * feat: 🚧 added optional @moddable requirement * feat: 🚧 added `is_setter` used to ignore setter funcs * feat: 🚧 improved runtime performance by pre-hashing dict-lookup Also refactored some of the function/field names to improved the modding experience * feat: 🚧 fixed issues with inheritance by adding class hash added getter method, made both static and moved getter/setter check to is_moddable check * cleaner getters and setters * feat: 🚧 added @not-moddable option to exclude methods improved performance by exiting early when nothing is hooked * refactor: ♻️ removed no longer used functions and a first style and type pass * refactor: 🚧 general code cleanup * 🚧 refactor: move methods * 🚧 refactor: extract methods * 🚧 feat: mod hook packing prototype * fix: 🚧 fix path to `mod_hook_preprocessor.gd` * 🚧 fix: typos * feat: 🚧 replace super calls * refactor: ♻️ remove static from regex vars * feat: 🚧 hook creation and loading (#3) * feat: 🚧 hook creation and loading * feat: ✨ hook creation and loading --------- Co-authored-by: Luca Martinelli <lucxmangajet@gmail.com> Co-authored-by: Qubus0 <steen.rickmer@gmx.de>
KANAjetzt
added a commit
that referenced
this pull request
Nov 13, 2024
* feat: 🚧 first draft of the export plugin The plan is to automate the creation of hooks for each function in all GDScripts. * feat: 🚧 wip callable_stack * refactor: 🚧 rename vanilla functions Vanilla functions are renamed, and at the bottom of the script, mod loader hooks are generated. These hooks replace the vanilla functions and handle calls to the `callable_stack`. * feat: 🚧 added return with types to hook Currently, I'm stuck on this approach because the method list's return property does not contain any information if there is no return type defined for the method. * refactor: 🚧 reworked callable_sack funcs * refactor: 🚧 added return usage check That seems to work for filtering out methods that have a return. * refactor: 🚧 remove and add back class_name Without removing the `class_name` before initializing the script on export, I get this parse error: `hides a global script class`. With these code changes, I get `Value of type [script_path] cannot be assigned to a variable of type [class_name]` if there is a self-assignment somewhere in the script. * refactor: 🚧 No new script instance - load() the script 😶🌫️ Also added a check for static functions and currently working on recognizing inner classes. * refactor: 🚧 added `get_return_type_string` check the `type_hint` and add it if it's present. * refactor: 🚧 added `is_top_level_func` To check if the function has no space before `func` or `static`, used to ignore functions in inner classes. Later, we might want to figure out a way to include these. * fix: 🚧 corrected return type in generated methods Also removed extra comma in args list * feat: 🚧 only add modloader text to modified scripts until now all scripts received the "Mod Loader Hooks" header at the bottom even when no changes where made. * feat: 🚧 added optional @moddable requirement * feat: 🚧 added `is_setter` used to ignore setter funcs * feat: 🚧 improved runtime performance by pre-hashing dict-lookup Also refactored some of the function/field names to improved the modding experience * feat: 🚧 fixed issues with inheritance by adding class hash added getter method, made both static and moved getter/setter check to is_moddable check * cleaner getters and setters * feat: 🚧 added @not-moddable option to exclude methods improved performance by exiting early when nothing is hooked * refactor: ♻️ removed no longer used functions and a first style and type pass * refactor: 🚧 general code cleanup * 🚧 refactor: move methods * 🚧 refactor: extract methods * 🚧 feat: mod hook packing prototype * fix: 🚧 fix path to `mod_hook_preprocessor.gd` * 🚧 fix: typos * feat: 🚧 WIP: replace `super()` * feat: 🚧 WIP: replace `super()` * feat: 🚧 replace `super()` first working draft * feat: 🚧 replace super calls * refactor: ♻️ remove static from regex vars * feat: 🚧 hook creation and loading (#3) * feat: 🚧 hook creation and loading * feat: ✨ hook creation and loading * feat: 🚧 read manifest from zip before loading the mod * feat: 🚧 read manifest from zip before loading the mod * feat: 🚧 read manifest from zip before loading the mod * feat: 🚧 read manifest from zip before loading the mod * fix: 🐛 fix typos * fix: 🐛 check overwrites in zip * fix: 🐛 type inference * feat: 🚧 hooks * docs: 📝 better doc comments for ml options * fix: 🐛 mac exe path * refactor: ♻️ move hook methods to new file * fix: 🐛 wrong hook location on mac * refactor: ♻️ move hook methods to new file * fix: 🐛 use callv for hooks * fix: 🐛 fix self reference error from 4.2 * fix: 🐛 getter for steam id * feat: ✨ improved restart notification * fix: merge duplication * Update addons/mod_loader/api/profile.gd Co-authored-by: KANAjetzt <41547570+KANAjetzt@users.noreply.github.com> * fix: rename zip_file_exists * docs: minimal hooks documentation * fix: typo * fix: review changes --------- Co-authored-by: Kai <kai@kana.jetzt> Co-authored-by: Luca Martinelli <lucxmangajet@gmail.com> Co-authored-by: KANAjetzt <41547570+KANAjetzt@users.noreply.github.com>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
No description provided.