* Maybe configure lights in separate json file, to allow reuse of consistent models in multiple levels?
* Allow going down to zero seeds by buying lights if a turnip is planted
* Maybe make the mould weaker at the start
-* Display average power usage in light tooltip
* Maybe also display information next to existing lights -- tooltip?
* Generally balance the levels better and add more levels
* Graphical level selection with screenshots
* Different prices for different lights
* Calculate both from # of colours, speed, beam width, etc.?
* added tooltips for lights
+* Display average power usage in light tooltip
from .constants import (
LIGHT_CATEGORY, FITTINGS_CATEGORY, OBSTACLE_CATEGORY, TURNIP_CATEGORY,
- COLOURS)
+ COLOURS, FPS, NIGHT_HOURS_PER_TICK)
from .rays import RayPolyManager
from .utils import DetailedTimer
from .loader import loader
@classmethod
def get_info(cls, config):
- return ["intensity: %g" % config["intensity"]]
+ spread = math.radians(config.get("spread", 360))
+ rl = config.get("radius_limits", (0, 50.0))
+ intensity = config["intensity"]
+ power_usage = (cls._power_usage(rl[0], rl[1], spread, intensity)
+ / (FPS * NIGHT_HOURS_PER_TICK))
+ return [
+ "power usage: %d/h" % power_usage,
+ "",
+ "intensity: %g" % intensity,
+ ]
def add(self, space):
if self.body.space is not None:
rx, ry = self.ray_manager.pygame_position(surface)
surface.blit(self.fitting_image(), (rx - self.FITTING_RADIUS, ry - self.FITTING_RADIUS), None, 0)
+ @staticmethod
+ def _power_usage(min_radius, max_radius, spread, intensity):
+ area = math.pi * (max_radius ** 2 - min_radius ** 2) # radius
+ area = area * (spread / (2 * math.pi)) # spread
+ return 5 * area * intensity / 6400 # 80x80 unit area
+
def power_usage(self):
if not self.on:
return 0.0
rm = self.ray_manager
- area = math.pi * (rm.max_radius ** 2 - rm.min_radius ** 2) # radius
- area = area * (rm.spread / (2 * math.pi)) # spread
- return 5 * area * self.intensity / 6400 # 80x80 unit area
+ power_usage = self._power_usage(rm.min_radius, rm.max_radius, rm.spread, self.intensity)
+ return power_usage
def base_damage(self):
return 10 * self.intensity
@classmethod
def get_info(cls, config):
+ spread = math.radians(config.get("spread", 360))
+ rl = config.get("radius_limits", (0, 50.0))
pr = config.get("pulse_range", cls.DEFAULT_PULSE_RANGE)
pv = config.get("pulse_velocity", cls.DEFAULT_PULSE_VELOCITY)
ir = config.get("intensity_range", cls.DEFAULT_INTENSITY_RANGE)
iv = config.get("intensity_velocity", cls.DEFAULT_INTENSITY_VELOCITY)
+ min_power = (cls._power_usage(rl[0], pr[0], spread, ir[0])
+ / (FPS * NIGHT_HOURS_PER_TICK))
+ max_power = (cls._power_usage(rl[0], pr[1], spread, ir[1])
+ / (FPS * NIGHT_HOURS_PER_TICK))
return [
+ "power usage: %d/h - %d/h" % (min_power, max_power),
+ "",
"intensity: %g - %g, velocity %g" % (ir[0], ir[1], iv),
"pulse: %d - %d, velocity %g" % (pr[0], pr[1], pv),
]