-
Notifications
You must be signed in to change notification settings - Fork 16
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
PRE_X_STATUS_APPLY & POST_X_STATUS_APPLY #571
Conversation
Hi, I apologize for the delay in this being reviewed We'd like to pitch a potential approach for folding all of this into one pair of callbacks,
While this does make the type/purpose of the extra params ambiguous and dependent on the status, this does provide some benefits:
I don't believe that doing something like this would require an absurd amount of changes to the PR, hopefully at least. Most of the C++ side handling should be the same, they just all go through the same callbacks. Though type checking would either need to be done C++ side, or via a custom callback handling function in main_ex.lua (if we ever wanted to make it so that returning in this callback still additively runs the callbacks of other mods after it, would maybe need to be the latter) In any case this is all based on a conversation I had with some other devs, and our opinions. What do you think? |
Hi. I do mostly agree and I probably will merge the callbacks into just 2 some time later, though I probably won't try making |
Don't worry about the strings thing - I dont think you would really need to do anything in particular to allow that to work anyway. In the hypothetical I mentioned the callback would be running entirely lua-side. But yeah its also not remotely a needed feature, just a neat thought. So yeah, dont worry about that bit. Glad you generally agree with the suggestion! |
yea, just use an enum, if we ever decide to add support for custom effects and whatnot we can just give them an id, like it works for other things. |
Folded all callbacks and added manual type checking and additive running for the 2 callbacks. |
Oh, wait, are changes to documentation regarding future additions meant to go in a different branch? |
Ye, the documentation shouldnt be pushed straight to main, was going to say, otherwise it will instantly show up on the docs and people wont be able to use it yet and be confused. |
NOW I think it's done. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You might find having changelog.txt in PRs can get annoying since it is a common case for merge conflicts
But it's up to you, if you dont mind fixing the merge conflict you can leave it in and keep it updated. The alternative would be to edit the changelog afterwards
Resolved requested changes. |
Should probably mention that I resolved requested changes? Unsure how GitHub notifications work. |
Yes I have seen all of these notifications, I have just not had time to review this today. I apologize but please be patient. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me, thank you for making the changes to unify these into a single callback, I'm happy with how this works now, good work.
Sorry for the delay and any headaches with the typechecking - the typechecks and the setup for errors/warnings have been due for a bit of a refactor, but that'll be for another day.
I will merge in this tomorrow if there are no other comments, thanks again!
Resolves #549 by adding 32 callbacks, 2 for each of the following status effects: Bait, Bleed, Brimstone Mark, Burn, Charm, Confusion, Fear, Freeze, Knockback, Magnetize, Midas Freeze, Petrification, Poison, Shrink, Slow, Weakness.
MC_PRE_BURN_STATUS_APPLY
andMC_PRE_POISON_STATUS_APPLY
let you return a table with the following entries:{ int duration, number damage }
.MC_PRE_KNOCKBACK_STATUS_APPLY
lets you return a table with the following entries:{ int duration, Vector pushDirection, boolean takeImpactDamage }
.MC_PRE_SLOWING_STATUS_APPLY
lets you return a table with the following entries:{ int duration, number slowValue, Color slowColor }
.MC_PRE_CONFUSION_STATUS_APPLY
lets you return a table with the following entries:{ int duration, boolean ignoreBosses }
.The 5 mentioned callbacks, as well as all of the other
PRE_X_STATUS_APPLY
callbacks, also let you return either aninteger
to change duration, or aboolean
to cancel the effect. Additionally, you can set anEntityType
as the optional argument.All of the
PRE_X_STATUS_APPLY
andPOST_X_STATUS_APPLY
callbacks have parameters that match the status effect function signatures.