feat: add location-based food storage loop
This commit is contained in:
@@ -5,13 +5,22 @@ func select_action(npc: SimNPC, village: SimVillage) -> ActionSelectionResult:
|
||||
if npc.is_dead:
|
||||
return null
|
||||
if npc.is_starving:
|
||||
if village.food > 0:
|
||||
if npc.get_inventory_amount(SimulationIds.RESOURCE_FOOD) >= 1.0:
|
||||
return ActionSelectionResult.new(SimulationIds.ACTION_EAT, 1.0)
|
||||
if village.food > 0:
|
||||
return ActionSelectionResult.new(
|
||||
SimulationIds.ACTION_WITHDRAW_FOOD,
|
||||
1.0
|
||||
)
|
||||
return ActionSelectionResult.new(SimulationIds.ACTION_GATHER_FOOD, 4.0)
|
||||
if npc.hunger > 75.0:
|
||||
if village.food > 0:
|
||||
if npc.get_inventory_amount(SimulationIds.RESOURCE_FOOD) >= 1.0:
|
||||
return ActionSelectionResult.new(SimulationIds.ACTION_EAT)
|
||||
if village.food > 0:
|
||||
return ActionSelectionResult.new(SimulationIds.ACTION_WITHDRAW_FOOD)
|
||||
return ActionSelectionResult.new(SimulationIds.ACTION_GATHER_FOOD)
|
||||
if npc.get_inventory_amount(SimulationIds.RESOURCE_FOOD) > 0.0:
|
||||
return ActionSelectionResult.new(SimulationIds.ACTION_DEPOSIT_FOOD)
|
||||
if npc.energy < 25.0:
|
||||
return ActionSelectionResult.new(SimulationIds.ACTION_REST)
|
||||
return ActionSelectionResult.new(_choose_best_work_action(npc, village))
|
||||
|
||||
Reference in New Issue
Block a user