forked from public/foundryvtt-reve-de-dragon
Fix des TMRs visibles/cachées
Parfois on peut retrouver son chemin dans les TMR: - Terre d'attache - Connaisance du fleuve - changeur des rêves vaincus On ne peut pas utiliser un messager/passeur quand on est perdu Les messages ne contiennent plus 'undefined' pour le changeur
This commit is contained in:
@ -1472,10 +1472,8 @@ export class RdDActor extends Actor {
|
||||
isTMRCache() {
|
||||
return this.data.data.reve.tmrpos.cache;
|
||||
}
|
||||
/* -------------------------------------------- */
|
||||
async cacheTMRetMessage() {
|
||||
await this.reinsertionAleatoire("Action MJ");
|
||||
await this.cacheTMR();
|
||||
|
||||
notifyRefreshTMR() {
|
||||
game.socket.emit(SYSTEM_SOCKET_ID, {
|
||||
msg: "msg_tmr_move", data: {
|
||||
actorId: this.data._id,
|
||||
@ -1487,27 +1485,27 @@ export class RdDActor extends Actor {
|
||||
/* -------------------------------------------- */
|
||||
async afficheTMRetMessage() {
|
||||
await this.montreTMR();
|
||||
game.socket.emit(SYSTEM_SOCKET_ID, {
|
||||
msg: "msg_tmr_move", data: {
|
||||
actorId: this.data._id,
|
||||
tmrPos: this.data.data.reve.tmrpos
|
||||
}
|
||||
});
|
||||
this.notifyRefreshTMR();
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
async reinsertionAleatoire(raison) {
|
||||
async reinsertionAleatoire(raison, accessible = tmr => true) {
|
||||
const innaccessible = this.buildTMRInnaccessible();
|
||||
let tmr = await TMRUtility.getTMRAleatoire(tmr => accessible(tmr) && !innaccessible.includes(tmr.coord));
|
||||
ChatMessage.create({
|
||||
content: `${raison} : ré-insertion aléatoire.`,
|
||||
whisper: ChatUtility.getWhisperRecipientsAndGMs(game.user.name)
|
||||
});
|
||||
const innaccessible = this.buildTMRInnaccessible();
|
||||
let tmr = await TMRUtility.getTMRAleatoire(tmr => !innaccessible.includes(tmr.coord));
|
||||
this.updateCoordTMR(tmr.coord);
|
||||
this.cacheTMR();
|
||||
await this.forcerPositionTMRInconnue(tmr);
|
||||
return tmr;
|
||||
}
|
||||
|
||||
async forcerPositionTMRInconnue(tmr) {
|
||||
await this.cacheTMR();
|
||||
await this.updateCoordTMR(tmr.coord);
|
||||
this.notifyRefreshTMR();
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
buildTMRInnaccessible() {
|
||||
const tmrInnaccessibles = this.filterItemsData(it => Draconique.isCaseTMR(it) &&
|
||||
@ -3153,9 +3151,9 @@ export class RdDActor extends Actor {
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
refreshTMRView(tmrData) {
|
||||
refreshTMRView() {
|
||||
if (this.currentTMR) {
|
||||
this.currentTMR.externalRefresh(tmrData)
|
||||
this.currentTMR.externalRefresh();
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user