Feat: Add 'Above' NPC entity and related interaction tests

This commit is contained in:
2026-04-25 16:32:02 +02:00
parent df0d577625
commit e55db834ab

View File

@@ -3245,6 +3245,15 @@ describe("RuntimeHost", () => {
name: "Right", name: "Right",
defaultDialogueId: null, defaultDialogueId: null,
dialogues: [] dialogues: []
},
{
entityId: "npc-above",
visible: true,
position: { x: 0, y: 2, z: 5 },
collider: { mode: "capsule", radius: 0.35, height: 1.8, eyeHeight: 1.6 },
name: "Above",
defaultDialogueId: null,
dialogues: []
} }
], ],
interactables: [], interactables: [],
@@ -3252,7 +3261,8 @@ describe("RuntimeHost", () => {
}, },
interactionLinks: [ interactionLinks: [
{ id: "link-active", sourceEntityId: "npc-active", trigger: "click", action: { type: "runSequence", sequenceId: "noop" } }, { id: "link-active", sourceEntityId: "npc-active", trigger: "click", action: { type: "runSequence", sequenceId: "noop" } },
{ id: "link-right", sourceEntityId: "npc-right", trigger: "click", action: { type: "runSequence", sequenceId: "noop" } } { id: "link-right", sourceEntityId: "npc-right", trigger: "click", action: { type: "runSequence", sequenceId: "noop" } },
{ id: "link-above", sourceEntityId: "npc-above", trigger: "click", action: { type: "runSequence", sequenceId: "noop" } }
] ]
} as never; } as never;
hostInternals.activeController = hostInternals.thirdPersonController; hostInternals.activeController = hostInternals.thirdPersonController;
@@ -3271,6 +3281,12 @@ describe("RuntimeHost", () => {
entityId: "npc-right", entityId: "npc-right",
center: { x: 2, y: 0.9, z: 5 }, center: { x: 2, y: 0.9, z: 5 },
score: 2.5 score: 2.5
},
{
kind: "npc",
entityId: "npc-above",
center: { x: 0, y: 2.9, z: 5 },
score: 2.4
} }
]; ];
hostInternals.activeRuntimeTargetReference = { hostInternals.activeRuntimeTargetReference = {
@@ -3312,6 +3328,34 @@ describe("RuntimeHost", () => {
kind: "npc", kind: "npc",
entityId: "npc-right" entityId: "npc-right"
}); });
expect(
hostInternals.handleRuntimeTargetLookInput({
horizontal: 0,
vertical: 0
})
).toEqual({
activeTargetLocked: true,
switchedTarget: false,
switchInputHeld: false
});
hostInternals.activeRuntimeTargetReference = {
kind: "npc",
entityId: "npc-active"
};
expect(
hostInternals.handleRuntimeTargetLookInput({
horizontal: 0,
vertical: 1
})
).toEqual({
activeTargetLocked: true,
switchedTarget: true,
switchInputHeld: true
});
expect(hostInternals.activeRuntimeTargetReference).toEqual({
kind: "npc",
entityId: "npc-above"
});
host.dispose(); host.dispose();
}); });