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