Skip to content

New feature: Spire Method#198

Open
LinnielDW wants to merge 2 commits into
Alchyr:developfrom
LinnielDW:master
Open

New feature: Spire Method#198
LinnielDW wants to merge 2 commits into
Alchyr:developfrom
LinnielDW:master

Conversation

@LinnielDW
Copy link
Copy Markdown
Contributor

Spiremethods, inspired by spirefields are a mechanism for 'adding' methods to models that do not override a method existing in their super.
The benefit of doing it this way over harmony patching and doing a model is type check is that across many mods, this may have a performance impact. By centralizing it in a central registry, we can do a type check against a dictionary and retrieve all the appropriate delegate methods in constant time.

A few notes about the implementation:

  • SpireMethods are registered at game start but aren't patched until needed. This is just to reduce startup overhead. But if this isn't nice, I can remove it.
  • It supports, async methods, void methods and methods with a return type.
  • I wrote this myself, but for full disclosure: I did have an LLM review my code already and also had it write the comment documentation.

Example of a spiremethod as seen here:
image

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