Modify farm and fishtrap code slightly

This commit is contained in:
Nate Bowman
2026-11-08 20:51:38 -05:00
parent c6254e6d1e
commit e03911b78a
3 changed files with 42 additions and 56 deletions

View File

@@ -43,8 +43,6 @@ class World():
# to farms with the highest capacity.
# We keep track of only the closest upcoming farm deletion.
# TODO make used* and unused* into single dict w/ task as key
# TODO gather.consumable_building_tasks
# TODO require market to use market buy/sell
# TODO what happens if you take away a builder while building?
# TODO allow automation:
@@ -122,7 +120,7 @@ class World():
if next_decrease is not None:
next_decrease += self.current_time
if task in [Tasks.FARM, Tasks.FISH_SHIP_TRAP]:
if task in Gather.FARM_LIKE_TASKS:
self.events[next_decrease].append((self._remove_consumable_building,
(task,)))
else:
@@ -194,10 +192,10 @@ class World():
self.villager_tasks[previous_task] -= count
if previous_task in [Tasks.FARM, Tasks.FISH_SHIP_TRAP]:
if previous_task in Gather.FARM_LIKE_TASKS:
self.gather.stop_using_consumable_buildings(previous_task, count)
if new_task in [Tasks.FARM, Tasks.FISH_SHIP_TRAP]:
if new_task in Gather.FARM_LIKE_TASKS:
self.gather.start_using_consumable_buildings(new_task, count)
self._schedule_next_gather_rate_decrease(previous_task)
@@ -318,7 +316,7 @@ class World():
if building == Buildings.HOUSE:
self._free_housing()
if building in [Buildings.FARM, Buildings.FISHTRAP]:
if building in Gather.FARM_LIKE_BUILDINGS:
self.gather.add_consumable_building(building)
else:
self._improve_gather_rate_by_building(building, tasks_improved)