Skip to content

Conversation

@serprex
Copy link
Contributor

@serprex serprex commented Apr 8, 2025

Reviving #4368 & #4369

Build Artifacts

@serprex serprex force-pushed the faster-bottle-and-bean-skulls branch from eccd7d3 to 66c144e Compare April 8, 2025 16:44
Copy link
Contributor

@Pepper0ni Pepper0ni left a comment

Choose a reason for hiding this comment

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

It might be worth mention it only applies to bugs/fish/blue fire on the tooltip, but I wouldn't block over it

@leggettc18
Copy link
Contributor

The changes work well, but I think this should be converted to the ShipInit pattern. What that basically means for you is that instead of the hooks always being registered and having an early return, ShipInit will register/unregister the hooks whenever the corresponding CVars change. I think there's a few examples in the codebase already, my Custom Message Hooks branch has several more examples.

@leggettc18
Copy link
Contributor

Best Example I can see is Assignable Tunics and Boots. AssignableTunicsAndBoots.cpp has a call to RegisterShipInitFunc at the bottom, which calls RegisterAssignableTunicsAndBoots whenever CVAR_TUNICBOOTS_NAME changes (defined earlier in the file as CVAR_ENHANCEMENT("AssignableTunicsAndBoots") earlier in the file), which uses COND_VB_SHOULD to register or unregister the hook according to the value of the CVar. Then, in the body of the hook, you can already assume the setting is turned on which simplifies that logic. And then you don't need the calls in TimeSavers_Register.

The pattern you're currently using is the older one from before ShipInit existed, and those should probably all be converted to ShipInit over time.

@leggettc18
Copy link
Contributor

If any of that is confusing or if you need help let me know, I can help you get it converted over.

@serprex
Copy link
Contributor Author

serprex commented Apr 16, 2025

It's clear, I've dealt with shipinit quite a bit already

@serprex serprex force-pushed the faster-bottle-and-bean-skulls branch 2 times, most recently from 4dd03e9 to 324a96f Compare April 17, 2025 02:56
@serprex
Copy link
Contributor Author

serprex commented Apr 17, 2025

The pattern you're currently using is the older one from before ShipInit existed, and those should probably all be converted to ShipInit over time.

Why wait? #5416

@serprex serprex force-pushed the faster-bottle-and-bean-skulls branch from 324a96f to 5cf87b7 Compare April 17, 2025 04:32
@serprex serprex force-pushed the faster-bottle-and-bean-skulls branch from 5cf87b7 to 4bcafa6 Compare April 17, 2025 15:09
@Malkierian
Copy link
Contributor

I'd like to request one thing before merging this, that being something leggett mentioned in another PR: more specific initFunc names. I think it would be good to get in the habit of just having their names reference their purpose as, even though they're static so they're locally-scoped, they're not namespace-locked, and I'd just rather avoid a bunch of same-name functions throughout the ShipInit addons.

Copy link
Contributor Author

@serprex serprex left a comment

Choose a reason for hiding this comment

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

unique init func names

@serprex serprex force-pushed the faster-bottle-and-bean-skulls branch from fc476af to f03bc01 Compare May 11, 2025 16:02
@Malkierian Malkierian merged commit eb95f90 into HarbourMasters:develop May 13, 2025
6 checks passed
krazyjakee pushed a commit to krazyjakee/OOT that referenced this pull request Sep 6, 2025
* Faster empty bottle, faster bean skulltula

* shipinit
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.

4 participants