private TunnelHiveLikeSpawner SpawnTunnelLikeCluster(int hiveCount, Map map) { IntVec3 loc = DropCellFinder.RandomDropSpot(map); ThingDef_HiveLike tD = (ThingDef_HiveLike)this.def.mechClusterBuilding; ThingDef_TunnelHiveLikeSpawner thingDef = (ThingDef_TunnelHiveLikeSpawner)tD.TunnelDef; TunnelHiveLikeSpawner hivelike = (TunnelHiveLikeSpawner)ThingMaker.MakeThing(thingDef, null); GenSpawn.Spawn(ThingMaker.MakeThing(hivelike.def, null), loc, map); //hivelike.SetFaction(hivelike.faction, null); IncidentWorker_Hivelike.SpawnItemInstantly(hivelike); for (int i = 0; i < hiveCount - 1; i++) { TunnelHiveLikeSpawner hivelike2; CompSpawnerHiveLikes c = hivelike.GetComp <CompSpawnerHiveLikes>(); if (hivelike.Spawned && hivelike.GetComp <CompSpawnerHiveLikes>().TrySpawnChildHiveLike(true, out hivelike2)) { IncidentWorker_Hivelike.SpawnItemInstantly(hivelike2); hivelike = hivelike2; //Log.Message(string.Format("7 e")); } //Log.Message(string.Format("7 f")); } //Log.Message(string.Format("8")); return(hivelike); }
// Token: 0x06000E64 RID: 3684 RVA: 0x0006B8B4 File Offset: 0x00069CB4 protected override bool TryExecuteWorker(IncidentParms parms) { Map map = (Map)parms.target; int hivelikeCount = Mathf.Max(GenMath.RoundRandom(parms.points / 220f), 1); if (def.tags.Contains("TunnelLike")) { //Log.Message(string.Format("TunnelLike")); TunnelHiveLikeSpawner t = null; int num; for (int i = Mathf.Max(GenMath.RoundRandom(parms.points / 220f), 1); i > 0; i -= num) { num = Mathf.Min(3, i); t = this.SpawnTunnelLikeCluster(num, map); } base.SendStandardLetter(t, null, new string[0]); } else { //Log.Message(string.Format("HiveLike")); HiveLike t = null; int num; for (int i = Mathf.Max(GenMath.RoundRandom(parms.points / 400f), 1); i > 0; i -= num) { num = Mathf.Min(3, i); t = this.SpawnHiveLikeCluster(num, map); } base.SendStandardLetter(t, null, new string[0]); } Find.TickManager.slower.SignalForceNormalSpeedShort(); return(true); }
// 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); }
private static void SpawnItemInstantly(TunnelHiveLikeSpawner hive) { CompSpawnerLike compSpawner = (CompSpawnerLike)hive.AllComps.Find(delegate(ThingComp x) { CompSpawnerLike compSpawner2 = x as CompSpawnerLike; return(compSpawner2 != null && compSpawner2.PropsSpawner.thingToSpawn == ThingDefOf.InsectJelly); }); if (compSpawner != null) { compSpawner.TryDoSpawn(); } }