mirror of
https://github.com/Foundryborne/daggerheart.git
synced 2026-01-18 07:59:03 +01:00
Fixed our onCreate methods unintentionally being run on all clients
This commit is contained in:
parent
4551a2bcfe
commit
967b3ba2ab
6 changed files with 15 additions and 4 deletions
|
|
@ -26,7 +26,9 @@ export default class BeastformEffect extends foundry.abstract.TypeDataModel {
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
async _onCreate() {
|
async _onCreate(_data, _options, userId) {
|
||||||
|
if (userId !== game.user.id) return;
|
||||||
|
|
||||||
if (this.parent.parent?.type === 'character') {
|
if (this.parent.parent?.type === 'character') {
|
||||||
this.parent.parent.system.primaryWeapon?.update?.({ 'system.equipped': false });
|
this.parent.parent.system.primaryWeapon?.update?.({ 'system.equipped': false });
|
||||||
this.parent.parent.system.secondayWeapon?.update?.({ 'system.equipped': false });
|
this.parent.parent.system.secondayWeapon?.update?.({ 'system.equipped': false });
|
||||||
|
|
|
||||||
|
|
@ -118,7 +118,9 @@ export default class BaseDataItem extends foundry.abstract.TypeDataModel {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
_onCreate(data) {
|
_onCreate(data, _, userId) {
|
||||||
|
if (userId !== game.user.id) return;
|
||||||
|
|
||||||
if (!this.actor || this.actor.type !== 'character' || !this.features) return;
|
if (!this.actor || this.actor.type !== 'character' || !this.features) return;
|
||||||
|
|
||||||
this.actor.createEmbeddedDocuments(
|
this.actor.createEmbeddedDocuments(
|
||||||
|
|
|
||||||
|
|
@ -149,7 +149,9 @@ export default class DHBeastform extends BaseDataItem {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
_onCreate() {
|
_onCreate(_data, _options, userId) {
|
||||||
|
if (userId !== game.user.id) return;
|
||||||
|
|
||||||
this.parent.createEmbeddedDocuments('ActiveEffect', [
|
this.parent.createEmbeddedDocuments('ActiveEffect', [
|
||||||
{
|
{
|
||||||
type: 'beastform',
|
type: 'beastform',
|
||||||
|
|
|
||||||
|
|
@ -75,6 +75,9 @@ export default class DHClass extends BaseDataItem {
|
||||||
|
|
||||||
_onCreate(data, options, userId) {
|
_onCreate(data, options, userId) {
|
||||||
super._onCreate(data, options, userId);
|
super._onCreate(data, options, userId);
|
||||||
|
|
||||||
|
if (userId !== game.user.id) return;
|
||||||
|
|
||||||
if (options.parent?.type === 'character') {
|
if (options.parent?.type === 'character') {
|
||||||
const path = `system.${data.system.isMulticlass ? 'multiclass.value' : 'class.value'}`;
|
const path = `system.${data.system.isMulticlass ? 'multiclass.value' : 'class.value'}`;
|
||||||
options.parent.update({ [path]: `${options.parent.uuid}.Item.${data._id}` });
|
options.parent.update({ [path]: `${options.parent.uuid}.Item.${data._id}` });
|
||||||
|
|
|
||||||
|
|
@ -67,6 +67,8 @@ export default class DHSubclass extends BaseDataItem {
|
||||||
_onCreate(data, options, userId) {
|
_onCreate(data, options, userId) {
|
||||||
super._onCreate(data, options, userId);
|
super._onCreate(data, options, userId);
|
||||||
|
|
||||||
|
if (userId !== game.user.id) return;
|
||||||
|
|
||||||
if (options.parent?.type === 'character') {
|
if (options.parent?.type === 'character') {
|
||||||
const path = `system.${data.system.isMulticlass ? 'multiclass.subclass' : 'class.subclass'}`;
|
const path = `system.${data.system.isMulticlass ? 'multiclass.subclass' : 'class.subclass'}`;
|
||||||
options.parent.update({ [path]: `${options.parent.uuid}.Item.${data._id}` });
|
options.parent.update({ [path]: `${options.parent.uuid}.Item.${data._id}` });
|
||||||
|
|
|
||||||
|
|
@ -13,7 +13,7 @@ export default class DhTooltipManager extends foundry.helpers.interaction.Toolti
|
||||||
if (item) {
|
if (item) {
|
||||||
const type = actionId ? 'action' : item.type;
|
const type = actionId ? 'action' : item.type;
|
||||||
const description = await TextEditor.enrichHTML(item.system.description);
|
const description = await TextEditor.enrichHTML(item.system.description);
|
||||||
for (let feature of item.system.features) {
|
for (let feature of item.system?.features ?? []) {
|
||||||
feature.system.enrichedDescription = await TextEditor.enrichHTML(feature.system.description);
|
feature.system.enrichedDescription = await TextEditor.enrichHTML(feature.system.description);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue