// Token: 0x06004F05 RID: 20229 RVA: 0x001A99DC File Offset: 0x001A7BDC
        public override void Impact()
        {
            for (int i = 0; i < 6; i++)
            {
                AdeptusFleckMaker.ThrowDustPuff(base.Position.ToVector3Shifted() + Gen.RandomHorizontalVector(1f), base.Map, 1.2f);
            }
            //    FleckMaker.ThrowLightningGlow(base.Position.ToVector3Shifted(), base.Map, 2f);
            GenClamor.DoClamor(this, 15f, ClamorDefOf.Impact);
            if (this.def.skyfaller.CausesExplosion)
            {
                GenExplosion.DoExplosion(base.Position, base.Map, this.def.skyfaller.explosionRadius, this.def.skyfaller.explosionDamage, null, GenMath.RoundRandom((float)this.def.skyfaller.explosionDamage.defaultDamage * this.def.skyfaller.explosionDamageFactor), -1f, null, null, null, null, null, 0f, 1, false, null, 0f, 1, 0f, false, null, (!this.def.skyfaller.damageSpawnedThings) ? this.innerContainer.ToList <Thing>() : null);
            }
            this.SpawnThings();
            this.innerContainer.ClearAndDestroyContents(DestroyMode.Vanish);
            CellRect cellRect = this.OccupiedRect();

            for (int i = 0; i < cellRect.Area * this.def.skyfaller.motesPerCell; i++)
            {
                AdeptusFleckMaker.ThrowDustPuff(cellRect.RandomVector3, base.Map, 2f);
            }
            if (this.def.skyfaller.MakesShrapnel)
            {
                SkyfallerShrapnelUtility.MakeShrapnel(base.Position, base.Map, this.shrapnelDirection, this.def.skyfaller.shrapnelDistanceFactor, this.def.skyfaller.metalShrapnelCountRange.RandomInRange, this.def.skyfaller.rubbleShrapnelCountRange.RandomInRange, true);
            }
            if (this.def.skyfaller.cameraShake > 0f && base.Map == Find.CurrentMap)
            {
                Find.CameraDriver.shaker.DoShake(this.def.skyfaller.cameraShake);
            }
            if (this.def.skyfaller.impactSound != null)
            {
                this.def.skyfaller.impactSound.PlayOneShot(SoundInfo.InMap(new TargetInfo(base.Position, base.Map, false), MaintenanceType.None));
            }
            this.Destroy(DestroyMode.Vanish);
        }
Exemple #2
0
        public static void ThrowSprayTrail(Vector3 loc, Map map, float angle, float angleR, string defname = null, float size = 1.5f, int rotationRate = 240, float projectieSpeed = 0, Color?color = null)
        {
            FleckDef def = defname.NullOrEmpty() ? null : DefDatabase <FleckDef> .GetNamedSilentFail(defname);

            if (def != null)
            {
                AdeptusFleckMaker.Thrown(loc + Quaternion.AngleAxis(Rand.Range(-10, 10) + angle, Vector3.up) * Vector3.back * Rand.Range(0, projectieSpeed), map, def, size, color, Rand.Range(0, 360), rotationRate, 0f, Rand.Range(0, projectieSpeed), (float)Rand.Range(-15, 15) + angle);
            }
        }
 private void Initialize()
 {
     if (this.pawn != null)
     {
         Rand.PushState();
         AdeptusFleckMaker.ThrowDustPuff(this.pawn.DrawPos, this.pawn.Map, Rand.Range(1.2f, 1.8f));
         Rand.PopState();
     }
 }
Exemple #4
0
        public static void ThrowMetaIcon(IntVec3 cell, Map map, FleckDef fleckDef, float velocitySpeed = 0.42f)
        {
            bool flag = !cell.ShouldSpawnMotesAt(map);

            if (!flag)
            {
                map.flecks.CreateFleck(AdeptusFleckMaker.GetDataThrowMetaIcon(cell, map, fleckDef, velocitySpeed));
            }
        }
