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

Add API for mods to interact with other mods' preloads #147

Draft
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

flibber-hk
Copy link
Contributor

@flibber-hk flibber-hk commented May 13, 2023

TL;DR: This is the cleanest way to fix what is ostensibly a bug in Custom Knight.

The rationale for this PR is as follows. Custom Knight has a feature where objects not associated with the knight can get skinned - for example, a skin might want to replace all copies of a grub with a custom sprite.

For base game items, the way this works is that the skin author declares that hash 568482B2D16BF50AE18B394EC15B290048B75DCD is associated with the grub skin, and then CustomKnight looks up in a precomputed lookup here which scenes/objects need to be skinned.

Obviously this approach doesn't work if another mod has preloaded and instantiated grubs, because they won't be found in any of the listed scenes/paths.

The best approach we could come up with was for Custom Knight to add a component to preloaded objects to indicate where they originally came from, so for example if a mod preloaded a grub like this then the data could be added as a component on the preloaded object to indicate the source of the preload (or similar). This method is added as an alternative to CK having to IL-Hook internal MAPI methods in the mod constructor.


Note - the new API is added as a virtual method rather than an event because the event would have to be subscribed before mod.Initialize, which is not ideal.

ETA: This approach does feel a bit awkward and I'd be much happier with an approach that didn't involve adding a niche function to the mod class.

@flibber-hk flibber-hk marked this pull request as draft May 13, 2023 17:23
@BadMagic100
Copy link
Contributor

BadMagic100 commented May 14, 2023

A feature request that is hell bent on making it CKs responsibility to skin another mods' content.

is pretty unnecessarily aggressive and not really based in fact - the folks who believe this is a CK issue (myself includes) are not asserting that CK should be skinning all other mods' content by default, we are asserting that CK should be skinning all vanilla game sprites, without respect to what/where the GameObject is or who created it.

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