public void PreApplyDamage(DamageInfo dinfo, out bool absorbed) { if (dinfo.Instigator != null && this.pawn.Faction != null && this.pawn.Faction.IsPlayer && !this.pawn.InAggroMentalState) { Pawn pawn = dinfo.Instigator as Pawn; if (pawn != null && pawn.guilt != null && pawn.mindState != null) { pawn.guilt.Notify_Guilty(); } } if (this.pawn.Spawned) { if (!this.pawn.Position.Fogged(this.pawn.Map)) { this.pawn.mindState.Active = true; } Lord lord = this.pawn.GetLord(); if (lord != null) { lord.Notify_PawnDamaged(this.pawn, dinfo); } if (dinfo.Def.externalViolence) { GenClamor.DoClamor(this.pawn, 18f, ClamorDefOf.Harm); } this.pawn.jobs.Notify_DamageTaken(dinfo); } if (this.pawn.Faction != null) { this.pawn.Faction.Notify_MemberTookDamage(this.pawn, dinfo); if (Current.ProgramState == ProgramState.Playing && this.pawn.Faction == Faction.OfPlayer && dinfo.Def.externalViolence && this.pawn.SpawnedOrAnyParentSpawned) { this.pawn.MapHeld.dangerWatcher.Notify_ColonistHarmedExternally(); } } if (this.pawn.apparel != null) { List <Apparel> wornApparel = this.pawn.apparel.WornApparel; for (int i = 0; i < wornApparel.Count; i++) { if (wornApparel[i].CheckPreAbsorbDamage(dinfo)) { absorbed = true; return; } } } if (this.pawn.Spawned) { this.pawn.stances.Notify_DamageTaken(dinfo); this.pawn.stances.stunner.Notify_DamageApplied(dinfo, !this.pawn.RaceProps.IsFlesh); } if (this.pawn.RaceProps.IsFlesh && dinfo.Def.externalViolence) { Pawn pawn2 = dinfo.Instigator as Pawn; if (pawn2 != null) { if (pawn2.HostileTo(this.pawn)) { this.pawn.relations.canGetRescuedThought = true; } if (this.pawn.RaceProps.Humanlike && pawn2.RaceProps.Humanlike && this.pawn.needs.mood != null && (!pawn2.HostileTo(this.pawn) || (pawn2.Faction == this.pawn.Faction && pawn2.InMentalState))) { this.pawn.needs.mood.thoughts.memories.TryGainMemory(ThoughtDefOf.HarmedMe, pawn2); } } TaleRecorder.RecordTale(TaleDefOf.Wounded, new object[] { this.pawn, pawn2, dinfo.Weapon }); } absorbed = false; }
protected virtual void Impact(Thing hitThing) { GenClamor.DoClamor(this, 2.1f, ClamorDefOf.Impact); this.Destroy(DestroyMode.Vanish); }
protected virtual void Impact(Thing hitThing) { GenClamor.DoClamor(this, 2.1f, ClamorDefOf.Impact); Destroy(); }