Fix fear being set by players

This commit is contained in:
Dapoolp 2025-08-26 14:01:42 +02:00
parent fb9240e130
commit 631d5a3068
2 changed files with 3 additions and 15 deletions

View file

@ -78,7 +78,7 @@ export default class FearTracker extends HandlebarsApplicationMixin(ApplicationV
/** @override */ /** @override */
async _preRender(context, options) { async _preRender(context, options) {
if (this.currentFear > this.maxFear) if (this.currentFear > this.maxFear && game.user.isGM)
await game.settings.set(CONFIG.DH.id, CONFIG.DH.SETTINGS.gameSettings.Resources.Fear, this.maxFear); await game.settings.set(CONFIG.DH.id, CONFIG.DH.SETTINGS.gameSettings.Resources.Fear, this.maxFear);
} }
@ -107,18 +107,5 @@ export default class FearTracker extends HandlebarsApplicationMixin(ApplicationV
async updateFear(value) { async updateFear(value) {
return emitAsGM(GMUpdateEvent.UpdateFear, game.settings.set.bind(game.settings, CONFIG.DH.id, CONFIG.DH.SETTINGS.gameSettings.Resources.Fear), value); return emitAsGM(GMUpdateEvent.UpdateFear, game.settings.set.bind(game.settings, CONFIG.DH.id, CONFIG.DH.SETTINGS.gameSettings.Resources.Fear), value);
/* if(!game.user.isGM)
await game.socket.emit(`system.${CONFIG.DH.id}`, {
action: socketEvent.GMUpdate,
data: {
action: GMUpdateEvent.UpdateFear,
update: value
}
});
else
game.settings.set(CONFIG.DH.id, CONFIG.DH.SETTINGS.gameSettings.Resources.Fear, value); */
/* if (!game.user.isGM) return;
value = Math.max(0, Math.min(this.maxFear, value));
await game.settings.set(CONFIG.DH.id, CONFIG.DH.SETTINGS.gameSettings.Resources.Fear, value); */
} }
} }

View file

@ -86,11 +86,12 @@ export default class DHRoll extends Roll {
type: this.messageType, type: this.messageType,
user: game.user.id, user: game.user.id,
title: roll.title, title: roll.title,
speaker: cls.getSpeaker(), speaker: cls.getSpeaker({ actor: roll.data?.parent }),
sound: config.mute ? null : CONFIG.sounds.dice, sound: config.mute ? null : CONFIG.sounds.dice,
system: config, system: config,
rolls: [roll] rolls: [roll]
}; };
config.selectedRollMode ??= game.settings.get('core', 'rollMode'); config.selectedRollMode ??= game.settings.get('core', 'rollMode');
if (roll._evaluated) { if (roll._evaluated) {