Revert "Allow hunting and building as initial villager tasks"

This reverts commit 8a8effe3d1.
I did not like adding kwargs in so many places, so there will be an
upcoming commit that implements the same change in a different way.
This commit is contained in:
Nate Bowman
2026-11-15 16:58:49 -05:00
parent 8a8effe3d1
commit 7ce4b4a150
3 changed files with 41 additions and 134 deletions

View File

@@ -34,99 +34,78 @@ class Gameplay():
self.actions[action_time].append((self.world.build,
(building,
villagers_from,
villagers_to,),
{}))
villagers_to,)))
def market_buy(self, action_time, resource, amount):
self._check_time(action_time)
self.actions[action_time].append((self.world.market_buy,
(resource, amount),
{}))
(resource, amount)))
def market_sell(self, action_time, resource, amount):
self._check_time(action_time)
self.actions[action_time].append((self.world.market_sell,
(resource, amount),
{}))
(resource, amount)))
def queue_research(self, action_time, research):
self._check_time(action_time)
self.actions[action_time].append((self.world.queue_research,
(research,),
{}))
(research,)))
def queue_villagers_over_time(self,
from_time,
until_time,
initial_task,
**kwargs):
def queue_villagers_over_time(self, from_time, until_time, initial_task):
train_time = self.world.build_times.build_times[Units.VILLAGER]
duration = max(0, until_time - from_time)
for i in range(duration//train_time + 1):
self.queue_villager(from_time + i*train_time,
initial_task,
**kwargs)
self.queue_villager(from_time + i*train_time, initial_task)
def queue_villager(self, action_time, initial_task, **kwargs):
def queue_villager(self, action_time, initial_task):
self._check_time(action_time)
self.actions[action_time].append((self.world.queue_villager,
(initial_task,),
kwargs))
(initial_task,)))
def queue_fishing_ship(self, action_time, initial_task=Tasks.FISH_SHIP_DEEP):
self._check_time(action_time)
self.actions[action_time].append((self.world.queue_fishing_ship,
(initial_task,),
{}))
(initial_task,)))
def queue_trade_cog(self, action_time):
self._check_time(action_time)
self.actions[action_time].append((self.world.queue_trade_cog,
(),
{}))
self.actions[action_time].append((self.world.queue_trade_cog, ()))
def queue_trade_cart(self, action_time):
self._check_time(action_time)
self.actions[action_time].append((self.world.queue_trade_cart,
(),
{}))
self.actions[action_time].append((self.world.queue_trade_cart, ()))
def queue_unit(self, action_time, unit):
self._check_time(action_time)
self.actions[action_time].append((self.world.queue_unit,
(unit,),
{}))
self.actions[action_time].append((self.world.queue_unit, (unit,)))
def assign_villager(self, action_time, old_task, new_task, count=1):
self._check_time(action_time)
self.actions[action_time].append((self.world.assign_villager,
(old_task, new_task, count,),
{}))
(old_task, new_task, count,)))
def get_relic(self, action_time, walking_time=60):
self._check_time(action_time)
self.actions[action_time].append((self.world.get_relic,
(walking_time,),
{}))
(walking_time,)))
def set_housed_is_error(self, action_time, is_error=True):
self._check_time(action_time)
self.actions[action_time].append((self.world.set_housed_is_error,
(is_error,),
{}))
(is_error,)))
def lure_huntable_with_villager(self,
@@ -135,15 +114,12 @@ class Gameplay():
walking_time=30):
self._check_time(action_time)
self.actions[action_time].append((self.world.lure_huntable_with_villager,
(previous_task, walking_time),
{}))
(previous_task, walking_time)))
def increase_age(self, action_time):
self._check_time(action_time)
self.actions[action_time].append((self.world.increase_age,
(),
{}))
self.actions[action_time].append((self.world.increase_age, ()))
def _check_time(self, action_time):
@@ -174,12 +150,12 @@ class Gameplay():
def _handle_actions(self):
for func, args, kwargs in self.actions[self.world.current_time]:
for func, args in self.actions[self.world.current_time]:
try:
func(*args, **kwargs)
func(*args)
except Exception as e:
raise type(e)(
f'Error in {func.__name__}{args}{kwargs}'
f'Error in {func.__name__}{args}'
f' at time {self.world.current_time}.') from e
del self.actions[self.world.current_time]