Esempio n. 1
0
        public static void ThrowSprayTrail(Vector3 loc, Map map, Vector3 origin, Vector3 destination, string defname = null, float size = 1.5f, int rotationRate = 240, float projectieSpeed = 0, Color?color = null)
        {
            if (map == null)
            {
                return;
            }
            if (!loc.InBounds(map))
            {
                return;
            }
            if (!GenView.ShouldSpawnMotesAt(loc, map))
            {
                return;
            }
            float forward = 0f;

            if ((destination - origin).MagnitudeHorizontalSquared() > 0.001f)
            {
                forward = (destination - origin).AngleFlat();
            }
            float backward = 0f;

            if ((origin - destination).MagnitudeHorizontalSquared() > 0.001f)
            {
                backward = (origin - destination).AngleFlat();
            }
            TrailThrower.ThrowSprayTrail(loc, map, forward, backward, defname, size, rotationRate, projectieSpeed, color);
        }
Esempio n. 2
0
        public static void ThrowSmoke(Vector3 loc, float size, Map map, ThingDef def = null, Color?color = null, float?exactRotation = null)
        {
            if (!GenView.ShouldSpawnMotesAt(loc, map))
            {
                return;
            }
            Rand.PushState();
            MoteThrown moteThrown = (MoteThrown)ThingMaker.MakeThing(def ?? ThingDefOf.Mote_Smoke, null);

            moteThrown.Scale         = Rand.Range(1.5f, 2.5f) * size;
            moteThrown.rotationRate  = Rand.Range(-30f, 30f);
            moteThrown.exactPosition = loc;
            moteThrown.SetVelocity((float)Rand.Range(30, 40), Rand.Range(0.5f, 0.7f));
            if (color.HasValue)
            {
                moteThrown.instanceColor = color.Value;
                //    moteThrown.instanceColor = new Color(0.368f, 0f, 1f);
            }
            if (exactRotation.HasValue)
            {
                moteThrown.exactRotation += exactRotation.Value;
            }
            Rand.PopState();
            GenSpawn.Spawn(moteThrown, loc.ToIntVec3(), map, WipeMode.Vanish);
        }
 public static void ThrowSmokeTrail(Vector3 loc, float size, Map map, string defName)
 {
     if (GenView.ShouldSpawnMotesAt(loc, map) && !map.moteCounter.Saturated)
     {
         MoteThrown moteThrown = (MoteThrown)ThingMaker.MakeThing(ThingDef.Named(defName), null);
         moteThrown.Scale         = Rand.Range(2f, 3f) * size;
         moteThrown.exactPosition = loc;
         moteThrown.rotationRate  = Rand.Range(-0.5f, 0.5f);
         moteThrown.SetVelocity((float)Rand.Range(30, 40), Rand.Range(0.008f, 0.012f));
         GenSpawn.Spawn(moteThrown, IntVec3Utility.ToIntVec3(loc), map, WipeMode.Vanish);
     }
 }
Esempio n. 4
0
        // Token: 0x0600003F RID: 63 RVA: 0x0000370C File Offset: 0x0000190C
        public static void ThrowEMPSmoke(Vector3 loc, Map map, float size)
        {
            if (!GenView.ShouldSpawnMotesAt(loc, map) || map.moteCounter.SaturatedLowPriority)
            {
                return;
            }
            MoteThrown moteThrown = (MoteThrown)ThingMaker.MakeThing(ThingDefOf.Mote_EMPSmoke, null);

            moteThrown.Scale         = Rand.Range(1.5f, 2.5f) * size;
            moteThrown.rotationRate  = Rand.Range(-30f, 30f);
            moteThrown.exactPosition = loc;
            moteThrown.SetVelocity((float)Rand.Range(30, 40), Rand.Range(0.5f, 0.7f));
            GenSpawn.Spawn(moteThrown, IntVec3Utility.ToIntVec3(loc), map, WipeMode.Vanish);
        }
