private void PlaceDiggables() { if (waitForFetchesBeforeDigging && fetchList != null && !hasLadderNearby) { OnDiggableReachabilityChanged(null); } else { bool digs_complete = true; if (!solidPartitionerEntry.IsValid()) { Extents validPlacementExtents = building.GetValidPlacementExtents(); solidPartitionerEntry = GameScenePartitioner.Instance.Add("Constructable.OnFetchListComplete", base.gameObject, validPlacementExtents, GameScenePartitioner.Instance.solidChangedLayer, OnSolidChangedOrDigDestroyed); digPartitionerEntry = GameScenePartitioner.Instance.Add("Constructable.OnFetchListComplete", base.gameObject, validPlacementExtents, GameScenePartitioner.Instance.digDestroyedLayer, OnSolidChangedOrDigDestroyed); } if (!IsReplacementTile) { building.RunOnArea(delegate(int offset_cell) { PrioritySetting masterPriority = GetComponent <Prioritizable>().GetMasterPriority(); if (Diggable.IsDiggable(offset_cell)) { digs_complete = false; Diggable diggable = Diggable.GetDiggable(offset_cell); if ((UnityEngine.Object)diggable == (UnityEngine.Object)null) { diggable = GameUtil.KInstantiate(Assets.GetPrefab(new Tag("DigPlacer")), Grid.SceneLayer.Move, null, 0).GetComponent <Diggable>(); diggable.gameObject.SetActive(true); diggable.transform.SetPosition(Grid.CellToPosCBC(offset_cell, Grid.SceneLayer.Move)); diggable.Subscribe(-1432940121, OnDiggableReachabilityChanged); Grid.Objects[offset_cell, 7] = diggable.gameObject; } else { diggable.Unsubscribe(-1432940121, OnDiggableReachabilityChanged); diggable.Subscribe(-1432940121, OnDiggableReachabilityChanged); } diggable.choreTypeIdHash = Db.Get().ChoreTypes.BuildDig.IdHash; diggable.GetComponent <Prioritizable>().SetMasterPriority(masterPriority); RenderUtil.EnableRenderer(diggable.transform, false); SaveLoadRoot component = diggable.GetComponent <SaveLoadRoot>(); if ((UnityEngine.Object)component != (UnityEngine.Object)null) { UnityEngine.Object.Destroy(component); } } }); OnDiggableReachabilityChanged(null); } bool flag = building.Def.IsValidBuildLocation(base.gameObject, base.transform.GetPosition(), building.Orientation); if (flag) { notifier.Remove(invalidLocation); } else { notifier.Add(invalidLocation, string.Empty); } GetComponent <KSelectable>().ToggleStatusItem(Db.Get().BuildingStatusItems.InvalidBuildingLocation, !flag, this); bool flag2 = digs_complete && flag && fetchList == null; if (flag2 && buildChore == null) { buildChore = new WorkChore <Constructable>(Db.Get().ChoreTypes.Build, this, null, true, UpdateBuildState, UpdateBuildState, UpdateBuildState, true, null, false, true, null, true, true, true, PriorityScreen.PriorityClass.basic, 5, false, true); UpdateBuildState(buildChore); } else if (!flag2 && buildChore != null) { buildChore.Cancel("Need to dig"); buildChore = null; } } }