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

EventCallback Improvements, Oops is now called Event #4395

Merged
merged 6 commits into from
Apr 16, 2024

Conversation

MillhioreBT
Copy link
Contributor

@MillhioreBT MillhioreBT commented Apr 8, 2023

Pull Request Prelude

  • I have followed [proper The Forgotten Server code styling][code].
  • I have read and understood the [contribution guidelines][cont] before making this PR.
  • I am aware that this PR may be closed if the above-mentioned criteria are not fulfilled.

Changes Proposed

Finally a better name for this system, or rather, this should have always been the name, since we're really dealing with Events, and Events are already callbacks.

Here the optimization of PR #4237 is maintained, which by the way the idea of ​​maintaining a local was horrible hahahaha

A new global table (hasEvent) was added that functions as a proxy with a metatable with the metamethod __index to check if the events exist, thus maintaining the logic of not creating global IDs for each event.

The Events are now created from making a call to Event

local event = Event()

these objects can still be reused as before with the global EventCallback table

There is no compatibility with the older EventCallback, yes or yes you have to rename Event and call it to get the object.
Whoever wants to make the changes here is an example:

local ec = EventCallback
-- To
local event = Event()

Notes:

  • Overall this PR makes EventCallback now feel more natural and consistent with Revscript.
  • I don't know if others will, but I plan to update all the scripts that I have published in OTLand to be compatible with these changes.

Issues addressed: Nothing!

@EPuncker EPuncker added the enhancement Increase or improvement in quality, value, or extent label Apr 9, 2023
@MillhioreBT
Copy link
Contributor Author

I have added a Global variable with the above name, for backwards compatibility.
now there is no need to change anything, your scripts will continue to work as usual, however it is recommended to create the new events with the new base

EPuncker
EPuncker previously approved these changes Apr 13, 2023
EPuncker
EPuncker previously approved these changes Apr 19, 2023
Copy link
Contributor

@EPuncker EPuncker left a comment

Choose a reason for hiding this comment

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

It's cool for me, I would like to wait for @ranisalt opinion on this as well

EPuncker
EPuncker previously approved these changes Jan 12, 2024
@MillhioreBT MillhioreBT merged commit 2cdf1de into otland:master Apr 16, 2024
22 checks passed
@reyaleman reyaleman mentioned this pull request May 28, 2024
3 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Increase or improvement in quality, value, or extent
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants