Example #1
0
		// Range: -1 Access: 0 Flags: ( 0, 4, 255 )
		public static Powernet merge_powernets( Powernet net1 = null, Powernet net2 = null ) {
			Powernet temp = null;
			Ent_Structure_Cable Cable = null;
			Ent_Machinery_Power Node = null;
			if ( !( net1 != null ) || !( net2 != null ) ) {
				return null;
			}
			if ( net1 == net2 ) {
				return null;
			}
			if ( net1.cables.len < net2.cables.len ) {
				temp = net1;
				net1 = net2;
				net2 = temp;
			}
			Cable = null;
			foreach (dynamic _a in net2.cables ) {
				if ( !( _a is Ent_Structure_Cable ) ) {
					continue;
				}
				Cable = _a;
				net1.add_cable( Cable );
			};
			Node = null;
			foreach (dynamic _b in net2.nodes ) {
				if ( !( _b is Ent_Machinery_Power ) ) {
					continue;
				}
				Node = _b;
				if ( !Node.connect_to_network() ) {
					Node.disconnect_from_network();
				}
			};
			return net1;
		}
Example #2
0
		// Range: -1 Access: 0 Flags: ( 0, 4, 255 )
		public static void propagate_network( dynamic O = null, Powernet PN = null ) {
			ByTable worklist = null;
			ByTable found_machines = null;
			int index = 0;
			dynamic P = null;
			dynamic C = null;
			dynamic M = null;
			Ent_Machinery_Power PM = null;
			worklist = new ByTable();
			found_machines = new ByTable();
			index = 1;
			P = null;
			worklist += O;
			while (index <= worklist.len) {
				P = worklist[index];
				index++;
				if ( P is Ent_Structure_Cable ) {
					C = P;
					if ( C.powernet != PN ) {
						PN.add_cable( C );
					}
					worklist |= ((Ent_Structure_Cable)C).get_connections();
				} else if ( Lang13.Bool( P.anchored ) && P is Ent_Machinery_Power ) {
					M = P;
					found_machines |= M;
				} else {
					continue;
				}
			}
			PM = null;
			foreach (dynamic _a in found_machines ) {
				if ( !( _a is Ent_Machinery_Power ) ) {
					continue;
				}
				PM = _a;
				if ( !PM.connect_to_network() ) {
					PM.disconnect_from_network();
				}
			};
			return;
		}