// Token: 0x060029E3 RID: 10723 RVA: 0x0013D300 File Offset: 0x0013B700 public bool TrySpawnChildHiveLike(bool ignoreRoofedRequirement, out TunnelHiveLikeSpawner newTunnelLike) { if (!this.CanSpawnChildHiveLike) { newTunnelLike = null; return(false); } IntVec3 loc = CompSpawner_HiveLike_CrashedShipPart.FindChildHiveLocation(this.parent.Position, this.parent.Map, this.parent.def, this.Props, true, false); if (!loc.IsValid) { newTunnelLike = null; return(false); } newTunnelLike = (TunnelHiveLikeSpawner)ThingMaker.MakeThing(this.parent.def, null); if (newTunnelLike.Faction != this.parent.Faction) { newTunnelLike.SetFaction(this.parent.Faction, null); } TunnelHiveLikeSpawner hivelike = this.parent as TunnelHiveLikeSpawner; if (hivelike != null) { newTunnelLike.active = hivelike.active; } GenSpawn.Spawn(newTunnelLike.Def, loc, this.parent.Map, WipeMode.FullRefund); this.CalculateNextHiveLikeSpawnTick(); return(true); }
// Token: 0x060029E4 RID: 10724 RVA: 0x0013D3DC File Offset: 0x0013B7DC public static IntVec3 FindChildHiveLocation(IntVec3 pos, Map map, ThingDef parentDef, CompProperties_Spawner_HiveLike_CrashedShipPart props, bool ignoreRoofedRequirement, bool allowUnreachable) { IntVec3 intVec = IntVec3.Invalid; for (int i = 0; i < 3; i++) { float minDist = props.HiveSpawnPreferredMinDist; bool flag; if (i < 2) { if (i == 1) { minDist = 0f; } flag = CellFinder.TryFindRandomReachableCellNear(pos, map, props.HiveSpawnRadius, TraverseParms.For(TraverseMode.NoPassClosedDoors, Danger.Deadly, false), (IntVec3 c) => CompSpawner_HiveLike_CrashedShipPart.CanSpawnHiveAt(c, map, pos, parentDef, minDist, ignoreRoofedRequirement), null, out intVec, 999999); } else { flag = (allowUnreachable && CellFinder.TryFindRandomCellNear(pos, map, (int)props.HiveSpawnRadius, (IntVec3 c) => CompSpawner_HiveLike_CrashedShipPart.CanSpawnHiveAt(c, map, pos, parentDef, minDist, ignoreRoofedRequirement), out intVec, -1)); } if (flag) { intVec = CellFinder.FindNoWipeSpawnLocNear(intVec, map, parentDef, Rot4.North, 2, (IntVec3 c) => CompSpawner_HiveLike_CrashedShipPart.CanSpawnHiveAt(c, map, pos, parentDef, minDist, ignoreRoofedRequirement)); break; } } return(intVec); }