mirror of
https://github.com/Foundryborne/daggerheart.git
synced 2026-01-18 07:59:03 +01:00
[Fix] 1548 - Standalone Item Add Actions (#1549)
* Fixed so that items not on an actor don't error out on creating actions * Fixed deletion of items error
This commit is contained in:
parent
22383613f1
commit
07bdd48199
4 changed files with 4 additions and 4 deletions
|
|
@ -240,7 +240,7 @@ export default class BaseDataItem extends foundry.abstract.TypeDataModel {
|
|||
|
||||
game.system.registeredTriggers.unregisterTriggers(triggersToRemove, this.parent.uuid);
|
||||
|
||||
if (!(this.parent.parent.token instanceof game.system.api.documents.DhToken)) {
|
||||
if (this.parent.parent && !(this.parent.parent.token instanceof game.system.api.documents.DhToken)) {
|
||||
for (const token of this.parent.parent.getActiveTokens()) {
|
||||
game.system.registeredTriggers.unregisterTriggers(
|
||||
triggersToRemove,
|
||||
|
|
|
|||
|
|
@ -60,7 +60,7 @@ export default class RegisteredTriggers extends Map {
|
|||
|
||||
unregisterItemTriggers(items) {
|
||||
for (const item of items) {
|
||||
if (!item.system.actions.size) continue;
|
||||
if (!item.system.actions?.size) continue;
|
||||
|
||||
const triggers = (item.system.actions ?? []).reduce((acc, action) => {
|
||||
acc.push(...action.triggers.map(x => x.trigger));
|
||||
|
|
|
|||
|
|
@ -217,7 +217,7 @@ export default class DHItem extends foundry.documents.Item {
|
|||
|
||||
game.system.registeredTriggers.unregisterTriggers(triggerKeys, this.uuid);
|
||||
|
||||
if (!(this.actor.parent instanceof game.system.api.documents.DhToken)) {
|
||||
if (this.actor && !(this.actor.parent instanceof game.system.api.documents.DhToken)) {
|
||||
for (const token of this.actor.getActiveTokens()) {
|
||||
game.system.registeredTriggers.unregisterTriggers(triggerKeys, `${token.document.uuid}.${this.uuid}`);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue