public void RegisterRelay(CompRTQuantumRelay compRelay) { if (!compRelays.Contains(compRelay)) { compRelays.Add(compRelay); } }
private void SendItemsToRelay() { CompRTQuantumRelay compRelay = compRelays[qrIndex]; if (compRelay != null) { bool itemSent = false; if (compStockpiles.Count != 0) { CompRTQuantumStockpile compStockpile = compStockpiles.RandomElement(); foreach (IntVec3 stockpileCell in compStockpile.parent.OccupiedRect().Cells) { List <Thing> stockpileThings = stockpileCell.GetItemList(); for (int i = 0; i < stockpileThings.Count; i++) { Thing stockpileThing = stockpileThings[i]; if (stockpileCell.AllowedToAccept(stockpileThing) && compRelay.ReceiveThing(stockpileThing)) { itemSent = true; break; } } if (itemSent) { break; } } } if (!itemSent && compChunkSilos.Count != 0) { CompRTQuantumChunkSilo compChunkSilo = compChunkSilos.RandomElement(); foreach (IntVec3 chunkSiloCell in compChunkSilo.parent.OccupiedRect().Cells) { List <Thing> chunkSiloThings = chunkSiloCell.GetItemList(true); for (int i = 0; i < chunkSiloThings.Count; i++) { Thing chunkSiloThing = chunkSiloThings[i]; if (chunkSiloCell.AllowedToAccept(chunkSiloThing) && compRelay.ReceiveThing(chunkSiloThing)) { itemSent = true; break; } } if (itemSent) { break; } } } } }
public void DeRegisterRelay(CompRTQuantumRelay compRelay) { compRelays.Remove(compRelay); }