-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
+4 -4
View File
@@ -99,7 +99,7 @@
for(var/obj/machinery/power/M in machines)
if(!M.powernet) continue // APCs have powernet=0 so they don't count as network nodes directly
M.powernet.nodes += M
M.powernet.nodes[M] = M
// returns a list of all power-related objects (nodes, cable, junctions) in turf,
@@ -274,7 +274,7 @@
if(Node && !Node.powernet)
Node.powernet = PN
nodes.Cut(i,i+1)
PN.nodes += Node
PN.nodes[Node] = Node
continue
i++
@@ -364,7 +364,7 @@
var/obj/machinery/power/Node = net2.nodes[i]
if(Node)
Node.powernet = net1
net1.nodes += Node
net1.nodes[Node] = Node
for(var/i=1,i<=net2.cables.len,i++)
var/obj/structure/cable/Cable = net2.cables[i]
@@ -382,7 +382,7 @@
if(!C || !C.powernet) return
// makepowernets() //TODO: find fast way //EWWWW what are you doing!?
powernet = C.powernet
powernet.nodes += src
powernet.nodes[src] = src
/obj/machinery/power/proc/disconnect_from_network()
if(!powernet) return