-Changed the powernet nodes list to be a dictionary list (associative list, hashtable, etc..)

-Added a solars_list. The sun will use this list instead of the machines list. I made a proc which decided on whether to use this list or the powernet nodes list depending on what is smallest. I replaced some loops to use this proc.
-The sun will reference this list for debugging purposes. The sun will also remove solar equipment in the list which are not connected to a powernet.
-Cut down on some duplicated code.
-Fixed an issue with solar panels not updating their direction correctly.
-Changed the proc updateicon()'s name to update_icon()

git-svn-id: http://tgstation13.googlecode.com/svn/trunk@5418 316c924e-a436-60f5-8080-3fe189b3f50e
This commit is contained in:
giacomand@gmail.com
2012-12-29 07:24:42 +00:00
parent 370ab8ebf9
commit 7af60a7fb5
7 changed files with 116 additions and 66 deletions
+13 -7
View File
@@ -11,6 +11,7 @@
anchored = 1
density = 1
directwired = 1
use_power = 0
var/sun_angle = 0 // sun angle as set by sun datum
@@ -24,6 +25,14 @@
S.loc = src
connect_to_network()
/obj/machinery/power/tracker/disconnect_from_network()
..()
solars_list.Remove(src)
/obj/machinery/power/tracker/connect_to_network()
..()
solars_list.Add(src)
// called by datum/sun/calc_position() as sun's angle changes
/obj/machinery/power/tracker/proc/set_angle(var/angle)
sun_angle = angle
@@ -39,9 +48,10 @@
// 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)
if(get_dist(C, src) < SOLAR_MAX_DIST)
C.tracker_update(angle)
for(var/obj/machinery/power/solar_control/C in get_solars_powernet())
if(powernet.nodes[C])
if(get_dist(C, src) < SOLAR_MAX_DIST)
C.tracker_update(angle)
/obj/machinery/power/tracker/attackby(var/obj/item/weapon/W, var/mob/user)
@@ -71,10 +81,6 @@
else
stat |= NOPOWER
// override power change to do nothing since we don't care about area power
/obj/machinery/power/tracker/power_change()
return
// Tracker Electronic