tgstation/-tg-station — pull request #3453 by Menshin (2014-04-19 11:51:37+00:00)
Title: Sun and solars

Suns and solars tweaking

I've cleaned up/updated the _sun and solars_ code with the following changes :

The sun

* the sun now has a rotation based on _timeofday_ instead of an internal counter and _realtime_.
That makes synchronizing easier (since solars are based on _timeofday_),
* the sun standard rotation rate is a full rotation in one (real time) hour,
* every (real time) minute, the sun position, the auto/manual tracking and the solars occlusion are updated,
* the sun rotation rate is randomized at round start (50%-200% of standard rotation, i.e from half as slow to twice as fast),
* the sun can rotate clockwise or counter-clockwise,
* the sun starting position is randomized at round start

Solars

* Panels calculate the shortest rotation to get from their position to another.
(that fixed the bug where the panel would backtrack all the way when finishing a full rotation (e.g 355° to 1°)
* The exposition to the sun of a panel is now correctly calculated (fixed the bug, where
if the sun was, for example, at 1° and the panel at 359°, no light would arrived to the panel)
* Tweaked manual tracking for better accuracy : the orientation is increased/decrease internally and updated altogether the sun.
* Panels made with reinforced glass now have the double of health
* Added a message notifying the beginning of a solar panel/tracker deconstruction

Code

* now checking if the solar panel/tracker/computer is not already in the solars_list before adding it (that should avoid clogging the solars list every time the power nets are remade)
* midnight rollover for timeofday is taken into account

__tl;dr__ : manual tracking is now possible and solars are now working as intended