home · contact · privacy
To client, add map examining cursor.
[plomrogue2-experiments] / new / plomrogue / things.py
index 9bc84907bb757fe0251b47ca7808f1d64cebe4a2..20ce4867c2211882b506de309d8881eb16842379 100644 (file)
@@ -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):