public float ExplosiveRadius() { HediffCompProperties_DetonateOnDeath props = this.Props; float num = props.explosiveRadius; if (props.explosiveExpandPerSeverity > 0f) { num += Mathf.Sqrt((float)1 * props.explosiveExpandPerSeverity); } return(num); }
protected void Detonate(Map map, bool ignoreUnspawned = false, bool kill = true) { if (!ignoreUnspawned && !this.parent.pawn.SpawnedOrAnyParentSpawned) { return; } HediffCompProperties_DetonateOnDeath props = this.Props; float num = this.ExplosiveRadius(); if (props.destroyThingOnExplosionSize <= num && !this.parent.pawn.Destroyed) { this.destroyedThroughDetonation = true; if (!this.parent.pawn.Dead && kill) { this.parent.pawn.Kill(null, null); } } this.EndWickSustainer(); this.wickStarted = false; if (map == null) { Log.Warning("Tried to detonate HediffComp_DetonateOnDeath in a null map."); return; } ; if (props.explosionEffect != null) { Effecter effecter = props.explosionEffect.Spawn(); effecter.Trigger(new TargetInfo(this.parent.pawn.PositionHeld, map, false), new TargetInfo(this.parent.pawn.PositionHeld, map, false)); effecter.Cleanup(); } Thing parent; if (this.instigator != null && !this.instigator.HostileTo(this.parent.pawn.Faction)) { parent = this.instigator; } else { parent = this.parent.pawn; } DamageDef dmg = props.explosiveDamageType ?? DamageDefOf.Bomb; GenExplosion.DoExplosion(this.parent.pawn.PositionHeld, map, num, dmg, parent, props.damageAmountBase > 0 ? props.damageAmountBase : dmg.defaultDamage, props.armorPenetrationBase, props.explosionSound ?? dmg.soundExplosion, null, null, null, props.postExplosionSpawnThingDef, props.postExplosionSpawnChance, props.postExplosionSpawnThingCount, props.applyDamageToExplosionCellsNeighbors, props.preExplosionSpawnThingDef, props.preExplosionSpawnChance, props.preExplosionSpawnThingCount, props.chanceToStartFire, props.damageFalloff, null, null); }