private void FindClimbableTree() { climbTarget = null; ListPool <ScenePartitionerEntry, GameScenePartitioner> .PooledList pooledList = ListPool <ScenePartitionerEntry, GameScenePartitioner> .Allocate(); ListPool <KMonoBehaviour, ClimbableTreeMonitor> .PooledList pooledList2 = ListPool <KMonoBehaviour, ClimbableTreeMonitor> .Allocate(); Vector3 position = base.master.transform.GetPosition(); Extents extents = new Extents(Grid.PosToCell(position), 10); GameScenePartitioner.Instance.GatherEntries(extents, GameScenePartitioner.Instance.plants, pooledList); GameScenePartitioner.Instance.GatherEntries(extents, GameScenePartitioner.Instance.completeBuildings, pooledList); Navigator component = GetComponent <Navigator>(); foreach (ScenePartitionerEntry item in pooledList) { KMonoBehaviour kMonoBehaviour = item.obj as KMonoBehaviour; if (!kMonoBehaviour.HasTag(GameTags.Creatures.ReservedByCreature)) { int cell = Grid.PosToCell(kMonoBehaviour); if (component.CanReach(cell)) { BuddingTrunk component2 = kMonoBehaviour.GetComponent <BuddingTrunk>(); StorageLocker component3 = kMonoBehaviour.GetComponent <StorageLocker>(); if ((Object)component2 != (Object)null) { if (!component2.ExtraSeedAvailable) { continue; } } else { if (!((Object)component3 != (Object)null)) { continue; } Storage component4 = component3.GetComponent <Storage>(); if (!component4.allowItemRemoval || component4.IsEmpty()) { continue; } } pooledList2.Add(kMonoBehaviour); } } } if (pooledList2.Count > 0) { int index = Random.Range(0, pooledList2.Count); KMonoBehaviour kMonoBehaviour2 = pooledList2[index]; climbTarget = kMonoBehaviour2.gameObject; } pooledList.Recycle(); pooledList2.Recycle(); }
static void Postfix(StorageLocker __instance) { if (!Main.enabled) { return; } var building = __instance.GetComponent <Building>(); Main.SetCapacity(building, true); }