Exemple #5
0
        public override void Tick()
        {
            base.Tick();
            Vector3 exactPosition = this.ExactPosition;

            //    this.ticksToImpact = UpdateTicksToImpact;
            this.ticksToImpact--;
            if (this.ticksToImpact == 15)
            {
                this.HitRoof();
            }
            if (this.landed || base.Map == null)
            {
                return;
            }
            bool flag  = !this.ExactPosition.InBounds(base.Map);
            bool flag2 = flag;

            if (flag2)
            {
                this.ticksToImpact++;
                base.Position = this.ExactPosition.ToIntVec3();
                this.Destroy(DestroyMode.Vanish);
            }
            else
            {
                base.Position = this.ExactPosition.ToIntVec3();
                bool flag3 = Find.TickManager.TicksGame % 2 == 0;
                if (flag3)
                {
                    if (this.FlightArc != null)
                    {
                        float f = this.FlightArc.Evaluate(this.TimeInAnimation);
                        exactPosition.z += this.FlightArc.Evaluate(this.TimeInAnimation);
                    }
                    for (int i = 0; i < 3; i++)
                    {
                        Rand.PushState();
                        AdeptusFleckMaker.ThrowDustPuff(this.DrawPos, base.Map, Rand.Range(0.3f, 0.6f));
                        Rand.PopState();
                    }
                }
                bool flag4 = this.ticksToImpact <= 0;
                bool flag5 = flag4;
                if (flag5)
                {
                    bool flag6 = this.DestinationCell.InBounds(base.Map);
                    bool flag7 = flag6;
                    if (flag7)
                    {
                        base.Position = this.DestinationCell;
                    }
                    this.ImpactSomething();
                }
            }
        }
Exemple #6
0
 public virtual void Reset()
 {
     if (Pawn.Spawned)
     {
         SoundDefOf.EnergyShield_Reset.PlayOneShot(new TargetInfo(Pawn.Position, Pawn.Map, false));
         AdeptusFleckMaker.ThrowLightningGlow(Pawn.TrueCenter(), Pawn.Map, 3f);
     }
     this.ticksToReset = -1;
     this.energy       = this.EnergyOnReset;
 }
 /*
  *      protected override void SpawnThings()
  *      {
  *
  *              if (this.Contents.spawnWipeMode == null)
  *              {
  *                      base.SpawnThings();
  *                      return;
  *              }
  *              for (int i = this.innerContainer.Count - 1; i >= 0; i--)
  *              {
  *                      GenSpawn.Spawn(this.innerContainer[i], base.Position, base.Map, this.Contents.spawnWipeMode.Value);
  *              }
  *
  *      }
  */
 // Token: 0x06007932 RID: 31026 RVA: 0x00239D78 File Offset: 0x00237F78
 public override void Impact()
 {
     for (int i = 0; i < 6; i++)
     {
         AdeptusFleckMaker.ThrowDustPuff(base.Position.ToVector3Shifted() + Gen.RandomHorizontalVector(1f), base.Map, 1.2f);
     }
     AdeptusFleckMaker.ThrowLightningGlow(base.Position.ToVector3Shifted(), base.Map, 2f);
     GenClamor.DoClamor(this, 15f, ClamorDefOf.Impact);
     base.Impact();
 }
 // Token: 0x06002740 RID: 10048 RVA: 0x0012AD78 File Offset: 0x00129178
 private void Reset()
 {
     if (base.Wearer.Spawned)
     {
         SoundDefOf.EnergyShield_Reset.PlayOneShot(new TargetInfo(base.Wearer.Position, base.Wearer.Map, false));
         AdeptusFleckMaker.ThrowLightningGlow(base.Wearer.TrueCenter(), base.Wearer.Map, 3f);
     }
     this.ticksToReset = -1;
     this.energy       = this.EnergyOnReset;
 }
