Skip to content

Conversation

@KANAjetzt
Copy link
Owner

No description provided.

@KANAjetzt KANAjetzt merged commit ef7e0b7 into feat_export_plugin Oct 2, 2024
1 check passed
@KANAjetzt KANAjetzt deleted the feat_hook_loading_and_creation branch October 2, 2024 10:49
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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants