private void UpdateVis(Vector3 pos) { bool flag = def.IsValidPlaceLocation(visualizer, pos, buildingOrientation, out string _); bool flag2 = def.IsValidReplaceLocation(pos, buildingOrientation, def.ReplacementLayer, def.ObjectLayer); flag = (flag || flag2); if ((Object)visualizer != (Object)null) { Color c = Color.white; float strength = 0f; if (!flag) { c = Color.red; strength = 1f; } SetColor(visualizer, c, strength); } int num = Grid.PosToCell(pos); if ((Object)def != (Object)null) { Vector3 vector = Grid.CellToPosCBC(num, def.SceneLayer); visualizer.transform.SetPosition(vector); base.transform.SetPosition(vector - Vector3.up * 0.5f); if (def.IsTilePiece) { ClearTilePreview(); if (Grid.IsValidBuildingCell(num)) { GameObject gameObject = Grid.Objects[num, (int)def.TileLayer]; if ((Object)gameObject == (Object)null) { Grid.Objects[num, (int)def.TileLayer] = visualizer; } if (def.isKAnimTile) { GameObject x = null; if (def.ReplacementLayer != ObjectLayer.NumLayers) { x = Grid.Objects[num, (int)def.ReplacementLayer]; } if ((Object)gameObject == (Object)null || ((Object)gameObject.GetComponent <Constructable>() == (Object)null && (Object)x == (Object)null)) { TileVisualizer.RefreshCell(num, def.TileLayer, def.ReplacementLayer); if ((Object)def.BlockTileAtlas != (Object)null) { int renderLayer = LayerMask.NameToLayer("Overlay"); BlockTileRenderer blockTileRenderer = World.Instance.blockTileRenderer; blockTileRenderer.SetInvalidPlaceCell(num, !flag); if (lastCell != num) { blockTileRenderer.SetInvalidPlaceCell(lastCell, false); } blockTileRenderer.AddBlock(renderLayer, def, flag2, SimHashes.Void, num); } } } } } if (lastCell != num) { lastCell = num; } } }