Files
vgstation13/code/modules/power/tracker.dm
baloh.matevz a3d9123edd - Added a sprite "7" to the sd lighting file as it was used, even if it didn't exist.
- Piped 3.0.0 a bit.
- Standardized code/modules/power. 

git-svn-id: http://tgstation13.googlecode.com/svn/trunk@4242 316c924e-a436-60f5-8080-3fe189b3f50e
2012-07-31 05:24:37 +00:00

50 lines
1.4 KiB
Plaintext

//Solar tracker
//Machine that tracks the sun and reports it's direction to the solar controllers
//As long as this is working, solar panels on same powernet will track automatically
/obj/machinery/power/tracker
name = "solar tracker"
desc = "A solar directional tracker."
icon = 'icons/obj/power.dmi'
icon_state = "tracker"
anchored = 1
density = 1
directwired = 1
var/sun_angle = 0 // sun angle as set by sun datum
// called by datum/sun/calc_position() as sun's angle changes
/obj/machinery/power/tracker/proc/set_angle(var/angle)
sun_angle = angle
//set icon dir to show sun illumination
dir = turn(NORTH, -angle - 22.5) // 22.5 deg bias ensures, e.g. 67.5-112.5 is EAST
// check we can draw power
if(stat & NOPOWER)
return
// find all solar controls and update them
// currently, just update all controllers in world
// ***TODO: better communication system using network
if(powernet)
for(var/obj/machinery/power/solar_control/C in powernet.nodes)
C.tracker_update(angle)
// timed process
// make sure we can draw power from the powernet
/obj/machinery/power/tracker/process()
var/avail = surplus()
if(avail > 500)
add_load(500)
stat &= ~NOPOWER
else
stat |= NOPOWER
// override power change to do nothing since we don't care about area power
/obj/machinery/power/tracker/power_change()
return