Update entity reading functions to include legacy project dialogues
This commit is contained in:
@@ -3097,7 +3097,10 @@ function readNpcPresence(value: unknown, label: string): NpcPresence {
|
|||||||
function readEntityInstance(
|
function readEntityInstance(
|
||||||
value: unknown,
|
value: unknown,
|
||||||
label: string,
|
label: string,
|
||||||
options: { legacySoundEmitter: boolean }
|
options: {
|
||||||
|
legacySoundEmitter: boolean;
|
||||||
|
legacyProjectDialogues?: ProjectDialogueLibrary;
|
||||||
|
}
|
||||||
): EntityInstance {
|
): EntityInstance {
|
||||||
if (!isRecord(value)) {
|
if (!isRecord(value)) {
|
||||||
throw new Error(`${label} must be an object.`);
|
throw new Error(`${label} must be an object.`);
|
||||||
@@ -3113,7 +3116,11 @@ function readEntityInstance(
|
|||||||
case "sceneEntry":
|
case "sceneEntry":
|
||||||
return readSceneEntryEntity(value, label);
|
return readSceneEntryEntity(value, label);
|
||||||
case "npc":
|
case "npc":
|
||||||
return readNpcEntity(value, label);
|
return readNpcEntity(
|
||||||
|
value,
|
||||||
|
label,
|
||||||
|
options.legacyProjectDialogues ?? createEmptyProjectDialogueLibrary()
|
||||||
|
);
|
||||||
case "soundEmitter":
|
case "soundEmitter":
|
||||||
return options.legacySoundEmitter
|
return options.legacySoundEmitter
|
||||||
? readLegacySoundEmitterEntity(value, label)
|
? readLegacySoundEmitterEntity(value, label)
|
||||||
@@ -3131,7 +3138,10 @@ function readEntityInstance(
|
|||||||
|
|
||||||
function readEntities(
|
function readEntities(
|
||||||
value: unknown,
|
value: unknown,
|
||||||
options: { legacySoundEmitter: boolean }
|
options: {
|
||||||
|
legacySoundEmitter: boolean;
|
||||||
|
legacyProjectDialogues?: ProjectDialogueLibrary;
|
||||||
|
}
|
||||||
): SceneDocument["entities"] {
|
): SceneDocument["entities"] {
|
||||||
if (!isRecord(value)) {
|
if (!isRecord(value)) {
|
||||||
throw new Error("entities must be a record.");
|
throw new Error("entities must be a record.");
|
||||||
|
|||||||
Reference in New Issue
Block a user