Add back light radius checks.
[tabakrolletjie.git] / tabakrolletjie / gamestate.py
1 """ The game state. """
2
3 from .loader import loader
4
5
6 class GameState(object):
7     def __init__(self):
8         self._state = {
9             "station": None,
10             "turnips": [],
11         }
12         self.harvested = 0
13         self.eaten = 0
14
15     @property
16     def station(self):
17         return self._state["station"]
18
19     @property
20     def turnips(self):
21         return self._state["turnips"]
22
23     @turnips.setter
24     def turnips(self, turnip_list):
25         self._state["turnips"] = turnip_list
26
27     @property
28     def seeds(self):
29         if 'seeds' in self._state:
30             return self._state['seeds']
31         elif (self._state["station"] and
32                 'seeds' in self._state["station"]["config"]):
33             self._state['seeds'] = self._state["station"]["config"]["seeds"]
34             return self._state['seeds']
35         return 0
36
37     @seeds.setter
38     def seeds(self, value):
39         self._state['seeds'] = value
40
41     def load_station(self, station):
42         self._state["station"] = loader.load_station(station)