DFreds
DFreds
Library: UI Extender
Hey all, I'm developing a new library module to make adding new UI elements to existing Foundry UI elements simple. This started as a way to do this in my own modules like Convenient Effects, which adds a scene control button to the token controls. Currently, I only have a few extensions: - Adding a new scene control to any of the layers - Adding a new HUD button to a token, tile, or drawing I'm looking for any suggestions on other functions you'd like to see added, whether they are specifically extending existing controls (like the above examples) or adding any helper functions that you've either created or would find useful. Thanks!
8 replies
Sockets not emitting
Hey all, I'm losing my mind. I recently stopped using socketlib in my convenient effects rewrite, and now I can't get sockets to emit at all. My setup is basically copying how pf2e did it, so I'm a bit confused. And yes, socket: true is set in the manifest. Here's my code (again, mostly derived from pf2e):
Hooks.once("init", () => {
activateSocketListener();
});
Hooks.once("init", () => {
activateSocketListener();
});
function activateSocketListener(): void {
game.socket.on(
SocketEffectHandler.IDENTIFIER,
async (...[message, userId]: SocketEventParams) => {
log(`Socket emitted ${message} ${userId}`);
},
);
}
function activateSocketListener(): void {
game.socket.on(
SocketEffectHandler.IDENTIFIER,
async (...[message, userId]: SocketEventParams) => {
log(`Socket emitted ${message} ${userId}`);
},
);
}
async removeEffect({
effectId,
effectName,
uuid,
origin,
}: IRemoveEffect): Promise<void> {
game.socket.emit(SocketEffectHandler.IDENTIFIER, {
request: "removeEffect",
effectId,
effectName,
uuid,
origin,
} satisfies SocketMessage);
}
async removeEffect({
effectId,
effectName,
uuid,
origin,
}: IRemoveEffect): Promise<void> {
game.socket.emit(SocketEffectHandler.IDENTIFIER, {
request: "removeEffect",
effectId,
effectName,
uuid,
origin,
} satisfies SocketMessage);
}
class SocketEffectHandler {
static IDENTIFIER = `module.${MODULE_ID}`;
// ... omit rest
}
class SocketEffectHandler {
static IDENTIFIER = `module.${MODULE_ID}`;
// ... omit rest
}
Basically I'm never seeing the log come through from the on call
9 replies