public static void DoExplosion(Building culprit)
        {
            GasPipeNet pipeNet = culprit.GetComp <CompPipe>().GasPipeNet;
            Map        map     = culprit.Map;
            float      num     = 0f;
            float      num2    = 0f;
            bool       flag    = false;

            if (pipeNet.batteryComps.Any((CompPipeTank x) => x.StoredEnergy > 20f))
            {
                GasExplosionUtility.DrainBatteriesAndCauseExplosion(pipeNet, culprit, out num, out num2);
            }
            else
            {
                flag = GasExplosionUtility.TryStartFireNear(culprit);
            }
            string value;

            if (culprit.def == ThingDef.Named("VPE_GasPipe"))
            {
                value = "VPE_AGasPipe".Translate();
            }
            else
            {
                value = Find.ActiveLanguageWorker.WithIndefiniteArticlePostProcessed(culprit.Label, false, false);
            }
            StringBuilder stringBuilder = new StringBuilder();

            if (flag)
            {
                stringBuilder.Append("VPE_GasExplosionStartedFire".Translate(value));
            }
            else
            {
                stringBuilder.Append("VPE_GasExplosion".Translate(value));
            }
            if (num > 0f)
            {
                stringBuilder.AppendLine();
                stringBuilder.AppendLine();
                stringBuilder.Append("VPE_GasExplosionLostGas".Translate(num.ToString("F0")));
            }
            if (num2 > 5f)
            {
                stringBuilder.AppendLine();
                stringBuilder.AppendLine();
                stringBuilder.Append("VPE_GasExplosionLWasLarge".Translate());
            }
            if (num2 > 8f)
            {
                stringBuilder.AppendLine();
                stringBuilder.AppendLine();
                stringBuilder.Append("VPE_GasExplosionLWasHuge".Translate());
            }
            Find.LetterStack.ReceiveLetter("VPE_LetterLabelGasExplosion".Translate(), stringBuilder.ToString(), LetterDefOf.NegativeEvent, new TargetInfo(culprit.Position, map, false), null, null, null, null);
        }
        protected override bool TryExecuteWorker(IncidentParms parms)
        {
            Building culprit;

            if (!GasExplosionUtility.GetExplodableGasConduits((Map)parms.target).TryRandomElement(out culprit))
            {
                return(false);
            }
            GasExplosionUtility.DoExplosion(culprit);
            return(true);
        }
 protected override bool CanFireNowSub(IncidentParms parms)
 {
     return(GasExplosionUtility.GetExplodableGasConduits((Map)parms.target).Any <Building>());
 }