From f07461bbb8f17937de0fddd63df3d91797f45c4e Mon Sep 17 00:00:00 2001 From: KungKurt Date: Sun, 16 Feb 2025 03:48:25 +0100 Subject: [PATCH] updated some shit --- module.json | 2 +- scripts/puckochat/main.js | 8 ++++---- scripts/puckotheatre/talk_as.js | 17 +++++++++++++++++ 3 files changed, 22 insertions(+), 5 deletions(-) create mode 100644 scripts/puckotheatre/talk_as.js diff --git a/module.json b/module.json index 40a90cf..f4b379e 100644 --- a/module.json +++ b/module.json @@ -31,7 +31,7 @@ } ] }, - "scripts": [ + "esmodules": [ "scripts/puckochat/main.js" ], "url": "https://git.puckoprutt.tech/puckoprutt/puckoprutt-foundry-module", diff --git a/scripts/puckochat/main.js b/scripts/puckochat/main.js index 1d2a077..1852755 100644 --- a/scripts/puckochat/main.js +++ b/scripts/puckochat/main.js @@ -1,17 +1,17 @@ -import "scripts/puckochat/commands" +import { puckocommand } from "commands" -Hooks.on("init", function() { +Hooks.on("init", async function() { console.log("[puckoprutt] Hello Init"); }); -Hooks.on("ready", function() { +Hooks.on("ready", async function() { console.log("[puckoprutt] Hello Ready"); }); Hooks.on("chatMessage", (log, message, data) => { to_send = ""; console.log("[puckoprutt] chat!"); - if(message[0] === "!") to_send = commands.puckocommand(log, message.slice(1).split(" "), data); + if(message[0] === "!") to_send = puckocommand(isGM, user, world, log, message.slice(1).split(" "), data); if(to_send !== "") { ChatMessage.create({ diff --git a/scripts/puckotheatre/talk_as.js b/scripts/puckotheatre/talk_as.js new file mode 100644 index 0000000..361c2ce --- /dev/null +++ b/scripts/puckotheatre/talk_as.js @@ -0,0 +1,17 @@ +export async function talk_as(idx, name, theatre_idx, message, emote, delay=4500) { + theatre.functions.activateStagedByID(theatre_idx); + theatre._sendTypingEvent(); + theatre.setUserTyping(game.user.id, theatre.speakingAs); + await new Promise(r => setTimeout(r, 800)); + theatre._sendTypingEvent(); + theatre.setUserTyping(game.user.id, theatre.speakingAs); + theatre.setEmoteForInsertById(emote, "theatre-"+idx); + await new Promise(r => setTimeout(r, 700)); + ChatMessage.create({ + user: game.user.id, + speaker: ChatMessage.getSpeaker({token: canvas.tokens.objects.getChildByName(name)}), + content: message + }); + await new Promise(r => setTimeout(r, delay)); + theatre.setEmoteForInsertById("none", "theatre-"+idx); +} \ No newline at end of file