X-Git-Url: https://plomlompom.com/repos/?a=blobdiff_plain;f=new%2Fplomrogue%2Fthings.py;h=07c626525cf4ca2c94dcfe4011bcf219837665bf;hb=e3992a6473984ae21445b1ab9e28976ace474a0c;hp=b64584182f31e3b322a3cd2b1c0e7f6c5a144fde;hpb=298e8d0b4c7529ee4ad35005ad9bb9295def1086;p=plomrogue2-experiments diff --git a/new/plomrogue/things.py b/new/plomrogue/things.py index b645841..07c6265 100644 --- a/new/plomrogue/things.py +++ b/new/plomrogue/things.py @@ -80,7 +80,8 @@ class ThingAnimate(Thing): return target_direction def hunt_player(self): - visible_things, offset = self.get_visible_things() + visible_things = self.get_visible_things() + offset = self.get_surroundings_offset() target = None for t in visible_things: if t.type_ == 'human': @@ -111,7 +112,8 @@ class ThingAnimate(Thing): if t.type_ == 'food': self.set_task('PICKUP', (id_,)) return True - visible_things, offset = self.get_visible_things() + visible_things = self.get_visible_things() + offset = self.get_surroundings_offset() food_targets = [] for t in visible_things: if t.type_ == 'food': @@ -270,15 +272,16 @@ class ThingAnimate(Thing): small_pos = thing.position[1] pos_y = calc_pos_in_fov(big_pos[0], small_pos[0], offset[0], size[0]) pos_x = calc_pos_in_fov(big_pos[1], small_pos[1], offset[1], size[1]) - if pos_y < 0 or pos_x < 0 or pos_y >= fov_size[0] or pos_x >= fov_size[1]: + if pos_y < 0 or pos_x < 0 or\ + pos_y >= fov_size[0] or pos_x >= fov_size[1]: continue if (not thing.in_inventory) and stencil[(pos_y, pos_x)] == '.': visible_things += [thing] - return visible_things, offset + return visible_things def get_pickable_items(self): pickable_ids = [] - visible_things, _ = self.get_visible_things() + visible_things = self.get_visible_things() for t in [t for t in visible_things if isinstance(t, ThingItem) and (t.position == self.position or