Esempio n. 5
0
        // Token: 0x0600003E RID: 62 RVA: 0x00003654 File Offset: 0x00001854
        public static void ThrowEMPLightningGlow(Vector3 loc, Map map, float size)
        {
            if (!GenView.ShouldSpawnMotesAt(loc, map) || map.moteCounter.SaturatedLowPriority)
            {
                return;
            }
            MoteThrown moteThrown = (MoteThrown)ThingMaker.MakeThing(ThingDefOf.EMPGlow, null);

            moteThrown.Scale         = Rand.Range(6f, 8f) * size;
            moteThrown.rotationRate  = Rand.Range(-3f, 3f);
            moteThrown.exactPosition = loc + size * new Vector3(Rand.Value - 0.5f, 0f, Rand.Value - 0.5f);
            moteThrown.SetVelocity((float)Rand.Range(0, 360), 1.2f);
            GenSpawn.Spawn(moteThrown, IntVec3Utility.ToIntVec3(loc), map, WipeMode.Vanish);
        }
Esempio n. 6
0
        public static void ThrowMoteDef(ThingDef moteDef, Vector3 loc, Map map, float size, float velocity, float angle, float rotation)
        {
            if (!GenView.ShouldSpawnMotesAt(loc, map) || map.moteCounter.SaturatedLowPriority)
            {
                return;
            }
            MoteThrown moteThrown = (MoteThrown)ThingMaker.MakeThing(moteDef, null);

            moteThrown.Scale         = Rand.Range(1f, 2f) * size;
            moteThrown.rotationRate  = rotation;
            moteThrown.exactPosition = loc;
            moteThrown.SetVelocity(angle, velocity);
            GenSpawn.Spawn(moteThrown, IntVec3Utility.ToIntVec3(loc), map, WipeMode.Vanish);
        }
Esempio n. 7
0
        // Token: 0x0600003D RID: 61 RVA: 0x00003580 File Offset: 0x00001780
        public static void ThrowEMPMicroSparks(Vector3 loc, Map map)
        {
            if (!GenView.ShouldSpawnMotesAt(loc, map) || map.moteCounter.SaturatedLowPriority)
            {
                return;
            }
            MoteThrown moteThrown = (MoteThrown)ThingMaker.MakeThing(ThingDefOf.EMP_Sparks, null);

            moteThrown.Scale          = Rand.Range(5f, 8f);
            moteThrown.rotationRate   = Rand.Range(-12f, 12f);
            moteThrown.exactPosition  = loc;
            moteThrown.exactPosition -= new Vector3(0.5f, 0f, 0.5f);
            moteThrown.exactPosition += new Vector3(Rand.Value, 0f, Rand.Value);
            moteThrown.SetVelocity((float)Rand.Range(35, 45), 1.2f);
            GenSpawn.Spawn(moteThrown, IntVec3Utility.ToIntVec3(loc), map, WipeMode.Vanish);
        }
Esempio n. 8
0
        public static void ThrowMicroSparksRed(Vector3 loc, Map map)
        {
            if (!GenView.ShouldSpawnMotesAt(loc, map) || map.moteCounter.SaturatedLowPriority)
            {
                return;
            }
            Rand.PushState();
            MoteThrown moteThrown = (MoteThrown)ThingMaker.MakeThing(ThingDef.Named("LaserImpactThing"), null);

            moteThrown.Scale          = Rand.Range(1f, 1.2f);
            moteThrown.rotationRate   = Rand.Range(-12f, 12f);
            moteThrown.exactPosition  = loc;
            moteThrown.exactPosition -= new Vector3(0.5f, 0f, 0.5f);
            moteThrown.exactPosition += new Vector3(Rand.Value, 0f, Rand.Value);
            moteThrown.SetVelocity((float)Rand.Range(35, 45), 1.2f);
            GenSpawn.Spawn(moteThrown, IntVec3Utility.ToIntVec3(loc), map, 0);
            Rand.PopState();
        }
Esempio n. 9
0
        public static void ThrowSmokeTrail(Vector3 loc, float size, Map map, string DefName, Thing attachTo = null)
        {
            if (!GenView.ShouldSpawnMotesAt(loc, map))
            {
                return;
            }
            ThingDef moteDef = ThingDef.Named(DefName);

            Rand.PushState();
            MoteThrown moteThrown = (MoteThrown)ThingMaker.MakeThing(moteDef, null);

            moteThrown.Scale         = Rand.Range(2f, 3f) * size;
            moteThrown.exactPosition = loc;
            moteThrown.rotationRate  = Rand.Range(-0.5f, 0.5f);
            moteThrown.SetVelocity((float)Rand.Range(30, 40), Rand.Range(0.008f, 0.012f));
            Rand.PopState();
            GenSpawn.Spawn(moteThrown, loc.ToIntVec3(), map, WipeMode.Vanish);
            return;
        }
