Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions src/module/actor/base.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2066,9 +2066,10 @@ const ActorProxyPF2e = new Proxy(ActorPF2e, {
args: [source: PreCreate<ActorSourcePF2e>, context?: DocumentConstructionContext<ActorPF2e["parent"]>],
) {
const type = args[0]?.type;
const ActorClass = CONFIG.PF2E.Actor.documentClasses[type];
const ActorClass: typeof ActorPF2e =
(type as string | undefined) === "base" ? ActorPF2e : CONFIG.PF2E.Actor.documentClasses[type];
if (!ActorClass) {
throw ErrorPF2e(`Actor type ${type} does not exist and actor module sub-types are not supported`);
throw ErrorPF2e(`Actor type ${type} does not exist, and actor module subtypes are not supported`);
}
return new ActorClass(...args);
},
Expand Down
5 changes: 3 additions & 2 deletions src/module/item/base/document.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1027,9 +1027,10 @@ const ItemProxyPF2e = new Proxy(ItemPF2e, {
: source?.type === "consumable" && (source.system?.category as string | undefined) === "ammo"
? "ammo"
: source?.type;
const ItemClass: typeof ItemPF2e = CONFIG.PF2E.Item.documentClasses[type];
const ItemClass: typeof ItemPF2e =
(source?.type as string | undefined) === "base" ? ItemPF2e : CONFIG.PF2E.Item.documentClasses[type];
if (!ItemClass) {
throw ErrorPF2e(`Item type ${type} does not exist and item module sub-types are not supported`);
throw ErrorPF2e(`Item type ${type} does not exist, and item module subtypes are not supported`);
}
return new ItemClass(...args);
},
Expand Down
Loading