Skip to content

Commit

Permalink
Added some settings + SFX
Browse files Browse the repository at this point in the history
  • Loading branch information
ChasarooniZ committed Feb 25, 2024
1 parent af1e86d commit b90dd76
Show file tree
Hide file tree
Showing 4 changed files with 41 additions and 4 deletions.
10 changes: 10 additions & 0 deletions languages/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,16 @@
"bot-left": "Bottom Left",
"bot-right": "Bottom Right"
}
},
"offset": {
"x": {
"name": "X Offset",
"hint": "Offset in X axis"
},
"y": {
"name": "Y Offset",
"hint": "Offset in Y axis"
}
}
}
}
Expand Down
Binary file added resources/rules-lawyer-sfx.ogg
Binary file not shown.
17 changes: 13 additions & 4 deletions scripts/module.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,22 +7,31 @@ Hooks.once('ready', function () {
const chatWidth = chat.offsetWidth;
const position = "bot-right";
const anchor = getAnchor(position);
const file = 'modules/pf2e-rules-lawyer/resources/every-plus-one-extra.webm';
const xOffset = -40;
const yOffset = 0
const vidFile = 'modules/pf2e-rules-lawyer/resources/every-plus-one-extra.webm';
const sfxFile = 'modules/pf2e-rules-lawyer/resources/rules-lawyer-sfx.ogg';
const volume = 0.5;
const xOffset = game.settings.get("pf2e-rules-lawyer", "offset.x");
const yOffset = game.settings.get("pf2e-rules-lawyer", "offset.y");
const duration = 5000;
const fadeOutDuration = 1000;
const scale = 1/3;
new Sequence()
.effect()
.file(file)
.file(vidFile)
.screenSpace()
.screenSpaceAnchor(anchor)
.screenSpaceAboveUI()
.screenSpacePosition({ x:xOffset - chatWidth, y: yOffset })
.duration(duration)
.fadeOut(fadeOutDuration)
.scale(scale)
.forUsers(data?.chatMessage?.whisper ?? [...game.users.keys()])
.sound()
.file(sfxFile)
.volume(volume)
.duration(duration)
.fadeOutAudio(fadeOutDuration)
.forUsers(data?.chatMessage?.whisper ?? [...game.users.keys()])
.play()
}
})
Expand Down
18 changes: 18 additions & 0 deletions scripts/settings.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,24 @@ Hooks.on("init", () => {
default: true,
type: Boolean,
});

game.settings.register("pf2e-rules-lawyer", "offset.x", {
name: game.i18n.localize("pf2e-rules-lawyer.module-settings.offset.x.name"),
hint: game.i18n.localize("pf2e-rules-lawyer.module-settings.offset.x.hint"),
scope: "world",
config: true,
default: -546 - 40,
type: Number,
});

game.settings.register("pf2e-rules-lawyer", "offset.y", {
name: game.i18n.localize("pf2e-rules-lawyer.module-settings.offset.y.name"),
hint: game.i18n.localize("pf2e-rules-lawyer.module-settings.offset.y.hint"),
scope: "world",
config: true,
default: -150,
type: Number,
});

// game.settings.register("pf2e-rules-lawyer", "position", {
// name: game.i18n.localize("pf2e-rules-lawyer.module-settings.position.name"),
Expand Down

0 comments on commit b90dd76

Please sign in to comment.