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

Socket framework proof of concept #4849

Open
wants to merge 3 commits into
base: 4.2.x
Choose a base branch
from

Conversation

krbz999
Copy link
Contributor

@krbz999 krbz999 commented Dec 8, 2024

Added a new class, Sockets5e, available in game.dnd5e.sockets. It registers socket configurations, each with event, initiate, and finalize.

We can then call game.dnd5e.sockets.initiate(eventName, ...args), which initiates a specific function (using ...args), and then - if needed - emits to other clients.

The initiate method in the socket config is used to set up the data given a few parameters.

The finalize method in the socket config is calling the relevant function under the assumption that the user calling it is meant to do so.

This PR includes a sample setup with a "grantEffect" configuration, which allows a user to create an effect on an actor they may or may not be owner of.

Copy link
Collaborator

@arbron arbron left a comment

Choose a reason for hiding this comment

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

Sockets!

module/sockets.mjs Outdated Show resolved Hide resolved
module/sockets/grant-effect.mjs Show resolved Hide resolved
module/sockets/grant-effect.mjs Outdated Show resolved Hide resolved
module/sockets/grant-effect.mjs Outdated Show resolved Hide resolved
dnd5e.mjs Outdated Show resolved Hide resolved
@krbz999 krbz999 force-pushed the socket-framework branch 2 times, most recently from a0e7adf to 6a804f8 Compare December 9, 2024 22:02
@krbz999 krbz999 requested a review from arbron December 9, 2024 22:03
Copy link
Collaborator

@arbron arbron left a comment

Choose a reason for hiding this comment

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

We'll see what Kim thinks during the dnd meeting :)

module/sockets/socket-event.mjs Show resolved Hide resolved
module/sockets/socket-event.mjs Show resolved Hide resolved
module/sockets/grant-effect.mjs Outdated Show resolved Hide resolved
module/sockets/socket-event.mjs Outdated Show resolved Hide resolved
module/sockets/socket-event.mjs Show resolved Hide resolved
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants