protected override void SpawnThings()
        {
            int delayTicks = (int)(GenDate.TicksPerHour * Rand.Range(4f, 8f));

            for (int i = this.innerContainer.Count - 1; i >= 0; i--)
            {
                if (rot == Rot4.Invalid)
                {
                    rot = this.innerContainer[i].def.defaultPlacingRot;
                }
                CompCanBeDormant compDormant = this.innerContainer[i].TryGetComp <CompCanBeDormant>();
                if (compDormant != null)
                {
                    compDormant.wokeUpTick = Find.TickManager.TicksGame + delayTicks;
                }
                GenPlace.TryPlaceThing(this.innerContainer[i], base.Position, base.Map, ThingPlaceMode.Direct, delegate(Thing thing, int count)
                {
                    PawnUtility.RecoverFromUnwalkablePositionOrKill(thing.Position, thing.Map);
                    if (thing.def.Fillage == FillCategory.Full && this.def.skyfaller.CausesExplosion && this.def.skyfaller.explosionDamage.isExplosive && thing.Position.InHorDistOf(base.Position, this.def.skyfaller.explosionRadius))
                    {
                        base.Map.terrainGrid.Notify_TerrainDestroyed(thing.Position);
                    }
                }, null, rot);
            }
        }
示例#2
0
        // Token: 0x0600004B RID: 75 RVA: 0x00004318 File Offset: 0x00002518
        private void EjectPilot()
        {
            var pilot = GetThingForGraphic();

            if (pilot != null)
            {
                GenPlace.TryPlaceThing(pilot, Position, Map, ThingPlaceMode.Near, delegate(Thing thing, int _)
                {
                    PawnUtility.RecoverFromUnwalkablePositionOrKill(thing.Position, thing.Map);
                    if (thing.def.Fillage == FillCategory.Full && def.skyfaller.CausesExplosion &&
                        thing.Position.InHorDistOf(Position, def.skyfaller.explosionRadius))
                    {
                        Map.terrainGrid.Notify_TerrainDestroyed(thing.Position);
                    }

                    CheckDrafting(thing);
                    JPInjury.CheckDFA(thing, Position);
                    CheckAndApplyPostInjury(thing);
                    if (Settings.CooldownTime > 0)
                    {
                        JPApplyCooldown(thing, Math.Min(10, Settings.CooldownTime));
                    }
                });
            }
        }
        private void EjectPawn()
        {
            Pawn pawn = GetInnerPawn();

            if (pawn != null)
            {
                GenPlace.TryPlaceThing(pawn, base.Position, base.Map, ThingPlaceMode.Near, delegate(Thing thing, int count)
                {
                    PawnUtility.RecoverFromUnwalkablePositionOrKill(thing.Position, thing.Map);
                }, null, default(Rot4));
            }
        }
