Skip to content

Allow other scripts to add configs at runtime#6

Open
zapSNH wants to merge 1 commit intoUltraJohn:masterfrom
zapSNH:master
Open

Allow other scripts to add configs at runtime#6
zapSNH wants to merge 1 commit intoUltraJohn:masterfrom
zapSNH:master

Conversation

@zapSNH
Copy link
Contributor

@zapSNH zapSNH commented Jul 19, 2024

Allows other scripts to add HUDReplacer configs at runtime by:

  1. Adding a ConfigNode to additionalConfigNodes or additionalRecolorNodes
  2. Calling GetTextures and ReplaceTextures (if replacing textures) or LoadHUDColors (if recoloring)

@UltraJohn
Copy link
Owner

Very interesting, I will take a proper look at it later this weekend when I have some time, and see if I can push out an update. Have you tested this already?

So if I understand this correctly, the idea is to add the two static variables (additionalConfigNodes, additionalRecolorNodes), that allows other mods to add ConfigNodes to these, and then either reload the scene or call GetTextures to reset?

There is a few small changes I want to make as well, but overall this seems pretty good. Thank you.

@UltraJohn
Copy link
Owner

Also, would it be better to just add this GUI to HUDReplacer by default, or do you see other applications where this might be worthwhile as external mods?

@zapSNH
Copy link
Contributor Author

zapSNH commented Jul 20, 2024

Have you tested this already?

Yes, you can take a look here for a GUI example.

So if I understand this correctly, the idea is to add the two static variables (additionalConfigNodes, additionalRecolorNodes), that allows other mods to add ConfigNodes to these, and then either reload the scene or call GetTextures to reset?

Pretty much.
I have noticed some problems while testing this though.

  1. Recoloring only applies on scene reload due to how the harmony patches are implemented.
  2. I can't seem to get the cursor to change live even after scene reload.

Also, would it be better to just add this GUI to HUDReplacer by default, or do you see other applications where this might be worthwhile as external mods?

If you want you could adapt the code from the example for a more general version of the GUI.
The way that I've implemented the GUI allows configs to have multiple nodes to enable which looks like this.

It'd be probably better for external mods to be able to add ConfigNodes at runtime just in case the mods' would detect a theme that would break a part of the mods' GUI.

--

On second thought why not add also the UI Transformer and Adaptive navball to HUDReplacer?

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