Exemple #9
0
        public static void PlaceFootprint(Vector3 loc, Map map, float rot)
        {
            bool flag = !loc.ShouldSpawnMotesAt(map);

            if (!flag)
            {
                FleckCreationData data = AdeptusFleckMaker.GetDataStatic(loc, map, FleckDefOf.Footprint, 0.5f);
                data.rotation = rot;
                map.flecks.CreateFleck(data);
            }
        }
Exemple #10
0
        public static void ConnectingLine(Vector3 start, Vector3 end, FleckDef fleckDef, Map map, float width = 1f)
        {
            Vector3           positionDiff = end - start;
            float             dist         = positionDiff.MagnitudeHorizontal();
            Vector3           halfway      = start + positionDiff * 0.5f;
            FleckCreationData data         = AdeptusFleckMaker.GetDataStatic(halfway, map, fleckDef, 1f);

            data.exactScale = new Vector3?(new Vector3(dist, 1f, width));
            data.rotation   = Mathf.Atan2(-positionDiff.z, positionDiff.x) * 57.29578f;
            map.flecks.CreateFleck(data);
        }
Exemple #11
0
        public static void ThrowMetaPuffs(TargetInfo targ)
        {
            Vector3 center  = targ.HasThing ? targ.Thing.TrueCenter() : targ.Cell.ToVector3Shifted();
            int     numDust = Rand.RangeInclusive(4, 6);

            for (int i = 0; i < numDust; i++)
            {
                Vector3 loc = center + new Vector3(Rand.Range(-0.5f, 0.5f), 0f, Rand.Range(-0.5f, 0.5f));
                AdeptusFleckMaker.ThrowMetaPuff(loc, targ.Map);
            }
        }
Exemple #12
0
 private void Break()
 {
     SoundDefOf.EnergyShield_Broken.PlayOneShot(new TargetInfo(base.Wearer.Position, base.Wearer.Map, false));
     FleckMaker.Static(base.Wearer.TrueCenter(), base.Wearer.Map, FleckDefOf.ExplosionFlash, 12f);
     for (int i = 0; i < 6; i++)
     {
         Rand.PushState();
         AdeptusFleckMaker.ThrowDustPuff(base.Wearer.TrueCenter() + Vector3Utility.HorizontalVectorFromAngle((float)Rand.Range(0, 360)) * Rand.Range(0.3f, 0.6f), base.Wearer.Map, Rand.Range(0.8f, 1.2f));
         Rand.PopState();
     }
     this.energy       = 0f;
     this.ticksToReset = this.StartingTicksToReset;
 }
Exemple #13
0
        public static void ThrowExplosionInterior(Vector3 loc, Map map, FleckDef fleckDef)
        {
            bool flag = !loc.ShouldSpawnMotesAt(map);

            if (!flag)
            {
                FleckCreationData data = AdeptusFleckMaker.GetDataStatic(loc, map, fleckDef, Rand.Range(3f, 4.5f));
                data.rotationRate  = Rand.Range(-30f, 30f);
                data.velocityAngle = (float)Rand.Range(0, 360);
                data.velocitySpeed = Rand.Range(0.48f, 0.72f);
                map.flecks.CreateFleck(data);
            }
        }
Exemple #14
0
        public static void ThrowAirPuffUp(Vector3 loc, Map map)
        {
            bool flag = !loc.ToIntVec3().ShouldSpawnMotesAt(map);

            if (!flag)
            {
                FleckCreationData data = AdeptusFleckMaker.GetDataStatic(loc + new Vector3(Rand.Range(-0.02f, 0.02f), 0f, Rand.Range(-0.02f, 0.02f)), map, FleckDefOf.AirPuff, 1.5f);
                data.rotationRate  = (float)Rand.RangeInclusive(-240, 240);
                data.velocityAngle = (float)Rand.Range(-45, 45);
                data.velocitySpeed = Rand.Range(1.2f, 1.5f);
                map.flecks.CreateFleck(data);
            }
        }
