from ..constants import SCREEN_SIZE, FONTS, DEBUG
from ..widgets import ImageButton
-from ..turnip import Turnip, TurnipInvalidPosition
+from ..turnip import Turnip, TurnipInvalidPosition, check_turnips
class DayScene(BaseScene):
# Bail if we're too close to an existing light
if self._lights.nearest(pos, max_distance=25):
return
+ # Also check turnips
+ if check_turnips(self._space, pos, max_distance=25):
+ return
gamestate.seeds -= cost
cfg["position"] = pos
cfg["colours"] = colours
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