feat: add weak-villager and damaged-roof village needs

This commit is contained in:
Rijad Zuzo
2026-08-11 00:32:22 +02:00
parent 37f262fb84
commit 82e44a9f5d
10 changed files with 547 additions and 45 deletions
+84 -23
View File
@@ -268,15 +268,41 @@ func _build_active_opportunity_display() -> String:
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 (
"\n\nVillage need\n"
+ "◆ 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
)
match opportunity.get_opportunity_type():
SimulationIds.OPPORTUNITY_SUPPLY_MISSING_WOOD:
var action_name := _get_opportunity_action_name(opportunity)
return (
"\n\nVillage need\n"
+ "◆ 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
)
SimulationIds.OPPORTUNITY_FEED_WEAK_VILLAGER:
return (
"\n\nVillage need\n"
+ "◆ Bring food to %s\n" % interested_name
+ "%s is too weak to gather\n" % interested_name
+ (
"%s %.0f / %.0f"
% [resource_name, current_amount, opportunity.get_target_amount()]
)
+ helper_text
)
SimulationIds.OPPORTUNITY_REPAIR_HOME_ROOF:
return (
"\n\nVillage need\n"
+ "◆ Repair %s's roof\n" % interested_name
+ "%s is worried about their damaged home\n" % interested_name
+ (
"%s %.0f / %.0f"
% [resource_name, current_amount, opportunity.get_target_amount()]
)
+ helper_text
)
return (
"\n\nVillage need\n"
+ "◆ Restock the empty pantry\n"
@@ -328,15 +354,34 @@ func _build_npc_opportunity_display(npc: SimNPC) -> String:
var resource_name := String(opportunity.get_resource_id()).capitalize()
if opportunity.get_status() == OpportunityStateRecord.STATUS_OPEN:
var current_amount := _get_opportunity_current_amount(opportunity)
if opportunity.get_opportunity_type() == SimulationIds.OPPORTUNITY_SUPPLY_MISSING_WOOD:
return (
"Open village need\n"
+ "◆ Find wood for %s\n" % _get_opportunity_action_name(opportunity)
+ (
"%s %.0f / %.0f\n\n"
% [resource_name, current_amount, opportunity.get_target_amount()]
match opportunity.get_opportunity_type():
SimulationIds.OPPORTUNITY_SUPPLY_MISSING_WOOD:
return (
"Open village need\n"
+ "◆ Find wood for %s\n" % _get_opportunity_action_name(opportunity)
+ (
"%s %.0f / %.0f\n\n"
% [resource_name, current_amount, opportunity.get_target_amount()]
)
)
SimulationIds.OPPORTUNITY_FEED_WEAK_VILLAGER:
return (
"Open village need\n"
+ "%s is too weak to gather\n" % npc.npc_name
+ (
"%s %.0f / %.0f\n\n"
% [resource_name, current_amount, opportunity.get_target_amount()]
)
)
SimulationIds.OPPORTUNITY_REPAIR_HOME_ROOF:
return (
"Open village need\n"
+ "%s's roof needs wood\n" % npc.npc_name
+ (
"%s %.0f / %.0f\n\n"
% [resource_name, current_amount, opportunity.get_target_amount()]
)
)
)
return (
"Open village need\n"
+ "◆ Restock the empty pantry\n"
@@ -364,12 +409,28 @@ func _build_npc_opportunity_display(npc: SimNPC) -> String:
if resolution_event != null:
var actor_id := int(resolution_event.data["actor_id"])
actor_name = "Player" if actor_id < 0 else _get_npc_name(actor_id)
if opportunity.get_opportunity_type() == SimulationIds.OPPORTUNITY_SUPPLY_MISSING_WOOD:
return (
"Resolved village need\n"
+ "%s supplied the woodpile\n" % actor_name
+ "%s target %.0f\n\n" % [resource_name, opportunity.get_target_amount()]
)
match opportunity.get_opportunity_type():
SimulationIds.OPPORTUNITY_SUPPLY_MISSING_WOOD:
return (
"Resolved village need\n"
+ "%s supplied the woodpile\n" % actor_name
+ "%s target %.0f\n\n" % [resource_name, opportunity.get_target_amount()]
)
SimulationIds.OPPORTUNITY_FEED_WEAK_VILLAGER:
return (
"Resolved village need\n"
+ (
"%s ate the supplied food\n"
% _get_npc_name(opportunity.get_interested_npc_id())
)
+ "%s target %.0f\n\n" % [resource_name, opportunity.get_target_amount()]
)
SimulationIds.OPPORTUNITY_REPAIR_HOME_ROOF:
return (
"Resolved village need\n"
+ "%s repaired the roof\n" % actor_name
+ "%s target %.0f\n\n" % [resource_name, opportunity.get_target_amount()]
)
return (
"Resolved village need\n"
+ "%s restocked the pantry\n" % actor_name
+10
View File
@@ -201,6 +201,11 @@ func _on_state_restored() -> void:
func _build_need_message(opportunity: OpportunityStateRecord) -> String:
var interested_name := _get_npc_name(opportunity.get_interested_npc_id())
match opportunity.get_opportunity_type():
SimulationIds.OPPORTUNITY_FEED_WEAK_VILLAGER:
return "%s is too weak to gather food." % interested_name
SimulationIds.OPPORTUNITY_REPAIR_HOME_ROOF:
return "%s's roof needs wood." % interested_name
if opportunity.get_resource_id() == SimulationIds.RESOURCE_FOOD:
return "%s worries over the empty pantry." % interested_name
var trigger: EconomicEventRecord = simulation_manager.get_opportunity_trigger_event(opportunity)
@@ -227,6 +232,11 @@ func _get_destination_name(target_id: StringName) -> String:
func _get_need_name(opportunity: OpportunityStateRecord) -> String:
match opportunity.get_opportunity_type():
SimulationIds.OPPORTUNITY_FEED_WEAK_VILLAGER:
return "weak-villager plea"
SimulationIds.OPPORTUNITY_REPAIR_HOME_ROOF:
return "damaged-roof report"
return (
"empty-pantry worry"
if opportunity.get_resource_id() == SimulationIds.RESOURCE_FOOD