Exemple #15
0
        public static void ThrowDustPuffThick(Vector3 loc, Map map, float scale, Color color)
        {
            bool flag = !loc.ShouldSpawnMotesAt(map);

            if (!flag)
            {
                FleckCreationData data = AdeptusFleckMaker.GetDataStatic(loc, map, FleckDefOf.DustPuffThick, scale);
                data.rotationRate  = (float)Rand.Range(-60, 60);
                data.velocityAngle = (float)Rand.Range(0, 360);
                data.velocitySpeed = Rand.Range(0.6f, 0.75f);
                map.flecks.CreateFleck(data);
            }
        }
Exemple #16
0
        public static void ThrowMetaPuff(Vector3 loc, Map map)
        {
            bool flag = !loc.ShouldSpawnMotesAt(map);

            if (!flag)
            {
                FleckCreationData data = AdeptusFleckMaker.GetDataStatic(loc, map, FleckDefOf.MetaPuff, 1.9f);
                data.rotationRate  = (float)Rand.Range(-60, 60);
                data.velocityAngle = (float)Rand.Range(0, 360);
                data.velocitySpeed = Rand.Range(0.6f, 0.78f);
                map.flecks.CreateFleck(data);
            }
        }
Exemple #17
0
        public static void ThrowBreathPuff(Vector3 loc, Map map, float throwAngle, Vector3 inheritVelocity)
        {
            bool flag = !loc.ToIntVec3().ShouldSpawnMotesAt(map);

            if (!flag)
            {
                FleckCreationData data = AdeptusFleckMaker.GetDataStatic(loc + new Vector3(Rand.Range(-0.005f, 0.005f), 0f, Rand.Range(-0.005f, 0.005f)), map, FleckDefOf.AirPuff, Rand.Range(0.6f, 0.7f));
                data.rotationRate  = (float)Rand.RangeInclusive(-240, 240);
                data.velocityAngle = throwAngle + (float)Rand.Range(-10, 10);
                data.velocitySpeed = Rand.Range(0.1f, 0.8f);
                data.velocity      = new Vector3?(inheritVelocity * 0.5f);
                map.flecks.CreateFleck(data);
            }
        }
Exemple #18
0
        public static void ThrowMicroSparks(Vector3 loc, Map map)
        {
            bool flag = !loc.ShouldSpawnMotesAt(map);

            if (!flag)
            {
                loc -= new Vector3(0.5f, 0f, 0.5f);
                loc += new Vector3(Rand.Value, 0f, Rand.Value);
                FleckCreationData data = AdeptusFleckMaker.GetDataStatic(loc, map, FleckDefOf.MicroSparks, Rand.Range(0.8f, 1.2f));
                data.rotationRate  = Rand.Range(-12f, 12f);
                data.velocityAngle = (float)Rand.Range(35, 45);
                data.velocitySpeed = 1.2f;
                map.flecks.CreateFleck(data);
            }
        }
Exemple #19
0
        public static void ThrowMetaPuffs(CellRect rect, Map map)
        {
            bool flag = !Find.TickManager.Paused;

            if (flag)
            {
                for (int i = rect.minX; i <= rect.maxX; i++)
                {
                    for (int j = rect.minZ; j <= rect.maxZ; j++)
                    {
                        AdeptusFleckMaker.ThrowMetaPuffs(new TargetInfo(new IntVec3(i, 0, j), map, false));
                    }
                }
            }
        }
