Check that we're not placing lights on top of turnips
[tabakrolletjie.git] / tabakrolletjie / turnip.py
index b67196a525da4d00d19c024aee3880399194a49c..72705fccdf7aa18e3548357ffc14954e0d9a41a8 100644 (file)
@@ -14,6 +14,14 @@ TURNIP_FILTER = pymunk.ShapeFilter(
     categories=TURNIP_CATEGORY)
 
 
+def check_turnips(space, pos, max_distance):
+    point_info = space.point_query_nearest(
+        pos, max_distance, pymunk.ShapeFilter(mask=TURNIP_CATEGORY))
+    if point_info is not None:
+        return True
+    return False
+
+
 class TurnipInvalidPosition(Exception):
     pass