diff --git a/code/modules/power/power.dm b/code/modules/power/power.dm index 3f3fae0190a..2ad898087fb 100644 --- a/code/modules/power/power.dm +++ b/code/modules/power/power.dm @@ -230,7 +230,8 @@ i=1 while(i<=nodes.len) var/obj/machinery/power/Node = nodes[i] - if(Node) Node.powernet = null + if(Node) + Node.powernet = null i++ // remove the cut cable from the network @@ -312,7 +313,7 @@ var/numapc = 0 - if(nodes) // Added to fix a bad list bug -- TLE + if(nodes && nodes.len) // Added to fix a bad list bug -- TLE for(var/obj/machinery/power/terminal/term in nodes) if( istype( term.master, /obj/machinery/power/apc ) ) numapc++ @@ -323,8 +324,13 @@ netexcess = avail - load if( netexcess > 100) // if there was excess power last cycle - for(var/obj/machinery/power/smes/S in nodes) // find the SMESes in the network - S.restore() // and restore some of the power that was used + if(nodes && nodes.len) + for(var/obj/machinery/power/smes/S in nodes) // find the SMESes in the network + if(S.powernet == src) + S.restore() // and restore some of the power that was used + else + error("[S.name] (\ref[S]) had a [S.powernet ? "different (\ref[S.powernet])" : "null"] powernet to our powernet (\ref[src]).") + nodes.Remove(S) /datum/powernet/proc/get_electrocute_damage() switch(avail)/* diff --git a/code/modules/power/smes.dm b/code/modules/power/smes.dm index 10b7fde1d08..13ebccd4f0d 100644 --- a/code/modules/power/smes.dm +++ b/code/modules/power/smes.dm @@ -119,10 +119,7 @@ if(last_disp != chargedisplay() || last_chrg != charging || last_onln != online) updateicon() - for(var/mob/M in viewers(1, src)) - if ((M.client && M.machine == src)) - src.interact(M) - AutoUpdateAI(src) + updateDialog() return // called after all power processes are finished @@ -367,3 +364,4 @@ return rate +#undef SMESRATE \ No newline at end of file