def is_complete(self, agent_id: int): if g_bbm.get_blackboard(agent_id).has_navigation_status(NavStatus.Arrived): bb = g_bbm.get_blackboard(agent_id) job = bb.get_current_job() if g_player.remove_resource(job.extra): return True # failed to retrieve resource -> re-add job and replan g_player.add_job(job) bb.set_request_replan(True) return False
def is_complete(self, agent_id: int): bb = g_bbm.get_blackboard(agent_id) bb.add_progress_time(time.clock.delta) if bb.get_progress_time() > self.construction_time: #print("Produced " + self.target_produce + "!") bb.reset_timed_progress() bb.inventory.clear() bb.produce.append(self.target_produce) job = Job2(JobType.Collect, agent_id, bb.get_position(), self.target_produce) g_player.add_job(job) return True return False
def activate(self, agent_id: int): bb = g_bbm.get_blackboard(agent_id) target = bb.get_production_target() if bb.is_built() else bb.get_entity_str() cost_table = g_prod[target]["CostTable"] bb.set_cost_table(cost_table) drop_off_loc = g_player.get_resource_drop_off_loc() for material, required_amount in cost_table.items(): # current_amount = agent.inventory.count(material) # diff = max(required_amount - current_amount, 0) for x in range(0, required_amount): new_job = None if material == "Worker": structure_pos = bb.get_position() new_job = Job2(JobType.Upgrade, agent_id, structure_pos, material) else: new_job = Job2(JobType.Fetch, agent_id, drop_off_loc, material) g_player.add_job(new_job)
def activate(self, agent_id: int): job = Job2(JobType.Build, agent_id, g_bbm.get_blackboard(agent_id).get_position()) g_player.add_job(job)
def activate(self, agent_id: int): bb = g_bbm.get_blackboard(agent_id) job = Job2(JobType.Work, agent_id, bb.get_position(), bb.get_required_artisan()) g_player.add_job(job)