summaryrefslogtreecommitdiff
path: root/src/LivingVillage.Desktop/Interaction.fs
diff options
context:
space:
mode:
authorSomhairle H. Marisol <[email protected]>2026-09-28 23:24:24 +0800
committerSomhairle H. Marisol <[email protected]>2026-09-28 23:24:24 +0800
commit7673d4af229735c9bdec5b167f7b29985b5bc858 (patch)
tree6942a14c5c3d404dccc97be25a7c3e4ce7c0ea41 /src/LivingVillage.Desktop/Interaction.fs
parent5f477f21507cb2c381e9a024f1146faf9472ff3d (diff)
downloadliving-village-7673d4af229735c9bdec5b167f7b29985b5bc858.tar.gz
p53: 情境提示与输入隔离回归——提示文案=实际作用对象(唯一映射)+隔墙/边界/切换/离开/隔离断言 + LV_P53_REC 录制证据
Diffstat (limited to 'src/LivingVillage.Desktop/Interaction.fs')
-rw-r--r--src/LivingVillage.Desktop/Interaction.fs14
1 files changed, 11 insertions, 3 deletions
diff --git a/src/LivingVillage.Desktop/Interaction.fs b/src/LivingVillage.Desktop/Interaction.fs
index 6a34b40..48bc3e7 100644
--- a/src/LivingVillage.Desktop/Interaction.fs
+++ b/src/LivingVillage.Desktop/Interaction.fs
@@ -111,6 +111,14 @@ module InteractionResolver =
distanceSquared avatarPosition position <= Sim.chatRangeSq
&& hasClearPath avatarPosition position
+ /// P53:交互动作 → 情境提示文案的唯一映射。提示层与按 E 的实际作用对象共用同一
+ /// 选择规则,文案只由动作决定,保证「提示写 E 交谈 → 按 E 作用于同一目标」。
+ let actionText (action: InteractionAction) : string =
+ match action with
+ | TalkTo _ -> "E 交谈"
+ | EnterHome _ -> "E 进屋"
+ | ExitHome _ -> "E 出屋"
+
let resolve (world: World) (homeMode: HomeMode) : InteractionTarget option =
let avatarPosition = world.Avatar.Pos
let candidates =
@@ -123,7 +131,7 @@ module InteractionResolver =
let avatarTile =
sceneTileFromPixel { X = avatarPosition.X; Y = avatarPosition.Y }
if isNearHomeDoor avatarTile home && targetIsReachable avatarPosition position then
- Some(target (ExitHome home.Id) position "E 出屋" avatarPosition)
+ Some(target (ExitHome home.Id) position (actionText (ExitHome home.Id)) avatarPosition)
else None
else None)
| Outside ->
@@ -134,13 +142,13 @@ module InteractionResolver =
let avatarTile =
sceneTileFromPixel { X = avatarPosition.X; Y = avatarPosition.Y }
if isNearHomeDoor avatarTile home && targetIsReachable avatarPosition position then
- Some(target (EnterHome home.Id) position "E 进屋" avatarPosition)
+ Some(target (EnterHome home.Id) position (actionText (EnterHome home.Id)) avatarPosition)
else None)
let npcs =
world.Npcs
|> Array.choose (fun npc ->
if dialogueAvailable npc && targetIsReachable avatarPosition npc.Pos then
- Some(target (TalkTo npc.Id) npc.Pos "E 交谈" avatarPosition)
+ Some(target (TalkTo npc.Id) npc.Pos (actionText (TalkTo npc.Id)) avatarPosition)
else None)
|> Array.toList
homes @ npcs