Skip to content
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

feat: ✨ param and return manipulation for mod hooks #436

Merged
merged 21 commits into from
Nov 23, 2024
Merged

Conversation

Qubus0
Copy link
Collaborator

@Qubus0 Qubus0 commented Nov 16, 2024

allows modders to manipulate parameters and return values similarly to how script extensions work.
also docs

test project with unpacked mod: project.zip

@Qubus0 Qubus0 added enhancement New feature or request 4.x labels Nov 16, 2024
@Qubus0 Qubus0 self-assigned this Nov 16, 2024
@KANAjetzt KANAjetzt changed the title Better hooks Better hooksfeat: ✨ param and return manipulation for mod hooks Nov 17, 2024
@KANAjetzt KANAjetzt changed the title Better hooksfeat: ✨ param and return manipulation for mod hooks feat: ✨ param and return manipulation for mod hooks Nov 17, 2024
@KANAjetzt KANAjetzt added this to the 4.x - 7.0.0 milestone Nov 17, 2024
Copy link
Member

@KANAjetzt KANAjetzt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested with the provided example project, in editor and as exported game.

Amazing work - thanks!

addons/mod_loader/api/hook.gd Outdated Show resolved Hide resolved
addons/mod_loader/api/hook.gd Outdated Show resolved Hide resolved
addons/mod_loader/api/mod.gd Outdated Show resolved Hide resolved
addons/mod_loader/internal/hooks.gd Outdated Show resolved Hide resolved
addons/mod_loader/internal/hooks.gd Outdated Show resolved Hide resolved
addons/mod_loader/internal/hooks.gd Outdated Show resolved Hide resolved
addons/mod_loader/internal/hooks.gd Outdated Show resolved Hide resolved
Co-authored-by: Alexejhero <[email protected]>
@Alexejhero
Copy link

Are there any plans to support hooking into coroutine methods and/or having our own hooks be coroutines by awaiting execute_next?

@Qubus0
Copy link
Collaborator Author

Qubus0 commented Nov 20, 2024

good point, i have a feeling we might currently be breaking every method that is called with await.. issue being that these methods aren't marked as async in any way so they are hard to detect with the preprocessor.
at least we can prevent breaking a whole file when we implement

Copy link
Member

@KANAjetzt KANAjetzt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested the provided example project in-editor and exported. Looks good 👍

addons/mod_loader/api/hook_chain.gd Outdated Show resolved Hide resolved
addons/mod_loader/api/hook_chain.gd Outdated Show resolved Hide resolved
addons/mod_loader/api/hook_chain.gd Outdated Show resolved Hide resolved
addons/mod_loader/api/hook_chain.gd Show resolved Hide resolved
@Qubus0 Qubus0 merged commit acaeefc into 4.x Nov 23, 2024
2 checks passed
@Qubus0 Qubus0 deleted the better-hooks branch November 23, 2024 10:17
@KANAjetzt KANAjetzt restored the better-hooks branch November 24, 2024 09:50
KANAjetzt added a commit to KANAjetzt/godot-mod-loader that referenced this pull request Nov 24, 2024
docs: ✏️ added comment about untyped `callbacks` array

commit a156ef4
Merge: baccb9c 2bda113
Author: Kai <[email protected]>
Date:   Fri Nov 22 22:40:55 2024 +0100

    Merge branch 'better-hooks' of https://github.com/GodotModding/godot-mod-loader into better-hooks

commit 2bda113
Author: Qubus0 <[email protected]>
Date:   Fri Nov 22 14:55:03 2024 +0100

    better static types

commit baccb9c
Author: steen <[email protected]>
Date:   Tue Nov 19 19:14:49 2024 +0100

    fix static type

    Co-authored-by: Alexejhero <[email protected]>

commit afc9c3a
Author: Qubus0 <[email protected]>
Date:   Tue Nov 19 14:53:31 2024 +0100

    typo protection

commit 28e53fa
Merge: d91a41f fc418e7
Author: Qubus0 <[email protected]>
Date:   Tue Nov 19 11:27:52 2024 +0100

    Merge branch 'refs/heads/better-hooks' into feat-install-hooks-from-file

commit fc418e7
Author: Qubus0 <[email protected]>
Date:   Mon Nov 18 22:56:04 2024 +0100

    slightly more safety

commit 62120ae
Author: Qubus0 <[email protected]>
Date:   Mon Nov 18 22:34:31 2024 +0100

    pr cleanup

commit ef53739
Author: Luca Martinelli <[email protected]>
Date:   Mon Nov 18 21:57:21 2024 +0100

    removed recursion from hook call sequence

commit d91a41f
Author: Qubus0 <[email protected]>
Date:   Mon Nov 18 01:59:58 2024 +0100

    feat: :sparkles: allow installing hooks from a file like extensions

commit bcd48ce
Merge: 1f4af55 766ee3e
Author: Qubus0 <[email protected]>
Date:   Mon Nov 18 01:57:41 2024 +0100

    Merge branch 'refs/heads/4.x' into better-hooks

commit 1f4af55
Author: Qubus0 <[email protected]>
Date:   Mon Nov 18 01:55:45 2024 +0100

    docs fix

commit 2d1c15a
Author: Qubus0 <[email protected]>
Date:   Mon Nov 18 00:14:51 2024 +0100

    refactor old names and better docs

commit 60161a1
Author: Qubus0 <[email protected]>
Date:   Mon Nov 18 00:14:14 2024 +0100

    fix call order

commit 9a94748
Author: Qubus0 <[email protected]>
Date:   Sun Nov 17 17:30:28 2024 +0100

    fix tutorial links

commit 6758031
Author: Qubus0 <[email protected]>
Date:   Sun Nov 17 17:24:12 2024 +0100

    better docs

commit d79d754
Author: Qubus0 <[email protected]>
Date:   Sun Nov 17 16:26:15 2024 +0100

    reaname linkage and better user docs

commit f6e016a
Author: Qubus0 <[email protected]>
Date:   Sat Nov 16 15:37:57 2024 +0100

    feat: :sparkles: param and return manipulation for mod hooks

commit eac9c84
Author: Qubus0 <[email protected]>
Date:   Sat Nov 16 04:37:12 2024 +0100

    feat: :sparkles: param and return manipulation for mod hooks

commit 346cd9e
Merge: 5797c05 6380e79
Author: Qubus0 <[email protected]>
Date:   Sat Nov 16 01:10:33 2024 +0100

    Merge branch 'refs/heads/4.x' into better-hooks

commit 5797c05
Author: Qubus0 <[email protected]>
Date:   Fri Nov 15 16:05:47 2024 +0100

    fix: hooks argument order
KANAjetzt added a commit to KANAjetzt/godot-mod-tools that referenced this pull request Nov 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
4.x enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants