Update interaction validation to support Interactable entities and specific triggers
This commit is contained in:
@@ -294,26 +294,39 @@ function validateInteractionLink(link: InteractionLink, path: string, document:
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (sourceEntity.kind !== "triggerVolume") {
|
if (sourceEntity.kind !== "triggerVolume" && sourceEntity.kind !== "interactable") {
|
||||||
diagnostics.push(
|
diagnostics.push(
|
||||||
createDiagnostic(
|
createDiagnostic(
|
||||||
"error",
|
"error",
|
||||||
"invalid-interaction-source-kind",
|
"invalid-interaction-source-kind",
|
||||||
"Interaction links may only source from Trigger Volume entities in the current slice.",
|
"Interaction links may only source from Trigger Volume or Interactable entities in the current slice.",
|
||||||
`${path}.sourceEntityId`
|
`${path}.sourceEntityId`
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (link.trigger !== "enter" && link.trigger !== "exit") {
|
if (sourceEntity.kind === "triggerVolume") {
|
||||||
diagnostics.push(
|
if (link.trigger !== "enter" && link.trigger !== "exit") {
|
||||||
createDiagnostic(
|
diagnostics.push(
|
||||||
"error",
|
createDiagnostic(
|
||||||
"unsupported-interaction-trigger",
|
"error",
|
||||||
`Unsupported interaction trigger ${String(link.trigger)}.`,
|
"unsupported-interaction-trigger",
|
||||||
`${path}.trigger`
|
"Trigger Volume links may only use enter or exit triggers.",
|
||||||
)
|
`${path}.trigger`
|
||||||
);
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
} else if (sourceEntity.kind === "interactable") {
|
||||||
|
if (link.trigger !== "click") {
|
||||||
|
diagnostics.push(
|
||||||
|
createDiagnostic(
|
||||||
|
"error",
|
||||||
|
"unsupported-interaction-trigger",
|
||||||
|
"Interactable links may only use the click trigger.",
|
||||||
|
`${path}.trigger`
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (link.action.type) {
|
switch (link.action.type) {
|
||||||
|
|||||||
Reference in New Issue
Block a user