// Token: 0x06000043 RID: 67 RVA: 0x00003B1C File Offset: 0x00001D1C internal static void DoJPExplosion(Pawn pilot, int fuel, ThingDef fueldef) { if (fueldef.GetCompProperties <CompProperties_Explosive>() != null) { CompProperties_Explosive compfueldef = fueldef.GetCompProperties <CompProperties_Explosive>(); float radius = compfueldef.explosiveRadius + compfueldef.explosiveExpandPerStackcount * (float)fuel; DamageDef dmgdef = compfueldef.explosiveDamageType; ThingDef preThingDef = compfueldef.preExplosionSpawnThingDef; ThingDef postThingDef = ThingDefOf.Mote_Smoke; int dmg = (int)((float)fuel * JPInjury.GetBoomFactor(fueldef)); GenExplosion.DoExplosion(pilot.Position, pilot.Map, radius, dmgdef, pilot, dmg, -1f, null, null, null, null, postThingDef, 1f, 2, false, preThingDef, 1f, 1, 0.9f, true, null, null); } }
public override void ResolveReferences(HediffDef parent) { knockImpactDamageType ??= DamageDefOf.Blunt; if (explosiveProps == null && #pragma warning disable CS0618 // Type or member is obsolete explosiveKnockback) #pragma warning restore CS0618 // Type or member is obsolete { explosiveProps = new CompProperties_Explosive { #pragma warning disable CS0618 // Type or member is obsolete explosiveDamageType = explosionDmg, explosiveRadius = explosionSize, #pragma warning restore CS0618 // Type or member is obsolete damageAmountBase = 0, }; } }
protected static Boolean Detonate_Prefix(ref CompExplosive __instance, Map map) { Log.Message("Detonate"); Patch.LogNULL(map, "map"); if (__instance.parent.SpawnedOrAnyParentSpawned) { //Cache Position before Killing parent. IntVec3 _Position = __instance.parent.PositionHeld; CompProperties_Explosive props = __instance.Props; float num = __instance.ExplosiveRadius(); if (props.explosiveExpandPerFuel > 0f && __instance.parent.GetComp <CompRefuelable>() != null) { __instance.parent.GetComp <CompRefuelable>().ConsumeFuel(__instance.parent.GetComp <CompRefuelable>().Fuel); } if (props.destroyThingOnExplosionSize <= num && !__instance.parent.Destroyed) { __instance.destroyedThroughDetonation = true; __instance.parent.Kill(null, null); } //__instance.EndWickSustainer(); //EndWickSustainer is Private so use Reflection to invoke the method. MethodInfo _EndWickSustainer = typeof(CompExplosive).GetMethod("EndWickSustainer", BindingFlags.NonPublic | BindingFlags.Instance); Patch.LogNULL(_EndWickSustainer, "_EndWickSustainer"); if (_EndWickSustainer != null) { _EndWickSustainer.Invoke(__instance, null); } __instance.wickStarted = false; if (map == null) { Log.Warning("Tried to detonate CompExplosive in a null map.", false); } else { if (props.explosionEffect != null) { Effecter effecter = props.explosionEffect.Spawn(); //effecter.Trigger(new TargetInfo(__instance.parent.PositionHeld, map, false), new TargetInfo(__instance.parent.PositionHeld, map, false)); effecter.Trigger(new TargetInfo(_Position, map, false), new TargetInfo(_Position, map, false)); effecter.Cleanup(); } IntVec3 positionHeld = __instance.parent.PositionHeld; float radius = num; DamageDef explosiveDamageType = props.explosiveDamageType; //Get the instigator unsing Reflection because it is private FieldInfo _Instigator = typeof(CompExplosive).GetField("instigator", BindingFlags.NonPublic | BindingFlags.Instance); Patch.LogNULL(_Instigator, "_Instigator"); Thing _InstigatorValue = (Thing)_Instigator.GetValue(__instance); Thing thing = _InstigatorValue ?? __instance.parent; int damageAmountBase = props.damageAmountBase; float armorPenetrationBase = props.armorPenetrationBase; SoundDef explosionSound = props.explosionSound; ThingDef postExplosionSpawnThingDef = props.postExplosionSpawnThingDef; float postExplosionSpawnChance = props.postExplosionSpawnChance; int postExplosionSpawnThingCount = props.postExplosionSpawnThingCount; // GenExplosion.DoExplosion(positionHeld, map, radius, explosiveDamageType, thing, damageAmountBase, armorPenetrationBase, explosionSound, null, null, null, postExplosionSpawnThingDef, postExplosionSpawnChance, postExplosionSpawnThingCount, props.applyDamageToExplosionCellsNeighbors, props.preExplosionSpawnThingDef, props.preExplosionSpawnChance, props.preExplosionSpawnThingCount, props.chanceToStartFire, props.damageFalloff); GenExplosion.DoExplosion(_Position, map, radius, explosiveDamageType, thing, damageAmountBase, armorPenetrationBase, explosionSound, null, null, null, postExplosionSpawnThingDef, postExplosionSpawnChance, postExplosionSpawnThingCount, props.applyDamageToExplosionCellsNeighbors, props.preExplosionSpawnThingDef, props.preExplosionSpawnChance, props.preExplosionSpawnThingCount, props.chanceToStartFire, props.damageFalloff); } } return(false); }
private static SoundDef GetExplosionSound(CompProperties_Explosive props) { return(props.explosionSound ?? props.explosiveDamageType.soundExplosion); }