feat: surface open opportunity need on villager field note

This commit is contained in:
2026-08-08 16:18:39 +02:00
parent 8a7e6b12eb
commit 4d2a230c5b
12 changed files with 525 additions and 4 deletions
+6 -1
View File
@@ -13,6 +13,7 @@ var target_name: String
var carried_amounts: Dictionary
var decision_reason: String
var _has_decision_reason: bool
var opportunity_note: VillagerOpportunityNote
func _init(
@@ -24,7 +25,8 @@ func _init(
inspection_target_id: StringName,
inspection_target_name: String,
inspection_carried_amounts: Dictionary,
inspection_decision_reason := ""
inspection_decision_reason := "",
inspection_opportunity_note: VillagerOpportunityNote = null
) -> void:
npc_id = inspection_npc_id
npc_name = inspection_npc_name
@@ -36,6 +38,7 @@ func _init(
carried_amounts = inspection_carried_amounts.duplicate(true)
_has_decision_reason = not inspection_decision_reason.strip_edges().is_empty()
decision_reason = (inspection_decision_reason if _has_decision_reason else AWAITING_REASON)
opportunity_note = inspection_opportunity_note
func has_decision_reason() -> bool:
@@ -67,6 +70,7 @@ func cache_key() -> String:
var carried_parts: Array[String] = []
for item_id in carried_keys:
carried_parts.append("%s=%.3f" % [String(item_id), float(carried_amounts[item_id])])
var note_part := opportunity_note.cache_key() if opportunity_note != null else "-"
return (
"|"
. join(
@@ -80,6 +84,7 @@ func cache_key() -> String:
target_name,
",".join(carried_parts),
decision_reason,
note_part,
]
)
)