12.0.5 - Les mauvais jours d'Astrobazzarh #706
@ -232,11 +232,13 @@ export class RdDBaseActor extends Actor {
|
|||||||
|
|
||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
async cleanupConteneurs() {
|
async cleanupConteneurs() {
|
||||||
let updates = this.itemTypes['conteneur']
|
if (Misc.isOwnerPlayerOrUniqueConnectedGM(this)) {
|
||||||
.filter(c => c.system.contenu.filter(id => this.getItem(id) == undefined).length > 0)
|
let updates = this.itemTypes['conteneur']
|
||||||
.map(c => { return { _id: c._id, 'system.contenu': c.system.contenu.filter(id => this.getItem(id) != undefined) } });
|
.filter(c => c.system.contenu.filter(id => this.getItem(id) == undefined).length > 0)
|
||||||
if (updates.length > 0) {
|
.map(c => { return { _id: c._id, 'system.contenu': c.system.contenu.filter(id => this.getItem(id) != undefined) } });
|
||||||
await this.updateEmbeddedDocuments("Item", updates)
|
if (updates.length > 0) {
|
||||||
|
await this.updateEmbeddedDocuments("Item", updates)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user