// Token: 0x06002BA1 RID: 11169 RVA: 0x00104660 File Offset: 0x00102860 public static void CacheBounds(Transform transform, GameObject target, List <OrientedBounds> results, bool append = false) { if (!append) { results.Clear(); } if (target == null) { return; } ConstructableBounds[] componentsInChildren = target.GetComponentsInChildren <ConstructableBounds>(); for (int i = 0; i < componentsInChildren.Length; i++) { ConstructableBounds constructableBounds = componentsInChildren[i]; OrientedBounds localBounds = constructableBounds.bounds; OrientedBounds orientedBounds = OrientedBounds.ToWorldBounds(constructableBounds.transform, localBounds); if (transform != null) { orientedBounds = OrientedBounds.ToLocalBounds(transform, orientedBounds); } results.Add(orientedBounds); } }
static void Prefix(ConstructableBase __instance, bool value) { if (Config.Instance.habitantModulesPartialBurying) { if (__instance._constructed != value && value) { var constructableBoundsList = new List <ConstructableBounds>(); __instance.GetComponentsInChildren(true, constructableBoundsList); var hasAnyOverlappedTerrainObstacles = false; var orientedBoundsList = constructableBoundsList.Select(constructableBounds => OrientedBounds.ToWorldBounds(constructableBounds.transform, constructableBounds.bounds)); foreach (var orientedBounds in orientedBoundsList) { Logger.Debug($"Checking oriented bounds: {orientedBounds}"); var overlappedObjects = new List <GameObject>(); Builder.GetOverlappedObjects(orientedBounds.position, orientedBounds.rotation, orientedBounds.extents, overlappedObjects); if (overlappedObjects.Any((gameObject) => Builder.IsObstacle(gameObject.GetComponent <Collider>()))) { hasAnyOverlappedTerrainObstacles = true; break; } } if (hasAnyOverlappedTerrainObstacles) { foreach (var orientedBounds in orientedBoundsList) { var sizeExpand = Config.Instance.spaceBetweenTerrainHabitantModule; LargeWorldStreamer.main.PerformBoxEdit(new Bounds(orientedBounds.position, orientedBounds.size + new Vector3(sizeExpand, sizeExpand, sizeExpand)), orientedBounds.rotation, false, 2); Logger.Debug($"PerformBoxEdit() called using oriented bounds: {orientedBounds}"); } var streamerV2 = LargeWorldStreamer.main.streamerV2; streamerV2.clipmapStreamer.FlushRangesEdited(streamerV2.octreesStreamer.minLod, streamerV2.octreesStreamer.maxLod); } } } }