X-Git-Url: https://plomlompom.com/repos/feed.xml?a=blobdiff_plain;f=new%2Fplomrogue%2Fthings.py;h=20ce4867c2211882b506de309d8881eb16842379;hb=787d769e0c0f2d2fc50800b60b4bcfd506bedba2;hp=9bc84907bb757fe0251b47ca7808f1d64cebe4a2;hpb=76d1e8d03aea96af9339c0021922ac314c0c2a5c;p=plomrogue2-experiments diff --git a/new/plomrogue/things.py b/new/plomrogue/things.py index 9bc8490..20ce486 100644 --- a/new/plomrogue/things.py +++ b/new/plomrogue/things.py @@ -5,7 +5,7 @@ from plomrogue.errors import GameError class ThingBase: type_ = '?' - def __init__(self, world, id_=None, position=[0,0]): + def __init__(self, world, id_=None, position=(0,0)): self.world = world self.position = position if id_ is None: @@ -149,6 +149,16 @@ class ThingAnimate(Thing): visible_things += [thing] return visible_things + def get_pickable_items(self): + pickable_ids = [] + for t in [t for t in self.get_visible_things() if + isinstance(t, ThingItem) and + (t.position == self.position or + t.position in + self.world.map_.get_neighbors(self.position).values())]: + pickable_ids += [t.id_] + return pickable_ids + class ThingHuman(ThingAnimate):