コード例 #1
0
        // Token: 0x06005118 RID: 20760 RVA: 0x001B35EC File Offset: 0x001B17EC
        public float ExplosiveRadius()
        {
            CompProperties_SporeMine props = this.Props;
            float num = props.explosiveRadius;

            if (this.parent.stackCount > 1 && props.explosiveExpandPerStackcount > 0f)
            {
                num += Mathf.Sqrt((float)(this.parent.stackCount - 1) * props.explosiveExpandPerStackcount);
            }
            if (props.explosiveExpandPerFuel > 0f && this.parent.GetComp <CompRefuelable>() != null)
            {
                num += Mathf.Sqrt(this.parent.GetComp <CompRefuelable>().Fuel *props.explosiveExpandPerFuel);
            }
            return(num);
        }
コード例 #2
0
        public void Detonate(Corpse corpse, IntVec3 position)
        {
            Pawn  innerPawn = corpse.InnerPawn;
            float radius;

            if (corpse.InnerPawn.ageTracker.CurLifeStageIndex == 0)
            {
                radius = 1.9f;
            }
            else if (corpse.InnerPawn.ageTracker.CurLifeStageIndex == 1)
            {
                radius = 4.9f;
            }
            else
            {
                radius = 2.9f;
            };
            this.map = corpse.Map;
            DamageDef damage                   = DamageDefOf.Flame;
            int       damageAmount             = 0;
            float     ap                       = 0f;
            CompProperties_SporeMine explosive = innerPawn.def.GetCompProperties <CompProperties_SporeMine>();

            if (explosive != null)
            {
                damage       = explosive.explosiveDamageType;
                radius       = explosive.explosiveRadius;
                damageAmount = explosive.explosiveDamageType.defaultDamage;
                ap           = explosive.explosiveDamageType.defaultArmorPenetration;
            }

            /*
             * if (innerPawn.def == OGTyranidDefOf.Tyranid_SporeMine_HE)
             * {
             *      damage = DamageDefOf.Bomb;
             * }
             * Log.Message("PawnDied 10");
             * Log.Message("position " + position.ToString());
             * Log.Message("map " + this.map.ToString());
             * Log.Message("radius " + radius.ToString());
             * Log.Message("damage " + damage.ToString());
             * Log.Message("InnerPawn " + corpse.InnerPawn.ToString());
             * Log.Message("defaultDamage " + damageAmount.ToString());
             * Log.Message("defaultArmorPenetration " + ap.ToString());
             */
            GenExplosion.DoExplosion(position, this.map, radius, damage, corpse.InnerPawn, damageAmount, ap, null, null, null, null, null, 0f, 1, false, null, 0f, 1, 0f, false, null, null);
        }
コード例 #3
0
        // Token: 0x06005119 RID: 20761 RVA: 0x001B367C File Offset: 0x001B187C
        public void Detonate(Map map, bool ignoreUnspawned = false)
        {
            if (!ignoreUnspawned && !this.parent.SpawnedOrAnyParentSpawned)
            {
                return;
            }
            CompProperties_SporeMine props = this.Props;
            float num = this.ExplosiveRadius();

            if (props.explosiveExpandPerFuel > 0f && this.parent.GetComp <CompRefuelable>() != null)
            {
                this.parent.GetComp <CompRefuelable>().ConsumeFuel(this.parent.GetComp <CompRefuelable>().Fuel);
            }
            if (props.destroyThingOnExplosionSize <= num && !this.parent.Destroyed)
            {
                this.destroyedThroughDetonation = true;
                this.parent.Kill(null, null);
            }
            this.EndWickSustainer();
            this.wickStarted = false;
            if (map == null)
            {
                Log.Warning("Tried to detonate CompExplosive in a null map.", false);
                return;
            }

            /*
             * if (props.explosionEffect != null)
             * {
             *      Effecter effecter = props.explosionEffect.Spawn();
             *      effecter.Trigger(new TargetInfo(this.parent.PositionHeld, map, false), new TargetInfo(this.parent.PositionHeld, map, false));
             *      effecter.Cleanup();
             * }
             * Thing parent;
             * if (this.instigator != null && !this.instigator.HostileTo(this.parent.Faction))
             * {
             *      parent = this.instigator;
             * }
             * else
             * {
             *      parent = this.parent;
             * }
             * GenExplosion.DoExplosion(this.parent.PositionHeld, map, num, props.explosiveDamageType, parent, props.damageAmountBase, props.armorPenetrationBase, props.explosionSound, null, null, null, props.postExplosionSpawnThingDef, props.postExplosionSpawnChance, props.postExplosionSpawnThingCount, props.applyDamageToExplosionCellsNeighbors, props.preExplosionSpawnThingDef, props.preExplosionSpawnChance, props.preExplosionSpawnThingCount, props.chanceToStartFire, props.damageFalloff, null, this.thingsIgnoredByExplosion);
             */
        }