Skip to content

Commit

Permalink
Remove empty specific objects from armor on extract (foundryvtt#11908)
Browse files Browse the repository at this point in the history
  • Loading branch information
stwlam committed Dec 1, 2023
1 parent ffb26ca commit 16aba7c
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions build/lib/extractor.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import type { ActorSourcePF2e } from "@actor/data/index.ts";
import type { NPCAttributesSource, NPCSystemSource } from "@actor/npc/data.ts";
import { ItemSourcePF2e, MeleeSource, SpellSource, isPhysicalData } from "@item/base/data/index.ts";
import { itemIsOfType } from "@item/helpers.ts";
import { PublicationData } from "@module/data.ts";
import { RuleElementSource } from "@module/rules/index.ts";
import { isObject, sluggify } from "@util/index.ts";
Expand Down Expand Up @@ -482,8 +483,6 @@ class PackExtractor {
delete (docSource as Partial<PackEntry>).ownership;
}
}
} else if (["_modifiers", "_sheetTab"].includes(key)) {
delete docSource[key as DocumentKey];
} else if (docSource[key as DocumentKey] instanceof Object) {
this.#pruneTree(docSource[key as DocumentKey] as unknown as PackEntry, topLevel);
}
Expand Down Expand Up @@ -515,14 +514,15 @@ class PackExtractor {
delete (source.system as { spell?: unknown }).spell;
}

if (itemIsOfType(source, "armor", "weapon") && source.system.specific?.value === false) {
delete source.system.specific;
}

if (source.type === "weapon") {
delete (source.system as { property1?: unknown }).property1;
if ("value" in source.system.damage) {
delete source.system.damage.value;
}
if (source.system.specific?.value === false) {
delete source.system.specific;
}
if (!source.system.damage.persistent) {
delete (source.system.damage as { persistent?: unknown }).persistent;
}
Expand Down

0 comments on commit 16aba7c

Please sign in to comment.