// Token: 0x06000027 RID: 39 RVA: 0x00002B44 File Offset: 0x00000D44 public void UseJetPack(Pawn pilot, Thing JP, IntVec3 targCell) { if (!this.JPComposMentis(pilot, JP, out string Reason)) { Messages.Message(TranslatorFormattedStringExtensions.Translate("JetPack.CantDo", pilot, Reason), pilot, MessageTypeDefOf.NeutralEvent, false); SoundStarter.PlayOneShotOnCamera(SoundDefOf.ClickReject, null); return; } if (!this.FlightChecksOK(pilot, JP, out string ChecksReason)) { Messages.Message(TranslatorFormattedStringExtensions.Translate("JetPack.ChecksReason", GenText.CapitalizeFirst(pilot.LabelShort), ChecksReason), pilot, MessageTypeDefOf.NeutralEvent, false); SoundStarter.PlayOneShotOnCamera(SoundDefOf.ClickReject, null); return; } if (JPUtility.ChkForDissallowed(pilot, out string DAllowReason)) { Messages.Message(TranslatorFormattedStringExtensions.Translate("JetPack.DAllowReason", GenText.CapitalizeFirst(pilot.LabelShort), DAllowReason), pilot, MessageTypeDefOf.NeutralEvent, false); SoundStarter.PlayOneShotOnCamera(SoundDefOf.ClickReject, null); return; } if (!this.FlightCellCheck(pilot, targCell, this.JPFuelAmount, this.JPFuelRate, this.JPJumpRangeMin, this.JPJumpRangeMax, out string JumpReason)) { Messages.Message(TranslatorFormattedStringExtensions.Translate("JetPack.JumpReason", JumpReason), pilot, MessageTypeDefOf.NeutralEvent, false); SoundStarter.PlayOneShotOnCamera(SoundDefOf.ClickReject, null); return; } if (!JPInjury.CheckForExplosion(this)) { this.DoJumpJet(pilot, targCell); return; } JPInjury.DoJPExplosion(pilot, this.JPFuelAmount, this.JPFuelItem); this.JPFuelAmount = 0; }
// Token: 0x06000045 RID: 69 RVA: 0x00003BF8 File Offset: 0x00001DF8 internal static void CheckDFA(Thing instigator, IntVec3 DFACell) { if (Settings.ApplyDFA && instigator != null && (instigator?.Map) != null) { bool DFA = false; bool injuryFull = false; if (JPInjury.DFAEvent(DFACell, instigator, true)) { DFA = true; injuryFull = true; } if (Settings.ApplyDFASplash) { List <IntVec3> neighbours = GenRadial.RadialCellsAround(DFACell, 1.5f, false).ToList <IntVec3>(); if (neighbours.Count > 0) { foreach (IntVec3 neighbour in neighbours) { if (GenGrid.InBounds(neighbour, instigator.Map) && JPInjury.DFAEvent(neighbour, instigator, false)) { DFA = true; } } } } if (DFA) { JPInjury.DoJPRelatedInjury(instigator, false, true, null, injuryFull); } } }
// Token: 0x0600004B RID: 75 RVA: 0x00004318 File Offset: 0x00002518 private void EjectPilot() { var pilot = GetThingForGraphic(); if (pilot != null) { GenPlace.TryPlaceThing(pilot, Position, Map, ThingPlaceMode.Near, delegate(Thing thing, int _) { PawnUtility.RecoverFromUnwalkablePositionOrKill(thing.Position, thing.Map); if (thing.def.Fillage == FillCategory.Full && def.skyfaller.CausesExplosion && thing.Position.InHorDistOf(Position, def.skyfaller.explosionRadius)) { Map.terrainGrid.Notify_TerrainDestroyed(thing.Position); } CheckDrafting(thing); JPInjury.CheckDFA(thing, Position); CheckAndApplyPostInjury(thing); if (Settings.CooldownTime > 0) { JPApplyCooldown(thing, Math.Min(10, Settings.CooldownTime)); } }); } }
// 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); } }
// Token: 0x0600004D RID: 77 RVA: 0x00004390 File Offset: 0x00002590 internal void CheckAndApplyPostInjury(Thing pilot) { if (this.PilotRoofPunchUp) { JPInjury.DoJPRelatedInjury(pilot, true, false, null, false); this.PilotRoofPunchUp = false; } if (this.PilotRoofPunchDown) { JPInjury.DoJPRelatedInjury(pilot, false, false, null, true); this.PilotRoofPunchDown = false; } }
// Token: 0x06000047 RID: 71 RVA: 0x00003D24 File Offset: 0x00001F24 public static void DoJPRelatedInjury(Thing victim, bool headSpace, bool isDFA, Thing instigator, bool fullDmg) { if (victim is Pawn) { JPInjury.SetUpInjVars(victim as Pawn, headSpace, isDFA, instigator, out BodyPartRecord candidate, out float injChance, out DamageDef DamDef, out float dmg); if (candidate != null && Rand.Range(1f, 100f) <= injChance) { float armPen = 0f; if (!fullDmg) { dmg = Math.Max(1f, dmg * (Settings.DFASplashFactor / 100f)); } DamageInfo dinfo = new DamageInfo(DamDef, dmg, armPen, -1f, instigator, candidate, null, 0, null); (victim as Pawn).TakeDamage(dinfo); } } }
// Token: 0x06000046 RID: 70 RVA: 0x00003CC0 File Offset: 0x00001EC0 internal static bool DFAEvent(IntVec3 cell, Thing instigator, bool fullDmg) { bool DFAEvent = false; List <Thing> cellThings = GridsUtility.GetThingList(cell, instigator.Map); if (cellThings.Count > 0) { for (int i = 0; i < cellThings.Count; i++) { if (cellThings[i] is Pawn && cellThings[i] != instigator) { JPInjury.DoJPRelatedInjury(cellThings[i], true, true, instigator, fullDmg); DFAEvent = true; } } } return(DFAEvent); }
// Token: 0x06000027 RID: 39 RVA: 0x00002B44 File Offset: 0x00000D44 public void UseJetPack(Pawn pilot, Thing JP, IntVec3 targCell) { if (!JPComposMentis(pilot, JP, out var Reason)) { Messages.Message("JetPack.CantDo".Translate(pilot, Reason), pilot, MessageTypeDefOf.NeutralEvent, false); SoundDefOf.ClickReject.PlayOneShotOnCamera(); return; } if (!FlightChecksOK(pilot, JP, out var ChecksReason)) { Messages.Message("JetPack.ChecksReason".Translate(pilot.LabelShort.CapitalizeFirst(), ChecksReason), pilot, MessageTypeDefOf.NeutralEvent, false); SoundDefOf.ClickReject.PlayOneShotOnCamera(); return; } if (JPUtility.ChkForDissallowed(pilot, out var DAllowReason)) { Messages.Message("JetPack.DAllowReason".Translate(pilot.LabelShort.CapitalizeFirst(), DAllowReason), pilot, MessageTypeDefOf.NeutralEvent, false); SoundDefOf.ClickReject.PlayOneShotOnCamera(); return; } if (!FlightCellCheck(pilot, targCell, JPFuelAmount, JPFuelRate, JPJumpRangeMin, JPJumpRangeMax, out var JumpReason)) { Messages.Message("JetPack.JumpReason".Translate(JumpReason), pilot, MessageTypeDefOf.NeutralEvent, false); SoundDefOf.ClickReject.PlayOneShotOnCamera(); return; } if (!JPInjury.CheckForExplosion(this)) { DoJumpJet(pilot, targCell); return; } JPInjury.DoJPExplosion(pilot, JPFuelAmount, JPFuelItem); JPFuelAmount = 0; }