Exemple #20
0
        // Token: 0x0600005B RID: 91 RVA: 0x00003DCC File Offset: 0x00001FCC
        private void AbsorbedDamage(DamageInfo dinfo)
        {
            SoundDefOf.EnergyShield_AbsorbDamage.PlayOneShot(new TargetInfo(base.Wearer.Position, base.Wearer.Map, false));

            float num = Mathf.Min(10f, 2f + (float)dinfo.Amount / 10f);

            FleckMaker.Static(base.Wearer.DrawPos, base.Wearer.Map, FleckDefOf.ExplosionFlash, num);
            int num2 = (int)num;

            for (int i = 0; i < num2; i++)
            {
                Rand.PushState();
                AdeptusFleckMaker.ThrowDustPuff(base.Wearer.DrawPos, base.Wearer.Map, Rand.Range(0.8f, 1.2f));
                Rand.PopState();
            }
        }
Exemple #21
0
        public static void ThrowLightningBolt(Vector3 loc, Map map, float size, Color?color = null)
        {
            bool flag = !loc.ShouldSpawnMotesAt(map);

            if (!flag)
            {
                FleckCreationData data = AdeptusFleckMaker.GetDataStatic(loc + size * new Vector3(Rand.Value - 0.5f, 0f, Rand.Value - 0.5f), map, FleckDefOf.LightningGlow, Rand.Range(4f, 6f) * size);
                data.rotationRate  = Rand.Range(-3f, 3f);
                data.velocityAngle = (float)Rand.Range(0, 360);
                data.velocitySpeed = 1.2f;
                if (color.HasValue)
                {
                    data.instanceColor = color.Value;
                }
                map.flecks.CreateFleck(data);
            }
        }
Exemple #22
0
        private static void ThrowObjectAt(Pawn thrower, IntVec3 targetCell, FleckDef fleck)
        {
            bool flag = !thrower.Position.ShouldSpawnMotesAt(thrower.Map);

            if (!flag)
            {
                float   speed       = Rand.Range(3.8f, 5.6f);
                Vector3 exactTarget = targetCell.ToVector3Shifted() + Vector3Utility.RandomHorizontalOffset((1f - (float)thrower.skills.GetSkill(SkillDefOf.Shooting).Level / 20f) * 1.8f);
                exactTarget.y = thrower.DrawPos.y;
                FleckCreationData data = AdeptusFleckMaker.GetDataStatic(thrower.DrawPos, thrower.Map, fleck, 1f);
                data.rotationRate  = (float)Rand.Range(-300, 300);
                data.velocityAngle = (exactTarget - data.spawnPosition).AngleFlat();
                data.velocitySpeed = speed;
                data.airTimeLeft   = new float?((float)Mathf.RoundToInt((data.spawnPosition - exactTarget).MagnitudeHorizontal() / speed));
                thrower.Map.flecks.CreateFleck(data);
            }
        }
Exemple #23
0
        // edited
        public static void ThrowExplosionCell(IntVec3 cell, Map map, FleckDef fleckDef, Color color, Color?dustColor = null)
        {
            bool flag = !cell.ShouldSpawnMotesAt(map);

            if (!flag)
            {
                FleckCreationData data = AdeptusFleckMaker.GetDataStatic(cell.ToVector3Shifted(), map, fleckDef, 1f);
                data.rotation      = (float)(90 * Rand.RangeInclusive(0, 3));
                data.instanceColor = new Color?(color);
                map.flecks.CreateFleck(data);
                bool flag2 = Rand.Value < 0.7f;
                if (flag2)
                {
                    AdeptusFleckMaker.ThrowDustPuff(cell, map, 1.2f, null, dustColor);
                }
            }
        }
Exemple #24
0
        // edited AdeptusFleckMaker.ThrowDustPuff
        public static void ThrowDustPuff(Vector3 loc, Map map, float scale, FleckDef def = null, Color?color = null)
        {
            bool flag = !loc.ShouldSpawnMotesAt(map);

            if (!flag)
            {
                FleckCreationData data = AdeptusFleckMaker.GetDataStatic(loc, map, def ?? FleckDefOf.DustPuff, 1.9f * scale);
                data.rotationRate  = (float)Rand.Range(-60, 60);
                data.velocityAngle = (float)Rand.Range(0, 360);
                data.velocitySpeed = Rand.Range(0.6f, 0.75f);
                if (color.HasValue)
                {
                    data.instanceColor = color.Value;
                    //    moteThrown.instanceColor = new Color(0.368f, 0f, 1f);
                }
                map.flecks.CreateFleck(data);
            }
        }
