feat: derive capable opportunity helpers

This commit is contained in:
Rijad Zuzo
2026-07-16 10:41:05 +02:00
parent 79dd503343
commit eaa15c076c
17 changed files with 648 additions and 40 deletions
+15
View File
@@ -264,6 +264,7 @@ func _build_active_opportunity_display() -> String:
var interested_name := _get_npc_name(opportunity.get_interested_npc_id())
var resource_name := String(opportunity.get_resource_id()).capitalize()
var current_amount := _get_opportunity_current_amount(opportunity)
var helper_text := _build_opportunity_helper_display()
if opportunity.get_opportunity_type() == SimulationIds.OPPORTUNITY_SUPPLY_MISSING_WOOD:
var action_name := _get_opportunity_action_name(opportunity)
return (
@@ -271,12 +272,26 @@ func _build_active_opportunity_display() -> String:
+ "◆ Supply wood for blocked work\n"
+ "%s could not finish %s\n" % [interested_name, action_name]
+ "%s %.0f / %.0f" % [resource_name, current_amount, opportunity.get_target_amount()]
+ helper_text
)
return (
"\n\nVillage need\n"
+ "◆ Restock the empty pantry\n"
+ "%s is worried about the shortage\n" % interested_name
+ "%s %.0f / %.0f" % [resource_name, current_amount, opportunity.get_target_amount()]
+ helper_text
)
func _build_opportunity_helper_display() -> String:
if not simulation_manager.has_method("get_active_opportunity_helper"):
return ""
var helper: OpportunityHelperResult = simulation_manager.get_active_opportunity_helper()
if helper == null:
return "\nPossible helper: none informed, trusted, and able to supply"
return (
"\nPossible helper: %s%s\n%s"
% [_get_npc_name(helper.helper_npc_id), _get_action_name(helper.action_id), helper.reason]
)