def __init__(self, what, where): Goal.__init__(self, "fetch a thing", self.is_it_in_my_inventory, [MoveMeArea(where, 20), SpotSomething(what), PickUpFocus(what)]) self.what = what self.vars = ["what"]
def __init__(self, what): Goal.__init__( self, "forage for food by name", self.am_i_full, [SpotSomething(what, range=5), PickUpFocus(what), self.eat]) self.what = what self.range = 5 self.full = 0.2 self.vars = ["what", "range"]
def __init__(self, what, max_amount=1, distance=30): Goal.__init__( self, "gather a thing", self.is_there_none_around, [SpotSomething(what), PickUpFocus(what)]) if isinstance(what, str): self.what = what else: self.what = str(what) # FIXME: This goal shares the same filter as spot_something self.filter = entity_filter.Filter(self.what) self.max_amount = max_amount self.distance = distance self.vars = ["what", "max_amount", "distance"]