Exemple #25
0
        public static void ThrowFireGlow(Vector3 c, Map map, float size)
        {
            bool flag = !c.ShouldSpawnMotesAt(map);

            if (!flag)
            {
                Vector3 loc   = c + size * new Vector3(Rand.Value - 0.5f, 0f, Rand.Value - 0.5f);
                bool    flag2 = !loc.InBounds(map);
                if (!flag2)
                {
                    FleckCreationData data = AdeptusFleckMaker.GetDataStatic(loc, map, FleckDefOf.FireGlow, Rand.Range(4f, 6f) * size);
                    data.rotationRate  = Rand.Range(-3f, 3f);
                    data.velocityAngle = (float)Rand.Range(0, 360);
                    data.velocitySpeed = 0.12f;
                    map.flecks.CreateFleck(data);
                }
            }
        }
Exemple #26
0
        public virtual void AbsorbedDamage(DamageInfo dinfo)
        {
            SoundDefOf.EnergyShield_AbsorbDamage.PlayOneShot(new TargetInfo(Pawn.Position, Pawn.Map, false));
            this.impactAngleVect = Vector3Utility.HorizontalVectorFromAngle(dinfo.Angle);
            Vector3 loc = Pawn.TrueCenter() + this.impactAngleVect.RotatedBy(180f) * 0.5f;
            float   num = Mathf.Min(10f, 2f + dinfo.Amount / 10f);

            FleckMaker.Static(loc, Pawn.Map, FleckDefOf.ExplosionFlash, num);
            int num2 = (int)num;

            for (int i = 0; i < num2; i++)
            {
                Rand.PushState();
                AdeptusFleckMaker.ThrowDustPuff(loc, Pawn.Map, Rand.Range(0.8f, 1.2f));
                Rand.PopState();
            }
            this.lastAbsorbDamageTick = Find.TickManager.TicksGame;
            this.KeepDisplaying();
        }
        // AdeptusFleckMaker.ThrowDustPuff

        /*
         * public static void ThrowDustPuff(Vector3 loc, Map map, float scale, ThingDef def = null, Color? color = null)
         * {
         *  if (!loc.ShouldSpawnMotesAt(map))
         *  {
         *      return;
         *  }
         *  MoteThrown moteThrown = (MoteThrown)ThingMaker.MakeThing(def ?? AdeptusThingDefOf.OG_Mote_DustPuff, null);
         *  moteThrown.Scale = 1.9f * scale;
         *  moteThrown.rotationRate = (float)Rand.Range(-60, 60);
         *  moteThrown.exactPosition = loc;
         *  moteThrown.SetVelocity((float)Rand.Range(0, 360), Rand.Range(0.6f, 0.75f));
         *  if (color.HasValue)
         *  {
         *      moteThrown.instanceColor = color.Value;
         *      //    moteThrown.instanceColor = new Color(0.368f, 0f, 1f);
         *  }
         *
         *  GenSpawn.Spawn(moteThrown, loc.ToIntVec3(), map, WipeMode.Vanish);
         * }
         * 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 ?? AdeptusThingDefOf.OG_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 ThrowExplosionCell(IntVec3 cell, Map map, ThingDef moteDef, Color?color = null)
        {
            if (!cell.ShouldSpawnMotesAt(map))
            {
                return;
            }
            Mote moteThrown = (Mote)ThingMaker.MakeThing(moteDef, null);

            moteThrown.exactRotation = (float)(90 * Rand.RangeInclusive(0, 3));
            moteThrown.exactPosition = cell.ToVector3Shifted();
            if (color.HasValue)
            {
                moteThrown.instanceColor = color.Value;
                //    moteThrown.instanceColor = new Color(0.368f, 0f, 1f);
            }
            GenSpawn.Spawn(moteThrown, cell, map, WipeMode.Vanish);
            if (Rand.Value < 0.7f)
            {
                AdeptusFleckMaker.ThrowDustPuff(cell.ToVector3Shifted(), map, 1.2f, null, color);
            }
        }
Exemple #28
0
        public override void PostPreApplyDamage(DamageInfo dinfo, out bool absorbed)
        {
            //Log.Message(string.Format("Bypassing: {0}", !Props.BypassingDamageDefs.Any(def => dinfo.Def == def)));

            Rand.PushState();
            bool invSave = Rand.Chance(Props.InvunerableSaveChance);

            Rand.PopState();
            if (dinfo.Def != null && base.parent is Pawn pawn && pawn != null && invSave && !Props.BypassingDamageDefs.Any(def => dinfo.Def == def))
            {
                absorbed = true;
                SoundDefOf.EnergyShield_AbsorbDamage.PlayOneShot(new TargetInfo(base.parent.Position, base.parent.Map, false));
                Vector3 impactAngleVect = Vector3Utility.HorizontalVectorFromAngle(dinfo.Angle);
                Vector3 loc             = base.parent.TrueCenter() + impactAngleVect.RotatedBy(180f) * 0.5f;
                float   num             = Mathf.Min(10f, 2f + (float)dinfo.Amount / 10f);
                FleckMaker.Static(loc, base.parent.Map, FleckDefOf.ExplosionFlash, num);
                int num2 = (int)num;
                for (int i = 0; i < num2; i++)
                {
                    Rand.PushState();
                    AdeptusFleckMaker.ThrowDustPuff(loc, base.parent.Map, Rand.Range(0.8f, 1.2f));
                    float angle = (float)Rand.Range(0, 360);
                    Rand.PopState();
                    float   num3   = Mathf.Lerp(1.2f, 1.55f, 2f);
                    Vector3 vector = pawn.Drawer.DrawPos;
                    vector.y = Altitudes.AltitudeFor(AltitudeLayer.MoteOverhead);
                    int num4 = Find.TickManager.TicksGame - this.lastAbsorbDamageTick;
                    if (num4 < 8)
                    {
                        float num5 = (float)(8 - num4) / 8f * 0.05f;
                        vector += impactAngleVect * num5;
                        num3   -= num5;
                    }
                    Vector3   s      = new Vector3(num3, 1f, num3);
                    Matrix4x4 matrix = default;
                    matrix.SetTRS(vector, Quaternion.AngleAxis(angle, Vector3.up), s);
                    Graphics.DrawMesh(MeshPool.plane10, matrix, CompInvunerableSaveOGStatic.BubbleMat, 0);
                }
                this.lastAbsorbDamageTick = Find.TickManager.TicksGame;
            }
Exemple #29
0
        // edited
        public static void ThrowSmoke(Vector3 loc, float size, Map map, FleckDef def = null, Color?color = null, float?exactRotation = null)
        {
            bool flag = !loc.ShouldSpawnMotesAt(map);

            if (!flag)
            {
                FleckCreationData data = AdeptusFleckMaker.GetDataStatic(loc, map, def ?? FleckDefOf.Smoke, Rand.Range(1.5f, 2.5f) * size);
                data.rotationRate  = Rand.Range(-30f, 30f);
                data.velocityAngle = (float)Rand.Range(30, 40);
                data.spawnPosition = loc;
                data.velocitySpeed = Rand.Range(0.5f, 0.7f);
                if (color.HasValue)
                {
                    data.instanceColor = color.Value;
                    //    moteThrown.instanceColor = new Color(0.368f, 0f, 1f);
                }
                if (exactRotation.HasValue)
                {
                    data.rotation += exactRotation.Value;
                }
                map.flecks.CreateFleck(data);
            }
        }
        public void ImpactEffects(Vector3 pos, Map map, ThingDef explosionMoteDef, float ExplosionMoteSize, Color?color, SoundDef sound, FleckDef ImpactMoteDef, float ImpactMoteSize, FleckDef ImpactGlowMoteDef, float ImpactGlowMoteSize, Thing hitThing = null, Thing projectile = null, int OverrideSolidTime = -1)
        {
            Rand.PushState();
            FleckDef impactMoteDef = ImpactMoteDef ?? this.ImpactMoteDef;
            float    rotationRate  = Rand.Range(-30f, 30f);
            float    VelocityAngel = (float)Rand.Range(0, 360);
            float    VelocitySpeed = Rand.Range(0.48f, 0.72f);

            Rand.PopState();
            if (ImpactGlowMoteDef != null)
            {
                try
                {
                    AdeptusFleckMaker.ThrowGlow(pos, map, ImpactGlowMoteSize, ImpactGlowMoteDef);

                    /*
                     * mote.instanceColor.r = color.Value.r * 0.25f;
                     * mote.instanceColor.g = color.Value.g * 0.25f;
                     * mote.instanceColor.b = color.Value.b * 0.25f;
                     */
                }
                catch (System.Exception)
                {
                    //     Log.Message("Waaah "+ projectile + " ImpactGlowMoteDef broke Vs " + hitThing);
                }
            }
            if (explosionMoteDef != null)
            {
                try
                {
                    Vector3 loc = pos;
                    loc.y = explosionMoteDef.Altitude;
                    MoteThrown moteThrown;
                    moteThrown       = (MoteThrown)ThingMaker.MakeThing(explosionMoteDef, null);
                    moteThrown.Scale = ExplosionMoteSize;
                    Rand.PushState();
                    moteThrown.rotationRate = Rand.Range(-30f, 30f);
                    Rand.PopState();
                    moteThrown.exactPosition = loc;
                    moteThrown.instanceColor = color.Value;
                    moteThrown.SetVelocity(VelocityAngel, VelocitySpeed);
                    if (OverrideSolidTime > -1)
                    {
                        moteThrown.solidTimeOverride = OverrideSolidTime;
                    }
                    GenSpawn.Spawn(moteThrown, loc.ToIntVec3(), map, WipeMode.Vanish);
                }
                catch (System.Exception)
                {
                    //     Log.Message("Waaah " + projectile + " explosionMoteDef broke Vs " + hitThing);
                }
            }
            if (ImpactMoteDef != null)
            {
                try
                {
                    Vector3 loc = pos;
                    if (hitThing != null && hitThing is Pawn pawn)
                    {
                        impactMoteDef = DefDatabase <FleckDef> .GetNamedSilentFail("AdeptusMechanicus_Mote_Blood_Puff");

                        if (sound != null)
                        {
                            sound.PlayOneShot(new TargetInfo(loc.ToIntVec3(), map, false));
                        }
                        AdeptusFleckMaker.Thrown(loc, map, impactMoteDef, ImpactMoteSize, pawn.RaceProps.BloodDef?.graphic.color, null, Rand.Range(-30f, 30f), OverrideSolidTime > -1 ? (float?)OverrideSolidTime : null, VelocityAngel, VelocitySpeed);
                    }
                    else
                    {
                        Color c = Color.white;
                        if (color.HasValue)
                        {
                            c.r = color.Value.r * 0.25f;
                            c.g = color.Value.g * 0.25f;
                            c.b = color.Value.b * 0.25f;
                        }
                        AdeptusFleckMaker.Thrown(loc, map, impactMoteDef, ImpactGlowMoteSize, c, null, Rand.Range(-30f, 30f), OverrideSolidTime > -1 ? (float?)OverrideSolidTime : null, VelocityAngel, VelocitySpeed);
                    }
                }
                catch (System.Exception)
                {
                    //     Log.Message("Waaah " + projectile + " ImpactMoteDef broke Vs "+hitThing);
                }
            }
        }