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

Show image to specific players #17

Open
lucasmiranda2711 opened this issue Jan 19, 2022 · 1 comment
Open

Show image to specific players #17

lucasmiranda2711 opened this issue Jan 19, 2022 · 1 comment

Comments

@lucasmiranda2711
Copy link

I'm wondering if it's possible to show image only to specific players when using the command "Show to players", I see you're using the socket.emit function to show to all players,I don't know how socket.io works, but I think it would be an awesome feature.

@lucasmiranda2711
Copy link
Author

lucasmiranda2711 commented Jan 28, 2022

Actually I found out a possible solution for this, you can actually change the game.socket.on to filter the users by userId, for example:

shareImage() { game.socket.emit("module.token-hud-art-button", { image: this.object, title: this.options.title, uuid: this.options.uuid }, game.user.id); //sending the user }

and on creation of the socket creation:

Hooks.once("ready", () => {
	game.socket.on("module.token-hud-art-button", (multiMediaPopout,  userId) => {
      
     if ( userId !== game.user.id ) return;    //if the user sent on the emition is different of mine, then it won't show to me

     multiMediaPopout._handleShareMedia);
}
});

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

No branches or pull requests

1 participant