home · contact · privacy
Allow item-in-vicinity selection for item pickup.
[plomrogue2-experiments] / new / plomrogue / things.py
index a631b174f9292dde5ab047b98836bd2820939137..20ce4867c2211882b506de309d8881eb16842379 100644 (file)
@@ -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):