示例#1
0
 public override void Tick()
 {
     if (Spawned)
     {
         sustainer.Maintain();
         Vector3 vector = Position.ToVector3Shifted();
         IntVec3 c;
         if (Rand.MTBEventOccurs(FilthSpawnMTB, 1f, 1.TicksToSeconds()) && CellFinder.TryFindRandomReachableCellNear(Position, Map, FilthSpawnRadius, TraverseParms.For(TraverseMode.NoPassClosedDoors, Danger.Deadly, false), null, null, out c, 999999))
         {
             FilthMaker.TryMakeFilth(c, Map, RatkinTunnelUtility.filthTypes.RandomElement(), 1);
         }
         if (Rand.MTBEventOccurs(DustMoteSpawnMTB, 1f, 1.TicksToSeconds()))
         {
             MoteMaker.ThrowDustPuffThick(new Vector3(vector.x, 0f, vector.z)
             {
                 y = AltitudeLayer.MoteOverhead.AltitudeFor()
             }, Map, Rand.Range(1.5f, 3f), new Color(1f, 1f, 1f, 2.5f));
         }
         if (secondarySpawnTick <= Find.TickManager.TicksGame)
         {
             sustainer.End();
             Map     map      = Map;
             IntVec3 position = Position;
             Destroy(DestroyMode.Vanish);
             if (spawnTunnel)
             {
                 Building_GuerrillaTunnel tunnel = (Building_GuerrillaTunnel)GenSpawn.Spawn(ThingMaker.MakeThing(RatkinBuildingDefOf.RK_GuerrillaTunnel, null), position, map, WipeMode.Vanish);
                 tunnel.SetFaction(Find.FactionManager.FirstFactionOfDef(RatkinFactionDefOf.Rakinia), null);
                 tunnel.eventPoint = eventPoint;
                 tunnel.SpawnInitialPawns();
             }
         }
     }
 }
示例#2
0
        public static void Notify_TunnelDespawned(Building_GuerrillaTunnel tunnel, Map map)
        {
            int num = GenRadial.NumCellsInRadius(2f);

            for (int i = 0; i < num; i++)
            {
                IntVec3 c = tunnel.Position + GenRadial.RadialPattern[i];
                if (c.InBounds(map))
                {
                    List <Thing> thingList = c.GetThingList(map);
                    for (int j = 0; j < thingList.Count; j++)
                    {
                        if (thingList[j].Faction == Faction.OfInsects && !AnyTunnelPreventsClaiming(thingList[j]))
                        {
                            thingList[j].SetFaction(null, null);
                        }
                    }
                }
            }
        }