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

Events for Actions #1296

Merged
merged 16 commits into from
Dec 7, 2023
Merged

Conversation

TheDrOfDoctoring
Copy link
Contributor

This adds 4 new events to the action system to allow for some degree of modification of existing actions. These actions are ActionActivatedEvent, ActionDeactivatedEvent, ActionUpdateEvent and PreActionActivatedEvent.

PreActionActivatedEvent allows an action to be cancelled before it is activated.

ActionActivatedEvent allows the cooldown of an action to be changed, as well as the duration for lasting actions.

ActionDeactivatedEvent allows for the cooldown of an action to be changed before it is deactivated.

ActionUpdateEvent allows is fired for every action update, but does not allow for any part of the action to be changed.

Additionally, lasting actions that add potion effects (such as sunscreen or rage) have been moved to applying the effect every 20 ticks under onUpdate. Previously, the potion effects were only added once when first activated. The regeneration vampire action also has been moved to a lasting action due to all the other similar actions being lasting actions already.

@TheDrOfDoctoring TheDrOfDoctoring changed the title Actions for Events Events for Actions Dec 6, 2023
Copy link
Member

@Cheaterpaul Cheaterpaul left a comment

Choose a reason for hiding this comment

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

Very nice 🎉🎉. That's about what i thought for such action events

I haven't tested it yet, but there where some minor issues with the implementation and some regarding the design. A lot of requested changed but mainly the following:

  1. PreActionActivatedEvent
    To me there is no point in having two event that are called for activating an action if they can be rearranged and merged into one.
  2. UpdateEvent
    I have no problem with this if it is only about deactivating the action prematurely. But it might be worth to invest more time on the event to make it more powerful.

@Cheaterpaul Cheaterpaul merged commit 82f595c into TeamLapen:1.20 Dec 7, 2023
1 check passed
@Cheaterpaul
Copy link
Member

🎉🎉

@TheDrOfDoctoring TheDrOfDoctoring deleted the 1.20-action_event branch December 8, 2023 06:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

2 participants