protected virtual void defaultDamageThing(Explosion explosion, Thing t, List <Thing> damagedThings, IntVec3 cell) { if (t.def.category != ThingCategory.Mote && t.def.category != ThingCategory.Ethereal) { if (!damagedThings.Contains(t)) { damagedThings.Add(t); if (this.def == DamageDefOf.Bomb && t.def == ThingDefOf.Fire && !t.Destroyed) { t.Destroy(DestroyMode.Vanish); } else { float num; if (t.Position == explosion.Position) { num = (float)Rand.RangeInclusive(0, 359); } else { num = (t.Position - explosion.Position).AngleFlat; } DamageDef damageDef = this.def; float amount = (float)explosion.GetDamageAmountAt(cell); float armorPenetrationAt = explosion.GetArmorPenetrationAt(cell); float angle = num; Thing instigator = explosion.instigator; ThingDef weapon = explosion.weapon; DamageInfo dinfo = new DamageInfo(damageDef, amount, armorPenetrationAt, angle, instigator, null, weapon, DamageInfo.SourceCategory.ThingOrUnknown, explosion.intendedTarget); if (this.def.explosionAffectOutsidePartsOnly) { dinfo.SetBodyRegion(BodyPartHeight.Undefined, BodyPartDepth.Outside); } if (t.def.category == ThingCategory.Building) { int num2 = Mathf.RoundToInt(dinfo.Amount * this.def.explosionBuildingDamageFactor); dinfo.SetAmount((float)num2); } else if (t.def.category == ThingCategory.Plant) { int num3 = Mathf.RoundToInt(dinfo.Amount * this.def.explosionPlantDamageFactor); dinfo.SetAmount((float)num3); } BattleLogEntry_ExplosionImpact battleLogEntry_ExplosionImpact = null; Pawn pawn = t as Pawn; if (pawn != null) { battleLogEntry_ExplosionImpact = new BattleLogEntry_ExplosionImpact(explosion.instigator, t, explosion.weapon, explosion.projectile, this.def); Find.BattleLog.Add(battleLogEntry_ExplosionImpact); } DamageWorker.DamageResult damageResult = t.TakeDamage(dinfo); damageResult.AssociateWithLog(battleLogEntry_ExplosionImpact); if (pawn != null && damageResult.wounded && pawn.stances != null) { pawn.stances.StaggerFor(95); } } } } }
protected virtual void ExplosionDamageThing(Explosion explosion, Thing t, List <Thing> damagedThings, IntVec3 cell) { if (t.def.category == ThingCategory.Mote) { return; } if (damagedThings.Contains(t)) { return; } damagedThings.Add(t); if (this.def == DamageDefOf.Bomb && t.def == ThingDefOf.Fire && !t.Destroyed) { t.Destroy(DestroyMode.Vanish); return; } float num; if (t.Position == explosion.Position) { num = (float)Rand.RangeInclusive(0, 359); } else { num = (t.Position - explosion.Position).AngleFlat; } DamageDef damageDef = this.def; int amount = explosion.GetDamageAmountAt(cell); float angle = num; Thing instigator = explosion.instigator; ThingDef weapon = explosion.weapon; DamageInfo dinfo = new DamageInfo(damageDef, amount, angle, instigator, null, weapon, DamageInfo.SourceCategory.ThingOrUnknown); if (this.def.explosionAffectOutsidePartsOnly) { dinfo.SetBodyRegion(BodyPartHeight.Undefined, BodyPartDepth.Outside); } if (t.def.category == ThingCategory.Building) { int num2 = Mathf.RoundToInt((float)dinfo.Amount * this.def.explosionBuildingDamageFactor); damageDef = this.def; amount = num2; angle = dinfo.Angle; instigator = explosion.instigator; weapon = dinfo.Weapon; dinfo = new DamageInfo(damageDef, amount, angle, instigator, null, weapon, DamageInfo.SourceCategory.ThingOrUnknown); } BattleLogEntry_ExplosionImpact battleLogEntry_ExplosionImpact = null; if (t is Pawn) { battleLogEntry_ExplosionImpact = new BattleLogEntry_ExplosionImpact(explosion.instigator, t, explosion.weapon, explosion.projectile, this.def); Find.BattleLog.Add(battleLogEntry_ExplosionImpact); } t.TakeDamage(dinfo).InsertIntoLog(battleLogEntry_ExplosionImpact); }
// Token: 0x060004DA RID: 1242 RVA: 0x000187A4 File Offset: 0x000169A4 protected override void ExplosionDamageThing(Explosion explosion, Thing t, List <Thing> damagedThings, List <Thing> ignoredThings, IntVec3 cell) { if (t.def.category == ThingCategory.Mote || t.def.category == ThingCategory.Ethereal) { return; } if (damagedThings.Contains(t)) { return; } damagedThings.Add(t); if (ignoredThings != null && ignoredThings.Contains(t)) { return; } if (this.def == DamageDefOf.Bomb && t.def == ThingDefOf.Fire && !t.Destroyed) { t.Destroy(DestroyMode.Vanish); return; } float angle; if (t.Position == explosion.Position) { angle = (float)Rand.RangeInclusive(0, 359); } else { angle = (t.Position - explosion.Position).AngleFlat; } DamageInfo dinfo = new DamageInfo(this.def, (float)explosion.GetDamageAmountAt(cell), explosion.GetArmorPenetrationAt(cell), angle, explosion.instigator, null, explosion.weapon, DamageInfo.SourceCategory.ThingOrUnknown, explosion.intendedTarget); if (this.def.explosionAffectOutsidePartsOnly) { dinfo.SetBodyRegion(BodyPartHeight.Undefined, BodyPartDepth.Outside); } BattleLogEntry_ExplosionImpact battleLogEntry_ExplosionImpact = null; Pawn pawn = t as Pawn; if (pawn != null) { battleLogEntry_ExplosionImpact = new BattleLogEntry_ExplosionImpact(explosion.instigator, t, explosion.weapon, explosion.projectile, this.def); Find.BattleLog.Add(battleLogEntry_ExplosionImpact); } DamageWorker.DamageResult damageResult = t.TakeDamage(dinfo); damageResult.AssociateWithLog(battleLogEntry_ExplosionImpact); if (pawn != null && damageResult.wounded && pawn.stances != null) { pawn.stances.StaggerFor(95); } }