private TunnelHiveLikeSpawner SpawnTunnelLikeCluster(int hiveCount, Map map) { IntVec3 loc = DropCellFinder.RandomDropSpot(map); ThingDef_HiveLike tD = (ThingDef_HiveLike)this.def.shipPart; 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); }
private TunnelHiveLikeSpawner SpawnTunnelLikeCluster(int hiveCount, Map map, IncidentParms parms, bool ignoreRoofedRequirement = false, bool allowUnreachable = false, float modifier = 1) { IntVec3 loc = intVec; ThingDef_HiveLike tD = (ThingDef_HiveLike)this.def.mechClusterBuilding; ThingDef_TunnelHiveLikeSpawner thingDef = (ThingDef_TunnelHiveLikeSpawner)tD.TunnelDef; TunnelHiveLikeSpawner hivelike = (TunnelHiveLikeSpawner)ThingMaker.MakeThing(thingDef, null); hivelike.hivePoints = parms.points / hiveCount; GenSpawn.Spawn(ThingMaker.MakeThing(hivelike.def, null), loc, map); //hivelike.SetFaction(hivelike.faction, null); IncidentWorker_Xenomorph_Hivelike.SpawnItemInstantly(hivelike); for (int i = 0; i < hiveCount - 1; i++) { CompSpawnerHiveLikes c = hivelike.GetComp <CompSpawnerHiveLikes>(); if (hivelike.Spawned && hivelike.GetComp <CompSpawnerHiveLikes>().TrySpawnChildHiveLike(modifier, modifier, out TunnelHiveLikeSpawner hivelike2, ignoreRoofedRequirement, allowUnreachable)) { IncidentWorker_Xenomorph_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); }
private static void SpawnItemInstantly(TunnelHiveLikeSpawner hive) { CompXenomorph_SpawnerLike compSpawner = (CompXenomorph_SpawnerLike)hive.AllComps.Find(delegate(ThingComp x) { CompXenomorph_SpawnerLike compSpawner2 = x as CompXenomorph_SpawnerLike; return(compSpawner2 != null && compSpawner2.PropsSpawner.thingToSpawn == ThingDefOf.InsectJelly); }); if (compSpawner != null) { compSpawner.TryDoSpawn(); } }