private void ProcessBoolGrid() { foreach (IntVec3 c in map.AllCells) { boolGrid.Set(c, QuarryUtility.IsValidQuarryTerrain(map.terrainGrid.TerrainAt(c))); } Drawer.SetDirty(); }
public void RemoveFromGrid() { foreach (IntVec3 c in Cells) { boolGrid.Set(c, false); } Drawer.SetDirty(); }
/// <summary> /// Registers the specified comp. /// </summary> /// <param name="comp">The comp.</param> /// <exception cref="ArgumentNullException">comp</exception> public virtual void Register([NotNull] SlurryNetComp comp) { if (comp == null) { throw new ArgumentNullException(nameof(comp)); } _connectors.Add(comp); if (comp is ISlurryNetTrader trader) { _traders.Add(trader); } if (comp is ISlurryNetStorage storage) { _storage.Add(storage); } comp.Network = this; foreach (IntVec3 intVec3 in comp.parent.OccupiedRect().Cells) { _disjointSet.Set(intVec3, true); } #if DEBUG _drawer.SetDirty(); #endif }
private static bool TryGetFreeRect(int width, int height, out CellRect result) { for (int i = overRect.minZ; i <= overRect.maxZ - height; i++) { for (int j = overRect.minX; j <= overRect.maxX - width; j++) { CellRect cellRect = new CellRect(j, i, width, height); bool flag = true; for (int k = cellRect.minZ; k <= cellRect.maxZ; k++) { for (int l = cellRect.minX; l <= cellRect.maxX; l++) { if (usedCells[l, k]) { flag = false; break; } } if (!flag) { break; } } if (!flag) { continue; } result = cellRect; for (int m = cellRect.minZ; m <= cellRect.maxZ; m++) { for (int n = cellRect.minX; n <= cellRect.maxX; n++) { IntVec3 c = new IntVec3(n, 0, m); usedCells.Set(c, value: true); if (c.GetTerrain(Find.CurrentMap).passability == Traversability.Impassable) { Map.terrainGrid.SetTerrain(c, TerrainDefOf.Concrete); } } } return(true); } } result = new CellRect(0, 0, width, height); return(false); }
public virtual void Register(CompGas comp) { connectors.Add(comp); if (comp is CompGasTrader trader) { traders.Add(trader); } if (comp is CompGasStorage storage) { storages.Add(storage); } comp.Network = this; foreach (var cell in comp.parent.OccupiedRect().Cells) { netGrid.Set(cell, true); } #if DEBUG drawer.SetDirty(); #endif }