X-Git-Url: https://git.ctpug.org.za/?p=tabakrolletjie.git;a=blobdiff_plain;f=tabakrolletjie%2Fscenes%2Fday.py;h=be8642509d5a4418a74e53c550e3bfef09a12e7e;hp=cc7a32e1cf1b1b41cd2bb6508f90f9159fd597f5;hb=4b40709e4dcc9c9924a93f6c4b5cfd8217c4d2af;hpb=d222b3e3c02b3cfb3ddcd665f6c0a21619f25223 diff --git a/tabakrolletjie/scenes/day.py b/tabakrolletjie/scenes/day.py index cc7a32e..be86425 100644 --- a/tabakrolletjie/scenes/day.py +++ b/tabakrolletjie/scenes/day.py @@ -11,7 +11,7 @@ import pymunk.pygame_util from .base import BaseScene from ..battery import BatteryManager -from ..lights import LightManager, light_fitting_by_type +from ..lights import LightManager, light_fitting_by_type, check_space_for_light from ..infobar import InfoBar from ..obstacles import ObstacleManager from ..events import SceneChangeEvent @@ -21,7 +21,7 @@ from ..transforms import Overlay, Alpha, ColourWedges from ..constants import SCREEN_SIZE, FONTS, FPS, NIGHT_HOURS_PER_TICK, DEBUG from ..widgets import ImageButton -from ..turnip import Turnip, TurnipInvalidPosition, check_turnips +from ..turnip import Turnip, TurnipInvalidPosition class DayScene(BaseScene): @@ -215,11 +215,8 @@ class DayScene(BaseScene): if gamestate.seeds > cost: pos = pymunk.pygame_util.from_pygame( ev.pos, pygame.display.get_surface()) - # 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): + # Bail if we're too close to an existing light, obstacle or turnip + if check_space_for_light(self._space, pos, max_distance=25): return gamestate.seeds -= cost cfg["position"] = pos