Esempio n. 10
0
 public void ResolveSmoke()
 {
     if (Find.TickManager.TicksGame % 60 == 0)
     {
         Pawn Dave = Map.mapPawns.FreeColonistsSpawned.FirstOrDefault((Pawn p) =>
                                                                      p.Position == BillInteractionCell);
         if (Dave != null)
         {
             if (Dave.CurJob.def == JobDefOf.DoBill)
             {
                 IntVec3 smokePos = Position + GenAdj.CardinalDirections[Rot4.North.AsInt] +
                                    GenAdj.CardinalDirections[Rot4.North.AsInt];
                 var smokePosV3 = smokePos.ToVector3();
                 var smokePosX  = (float)smokePos.x;
                 if (Rotation == Rot4.North || Rotation == Rot4.South)
                 {
                     smokePosX += 0.5f;
                 }
                 else if (Rotation == Rot4.West)
                 {
                     smokePosX += 0.75f;
                 }
                 else if (Rotation == Rot4.East)
                 {
                     smokePosX += 0.25f;
                 }
                 if (GenView.ShouldSpawnMotesAt(smokePos, Map))
                 {
                     var moteThrown =
                         (MoteThrown)ThingMaker.MakeThing(ThingDef.Named("Mote_Smoke"), null);
                     moteThrown.Scale         = Rand.Range(1.5f, 2.5f) * smokeSize.RandomInRange;
                     moteThrown.exactRotation = Rand.Range(-0.5f, 0.5f);
                     moteThrown.exactPosition = new Vector3(smokePosX + Rand.Range(-0.1f, 0.1f), 0,
                                                            (float)smokePos.z + Rand.Range(-0.25f, 1.0f));
                     moteThrown.airTimeLeft = 5000f;
                     moteThrown.SetVelocity((float)Rand.Range(30, 40), Rand.Range(0.008f, 0.012f));
                     GenSpawn.Spawn(moteThrown, smokePos, Map);
                 }
             }
         }
     }
 }
Esempio n. 11
0
        public static void ThrowEMPSmoke(Vector3 loc, Map map, float size, Color?color = null)
        {
            if (!GenView.ShouldSpawnMotesAt(loc, map))
            {
                return;
            }
            MoteThrown moteThrown = (MoteThrown)ThingMaker.MakeThing(ThingDef.Named("Mote_EMPSmoke"), null);

            moteThrown.Scale         = Rand.Range(1.5f, 2.5f) * size;
            moteThrown.rotationRate  = Rand.Range(-30f, 30f);
            moteThrown.exactPosition = loc;
            moteThrown.SetVelocity((float)Rand.Range(30, 40), Rand.Range(0.5f, 0.7f));
            if (color.HasValue)
            {
                moteThrown.instanceColor = color.Value;
                //    moteThrown.instanceColor = new Color(0.368f, 0f, 1f);
                //    moteThrown.instanceColor = new Color(0f, 0.0862f, 0.094117f);
            }
            GenSpawn.Spawn(moteThrown, IntVec3Utility.ToIntVec3(loc), map, 0);
        }
Esempio n. 12
0
        public static void ThrowAirPuffUp(Vector3 loc, Map map)
        {
            if (map == null)
            {
                return;
            }
            if (!loc.InBounds(map))
            {
                return;
            }
            if (!GenView.ShouldSpawnMotesAt(loc, map))
            {
                return;
            }
            MoteThrown moteThrown = TrailThrower.NewBaseAirPuff();

            moteThrown.exactPosition  = loc;
            moteThrown.exactPosition += new Vector3(Rand.Range(-0.02f, 0.02f), 0f, Rand.Range(-0.02f, 0.02f));
            moteThrown.SetVelocity((float)Rand.Range(-45, 45), Rand.Range(1.2f, 1.5f));
            GenSpawn.Spawn(moteThrown, loc.ToIntVec3(), map, WipeMode.Vanish);
        }