示例#4
0
        // Token: 0x06000052 RID: 82 RVA: 0x000045CC File Offset: 0x000027CC
        public void JPImpact()
        {
            if (def.skyfaller.CausesExplosion)
            {
                GenExplosion.DoExplosion(Position, Map, def.skyfaller.explosionRadius, def.skyfaller.explosionDamage,
                                         null,
                                         GenMath.RoundRandom(def.skyfaller.explosionDamage.defaultDamage *
                                                             def.skyfaller.explosionDamageFactor));
            }

            for (var num = innerContainer.Count - 1; num >= 0; num--)
            {
                GenPlace.TryPlaceThing(innerContainer[num], Position, Map, ThingPlaceMode.Near,
                                       delegate(Thing thing, int _)
                {
                    PawnUtility.RecoverFromUnwalkablePositionOrKill(thing.Position, thing.Map);
                    if (thing.def.Fillage == FillCategory.Full && def.skyfaller.CausesExplosion &&
                        thing.Position.InHorDistOf(Position, def.skyfaller.explosionRadius))
                    {
                        Map.terrainGrid.Notify_TerrainDestroyed(thing.Position);
                    }
                });
            }

            innerContainer.ClearAndDestroyContents();
            var cellRect = this.OccupiedRect();

            for (var i = 0; i < cellRect.Area * def.skyfaller.motesPerCell; i++)
            {
                FleckMaker.ThrowDustPuff(cellRect.RandomVector3, Map, 2f);
            }

            if (def.skyfaller.MakesShrapnel)
            {
                SkyfallerShrapnelUtility.MakeShrapnel(Position, Map, shrapnelDirection,
                                                      def.skyfaller.shrapnelDistanceFactor, def.skyfaller.metalShrapnelCountRange.RandomInRange,
                                                      def.skyfaller.rubbleShrapnelCountRange.RandomInRange, true);
            }

            if (def.skyfaller.cameraShake > 0f && Map == Find.CurrentMap)
            {
                Find.CameraDriver.shaker.DoShake(def.skyfaller.cameraShake);
            }

            def.skyfaller.impactSound?.PlayOneShot(SoundInfo.InMap(new TargetInfo(Position, Map)));

            Destroy();
        }
 protected override void Impact()
 {
     for (int i = this.innerContainer.Count - 1; i >= 0; i--)
     {
         GenPlace.TryPlaceThing(this.innerContainer[i], base.Position, base.Map, ThingPlaceMode.Near, delegate(Thing thing, int count)
         {
             PawnUtility.RecoverFromUnwalkablePositionOrKill(thing.Position, thing.Map);
         }, null, default(Rot4));
     }
     this.innerContainer.ClearAndDestroyContents(0);
     if (this.def.skyfaller.impactSound != null)
     {
         SoundStarter.PlayOneShot(this.def.skyfaller.impactSound, SoundInfo.InMap(new TargetInfo(base.Position, base.Map, false), 0));
     }
     this.Destroy(0);
 }
示例#6
0
        private void EjectPilot()
        {
            Thing     thingForGraphic = this.GetThingForGraphic();
            HarpyComp comp            = thingForGraphic.TryGetComp <HarpyComp>();
            bool      flag            = thingForGraphic != null;

            if (flag)
            {
                GenPlace.TryPlaceThing(thingForGraphic, base.Position, base.Map, ThingPlaceMode.Near, delegate(Thing t, int count)
                {
                    PawnUtility.RecoverFromUnwalkablePositionOrKill(t.Position, t.Map);
                    bool flag2 = t.def.Fillage == FillCategory.Full && this.def.skyfaller.CausesExplosion && this.def.skyfaller.explosionDamage.isExplosive && t.Position.InHorDistOf(this.Position, this.def.skyfaller.explosionRadius);
                    if (flag2)
                    {
                        this.Map.terrainGrid.Notify_TerrainDestroyed(t.Position);
                    }
                    this.CheckDrafting(t);
                    comp.TriggerCooldown();
                }, null, default(Rot4));
            }
        }
示例#7
0
        // Token: 0x06000052 RID: 82 RVA: 0x000045CC File Offset: 0x000027CC
        public void JPImpact()
        {
            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, null);
            }
            for (int num = this.innerContainer.Count - 1; num >= 0; num--)
            {
                GenPlace.TryPlaceThing(this.innerContainer[num], base.Position, base.Map, ThingPlaceMode.Near, delegate(Thing thing, int count)
                {
                    PawnUtility.RecoverFromUnwalkablePositionOrKill(thing.Position, thing.Map);
                    if (thing.def.Fillage == FillCategory.Full && this.def.skyfaller.CausesExplosion && thing.Position.InHorDistOf(base.Position, this.def.skyfaller.explosionRadius))
                    {
                        base.Map.terrainGrid.Notify_TerrainDestroyed(thing.Position);
                    }
                }, null, default);
            }
            this.innerContainer.ClearAndDestroyContents(0);
            CellRect cellRect = GenAdj.OccupiedRect(this);

            for (int i = 0; i < cellRect.Area * this.def.skyfaller.motesPerCell; i++)
            {
                MoteMaker.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)
            {
                SoundStarter.PlayOneShot(this.def.skyfaller.impactSound, SoundInfo.InMap(new TargetInfo(base.Position, base.Map, false), 0));
            }
            this.Destroy(0);
        }