Ejemplo n.º 1
0
 private void QuantumRelayTick(int tickAmount)
 {
     if ((Find.TickManager.TicksGame + tickStagger) % tickAmount == 0)
     {
         if (compPowerTrader == null || compPowerTrader.PowerOn)
         {
             if (compWarehouse != null &&
                 compWarehouse.parent != null &&
                 !compWarehouse.parent.Destroyed &&
                 compWarehouse.IsValid())
             {
                 if (!registered)
                 {
                     compWarehouse.RegisterRelay(this);
                     registered = true;
                 }
                 else
                 {
                     if (cellIndex >= cells.Count)
                     {
                         cellIndex = 0;
                     }
                     ProcessCell(cells[cellIndex]);
                     cellIndex++;
                 }
             }
             else
             {
                 registered = false;
                 if (compWarehouse != null)
                 {
                     compWarehouse.DeRegisterRelay(this);
                 }
             }
         }
         else
         {
             registered = false;
             if (compWarehouse != null)
             {
                 compWarehouse.DeRegisterRelay(this);
             }
         }
     }
 }
Ejemplo n.º 2
0
 private void QuantumStockpileTick(int tickAmount)
 {
     if ((Find.TickManager.TicksGame + tickStagger) % tickAmount == 0)
     {
         if ((compPowerTrader == null || compPowerTrader.PowerOn) &&
             parent.OccupiedRect().CenterCell.Priority(parent.Map) != StoragePriority.Unstored)
         {
             if (compWarehouse == null)
             {
                 compWarehouse = parent.FindWarehouse();
                 if (compWarehouse != null)
                 {
                     compWarehouse.RegisterStockpile(this);
                 }
             }
             else
             {
                 if (compWarehouse.parent == null || compWarehouse.parent.Destroyed || !compWarehouse.IsValid())
                 {
                     compWarehouse.DeRegisterStockpile(this);
                     compWarehouse = null;
                 }
             }
             if (cellIndex >= cells.Count)
             {
                 cellIndex = 0;
                 if (compWarehouse == null)
                 {
                     DefragStacks();
                 }
                 else
                 {
                     ProcessCell(cells[cellIndex]);
                     cellIndex++;
                 }
             }
             else
             {
                 ProcessCell(cells[cellIndex]);
                 cellIndex++;
             }
         }
         else
         {
             if (compWarehouse != null)
             {
                 compWarehouse.DeRegisterStockpile(this);
                 compWarehouse = null;
             }
         }
     }
 }