Esempio n. 13
0
        public static Mote ThrowBatteryXYZ(ThingDef moteDef, Vector3 loc, Map map, float scale)
        {
            Mote result;

            if (!GenView.ShouldSpawnMotesAt(loc, map) ||
                map.moteCounter.Saturated)
            {
                result = null;
            }
            else
            {
                MoteThrown batteryMote = (MoteThrown)ThingMaker.MakeThing(moteDef, null);
                batteryMote.Scale          = scale;
                batteryMote.rotationRate   = (float)Rand.Range(-1, 1);
                batteryMote.exactPosition  = loc;
                batteryMote.exactPosition += new Vector3(THIRTY_FIVE, 0, THIRTY_FIVE);
                batteryMote.exactPosition += new Vector3(Rand.Value, 0, Rand.Value) * POINT_TEN;
                batteryMote.SetVelocity(Rand.Range(30, 60), Rand.Range(THIRTY_FIVE, FIFTY_FIVE));
                GenSpawn.Spawn(batteryMote, IntVec3Utility.ToIntVec3(loc), map);
                result = batteryMote;
            }
            return(result);
        }
        private static void Postfix(IntVec3 c, SteadyEnvironmentEffects __instance, Map ___map)
        {
            if (___map == null)
            {
                return;
            }
            Room room = c.GetRoom(___map, RegionType.Set_Passable);

            if (ReGrowthSettings.ColdFog || ReGrowthSettings.IceLayer)
            {
                Thing thing = (from t in c.GetThingList(___map)
                               where t.def == RGDefOf.RG_IceOverlay
                               select t).FirstOrDefault <Thing>();
                if (room == null && thing != null && ReGrowthSettings.IceLayer)
                {
                    thing.Destroy(DestroyMode.Vanish);
                    if (Rand.Range(1, 100) <= 20)
                    {
                        FilthMaker.TryMakeFilth(c, ___map, RGDefOf.RG_Filth_Water, 1);
                    }
                }
                if (room != null && !room.UsesOutdoorTemperature && !room.Fogged && !room.IsDoorway)
                {
                    float num = 0.8f;
                    if (room.Temperature < (float)ReGrowthSettings.FogTemp)
                    {
                        if (thing == null && ReGrowthSettings.IceLayer)
                        {
                            GenSpawn.Spawn(ThingMaker.MakeThing(RGDefOf.RG_IceOverlay), c, ___map);
                        }
                        if (ReGrowthSettings.ColdFog)
                        {
                            Vector3 vector = c.ToVector3Shifted();
                            bool    flag   = true;
                            if (!GenView.ShouldSpawnMotesAt(vector, ___map) || ___map.moteCounter.SaturatedLowPriority)
                            {
                                flag = false;
                            }
                            vector += num * new Vector3(Rand.Value - 0.5f, 0f, Rand.Value - 0.5f);
                            if (!GenGrid.InBounds(vector, ___map))
                            {
                                flag = false;
                            }
                            if (flag)
                            {
                                MoteThrown moteThrown = (MoteThrown)ThingMaker.MakeThing(RGDefOf.RG_Mote_FrostGlow, null);
                                moteThrown.Scale         = Rand.Range(4f, 6f) * num;
                                moteThrown.rotationRate  = Rand.Range(-3f, 3f);
                                moteThrown.exactPosition = vector;
                                moteThrown.SetVelocity((float)(Rand.Bool ? -90 : 90), (float)((double)ReGrowthSettings.FogVelocity * 0.01));
                                GenSpawn.Spawn(moteThrown, IntVec3Utility.ToIntVec3(vector), ___map);
                            }
                        }
                    }
                    else if (thing != null)
                    {
                        thing.Destroy(DestroyMode.Vanish);
                        if (Rand.Range(1, 100) <= 20)
                        {
                            FilthMaker.TryMakeFilth(c, ___map, RGDefOf.RG_Filth_Water, 1);
                        }
                    }
                }
            }
            if (!ReGrowthSettings.IceLayer)
            {
                Thing thing2 = (from t in c.GetThingList(___map)
                                where t.def == RGDefOf.RG_IceOverlay
                                select t).FirstOrDefault <Thing>();
                if (thing2 != null)
                {
                    thing2.Destroy(DestroyMode.Vanish);
                }
            }
            if (___map.roofGrid != null && !___map.roofGrid.Roofed(c) && (float)___map.weatherManager.curWeatherAge >= 7500f && (___map.weatherManager.curWeather.rainRate <= 0f ||
                                                                                                                                 ___map.weatherManager.curWeather.snowRate > 0f))
            {
                Thing thing3 = (from t in c.GetThingList(___map)
                                where t.def == RGDefOf.RG_Filth_Water || t.def == RGDefOf.RG_Filth_WaterSpatter
                                select t).FirstOrDefault <Thing>();
                if (thing3 != null && Rand.Value <= 0.2f)
                {
                    ((Filth)thing3).ThinFilth();
                }
            }
        }