Make executeForEveryone and executeForAllGMs execute locally as well. Add executeForOthers and executeForOtherGMs endpoints

This commit is contained in:
2021-04-16 15:41:57 +02:00
parent 326bc0e017
commit 148f442857
3 changed files with 46 additions and 3 deletions

View File

@@ -109,11 +109,26 @@ class SocketlibSocket {
async executeForAllGMs(handler, ...args) {
const [name, func] = this._resolveFunction(handler);
this._sendCommand(name, args, RECIPIENT_TYPES.ALL_GMS);
if (game.user.isGM)
// TODO Make this function call run async, even if the function isn't delcared as async to prevent exceptions to propagate through executeForUsers
func(...args);
}
async executeForAllOtherGMs(handler, ...args) {
const [name, func] = this._resolveFunction(handler);
this._sendCommand(name, args, RECIPIENT_TYPES.ALL_GMS);
}
async executeForEveryone(handler, ...args) {
const [name, func] = this._resolveFunction(handler);
this._sendCommand(name, args, RECIPIENT_TYPES.EVERYONE);
// TODO Make this function call run async, even if the function isn't delcared as async to prevent exceptions to propagate through executeForUsers
func(...args);
}
async executeForOthers(handler, ...args) {
const [name, func] = this._resolveFunction(handler);
this._sendCommand(name, args, RECIPIENT_TYPES.EVERYONE);
}
async executeForUsers(handler, recipients, ...args) {