Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions Source/CombatExtended/CombatExtended/Things/AmmoThing.cs
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,10 @@ public override void PreApplyDamage(ref DamageInfo dinfo, out bool absorbed)
{
numToCookOff += Mathf.RoundToInt(def.stackLimit * ((float)dinfo.Amount / HitPoints) * (def.smallVolume ? Rand.Range(1f, 2f) : Rand.Range(0.0f, 1f)));
}
//Assume CompExplosive destroys on kill
else if (this.TryGetComp<CompExplosive>() == null || !this.TryGetComp<CompExplosive>().Props.explodeOnKilled)
//Explosives detonate when destroyed by external damage.
else
{
TryDetonate(stackCount);
TryDetonate(stackCount, true);
}
}
}
Expand Down Expand Up @@ -109,7 +109,7 @@ public override string GetInspectString()
return stringBuilder.ToString().TrimEndNewlines();
}

private bool TryDetonate(float stackCountScale = 1)
private bool TryDetonate(float stackCountScale = 1, bool force = false)
{
if (Find.Maps.IndexOf(Map) < 0)
{
Expand All @@ -121,7 +121,7 @@ private bool TryDetonate(float stackCountScale = 1)

if (comp != null || detProps != null)
{
if (Rand.Chance(Mathf.Clamp01(0.75f - Mathf.Pow(HitPoints / MaxHitPoints, 2))))
if (force || Rand.Chance(Mathf.Clamp01(0.75f - Mathf.Pow(HitPoints / MaxHitPoints, 2))))
{
if (comp != null)
{
Expand Down
Loading