static void Prefix(PawnRenderer __instance, ref Vector3 rootLoc, ref float angle, ref bool renderBody, ref Rot4 bodyFacing, ref Rot4 headFacing, ref RotDrawMode bodyDrawType, ref bool portrait, ref bool headStump, ref bool invisible) { if (invisible) { return; } Pawn pawn = Traverse.Create(__instance).Field("pawn").GetValue <Pawn>(); if (pawn != null) { Comp_Markable markable = pawn.TryGetComp <Comp_Markable>(); if (markable != null) { Hediff hd = pawn.health.hediffSet.hediffs.Find(x => x.TryGetComp <HediffComp_HunterMark>() != null); if (hd != null) { HediffComp_HunterMark comp = hd.TryGetComp <HediffComp_HunterMark>(); if (comp.BloodStatus > HMSUtility.BloodStatusMode.Unblooded) { if (comp != null && comp.hasMat && !portrait) { DrawMark(comp, __instance, rootLoc, angle, renderBody, bodyFacing, headFacing, bodyDrawType, portrait, headStump); } } } } } }
public override IEnumerable <FloatMenuOption> CompFloatMenuOptions(Pawn myPawn) { HediffSet hediffSet = myPawn.health.hediffSet; Comp_Markable markable = null; if (!myPawn.Markable(out markable)) { // Log.Message(string.Format("myPawn.Markable: {0}", !myPawn.Markable(out markable))); yield break; } if (!hediffSet.hediffs.Any(x => x.def.defName.Contains(HunterMarkingSystem.Unmarkededkey)) || markable == null) { // Log.Message(string.Format("HasHediff: {0}, markable: {1}", hediffSet.hediffs.Any(x => x.def.defName.Contains(HunterMarkingSystem.Unmarkededkey)), markable != null)); yield break; } HediffDef UnmarkedDef = hediffSet.hediffs.Find(x => x.def.defName.Contains(HunterMarkingSystem.Unmarkededkey)).def ?? null; if (!markable.MarkerRace && !markable.Inducted) { // Log.Message(string.Format("MarkerRace: {0}, Inducted: {1}", markable.MarkerRace, markable.Inducted)); yield break; } if (!this.CanBeUsedBy(myPawn, out string failReason)) { // yield break; yield return(new FloatMenuOption(this.FloatMenuOptionLabel + ((failReason == null) ? string.Empty : (" (" + failReason + ")")), null, MenuOptionPriority.Default, null, null, 0f, null, null)); } else if (!myPawn.CanReach(this.parent, PathEndMode.Touch, Danger.Deadly, false, TraverseMode.ByPawn)) { yield return(new FloatMenuOption(this.FloatMenuOptionLabel + " (" + "NoPath".Translate() + ")", null, MenuOptionPriority.Default, null, null, 0f, null, null)); } else if (!myPawn.CanReserve(this.parent, 1, -1, null, false)) { yield return(new FloatMenuOption(this.FloatMenuOptionLabel + " (" + "Reserved".Translate() + ")", null, MenuOptionPriority.Default, null, null, 0f, null, null)); } else if (!myPawn.health.capacities.CapableOf(PawnCapacityDefOf.Manipulation)) { yield return(new FloatMenuOption(this.FloatMenuOptionLabel + " (" + "Incapable".Translate() + ")", null, MenuOptionPriority.Default, null, null, 0f, null, null)); } else { FloatMenuOption useopt = new FloatMenuOption(this.FloatMenuOptionLabel, delegate() { if (myPawn.CanReserveAndReach(this.parent, PathEndMode.Touch, Danger.Deadly, 1, -1, null, false)) { foreach (CompUseEffect compUseEffect in this.parent.GetComps <CompUseEffect>()) { if (compUseEffect.SelectedUseOption(myPawn)) { return; } } this.TryStartUseJob(myPawn); } }, MenuOptionPriority.Default, null, null, 0f, null, null); yield return(useopt); } yield break; }
public static bool Markable(this Pawn p, out Comp_Markable comp) { if (p == null) { comp = null; return(false); } comp = p.TryGetComp <Comp_Markable>(); return(comp != null); }
public static bool Marked(this Pawn p) { HediffSet hediffSet = p.health.hediffSet; Comp_Markable Markable = p.TryGetComp <Comp_Markable>(); if (Markable == null) { return(false); } bool hasbloodedM = hediffSet.hediffs.Any(x => x.def == Markable.Markeddef || x.def.defName.Contains("Hediff_BloodedM")); return(hasbloodedM); }
protected override ThoughtState CurrentStateInternal(Pawn p) { // Log.Message(string.Format("{0}, {1}", this, p.LabelShortCap)); Comp_Markable Markable = p.TryGetComp <Comp_Markable>(); ThoughtState state = ThoughtState.Inactive; if ((Markable != null)) { if ((Markable.Inducted)) { switch (Markable.BloodStatus) { case HMSUtility.BloodStatusMode.Unblooded: if (Markable.MarkerRace) { state = ThoughtState.ActiveAtStage(0); } else { state = ThoughtState.Inactive; } break; case HMSUtility.BloodStatusMode.Unmarked: state = ThoughtState.ActiveAtStage(1); break; case HMSUtility.BloodStatusMode.Marked: state = ThoughtState.ActiveAtStage(2); break; default: // Log.Message(string.Format("{0}, {1}, {2} = {3} Bad BloodStatusMode", this, p.LabelShortCap, Markable.BloodStatus, state)); state = ThoughtState.Inactive; break; } } else { // Log.Message(string.Format("{0}, {1}, {2} = {3} not inducted", this, p.LabelShortCap, Markable.BloodStatus, state)); } // Log.Message(string.Format("{0}, {1}, {2} = Active: {3}, Ind: {4}, Reason: {5}", this, p.LabelShortCap, Markable.BloodStatus, state.Active, state.StageIndex, state.Reason)); } else { // Log.Message(string.Format("{0}, {1} = {2}", this, p.LabelShortCap, state)); } return(state); }
// Token: 0x06000393 RID: 915 RVA: 0x000245C8 File Offset: 0x000229C8 protected override IEnumerable <Toil> MakeNewToils() { this.FailOnIncapable(PawnCapacityDefOf.Manipulation); yield return(Toils_Goto.GotoThing(TargetIndex.A, PathEndMode.Touch)); Toil prepare = Toils_General.Wait(this.useDuration, TargetIndex.A); prepare.WithProgressBarToilDelay(TargetIndex.A, false, -0.5f); prepare.FailOnDespawnedNullOrForbidden(TargetIndex.A); prepare.FailOnCannotTouch(TargetIndex.A, PathEndMode.Touch); yield return(prepare); Toil use = new Toil(); use.initAction = delegate() { Pawn actor = use.actor; Pawn inductee = (Pawn)TargetB.Thing; Comp_Markable _Yautja = inductee.TryGetComp <Comp_Markable>(); // _Yautja.inducted = true; }; use.defaultCompleteMode = ToilCompleteMode.Instant; yield return(use); yield return(Toils_Goto.GotoThing(TargetIndex.B, PathEndMode.Touch)); Toil prepare2 = Toils_General.Wait(this.useDuration, TargetIndex.B); prepare2.WithProgressBarToilDelay(TargetIndex.B, false, -0.5f); prepare2.FailOnDespawnedNullOrForbidden(TargetIndex.B); prepare2.FailOnCannotTouch(TargetIndex.B, PathEndMode.Touch); yield return(prepare2); Toil use2 = new Toil(); use2.initAction = delegate() { Pawn actor = use2.actor; Pawn inductee = (Pawn)TargetB.Thing; CompUseEffect_MarkSelf compUsable = actor.CurJob.targetA.Thing.TryGetComp <CompUseEffect_MarkSelf>(); compUsable.DoEffect(inductee); }; use2.defaultCompleteMode = ToilCompleteMode.Delay; yield return(use2); yield break; }
// Token: 0x06002BF6 RID: 11254 RVA: 0x00149A10 File Offset: 0x00147E10 public override TaggedString GetExplanation() { StringBuilder stringBuilder = new StringBuilder(); foreach (Thing thing in this.SickPawns.Where(x => x.GetType() == typeof(Pawn))) { Pawn pawn = thing as Pawn; if (pawn != null) { Comp_Markable _Markable = pawn.TryGetComp <Comp_Markable>(); if (_Markable != null) { if (pawn.health.hediffSet.HasHediff(_Markable.Props.cultureDef.UnmarkedHediff)) { if ((_Markable.MarkerRace || _Markable.Inducted)) { stringBuilder.AppendLine(" " + pawn.LabelShort + " " + "HMS_CanMarkThemself".Translate() + ":" + _Markable.Markcorpse.InnerPawn.NameShortColored); } else { List <string> vs = new List <string>(); foreach (ThingDef race in _Markable.markerRaces) { string rl = race.LabelCap + ": "; string rc = string.Empty; PawnsFinder.AllMapsCaravansAndTravelingTransportPods_Alive_Colonists.Where(y => y.def == race).ToList().ForEach(z => rc += (rc == string.Empty ? z.NameShortColored : " ," + z.NameShortColored)); vs.Add(rc.NullOrEmpty() ? rl : rc); } stringBuilder.AppendLine(" " + pawn.LabelShort + " " + "HMS_CanbeMarked".Translate() + ":" + _Markable.Markcorpse.InnerPawn.NameShortColored + " By: " + vs.ToCommaList()); } } } } } return("RRY_CanMarkSelfDesc".Translate(stringBuilder.ToString())); }
public static bool Markable(this Thing p, out Comp_Markable comp) { comp = p.TryGetComp <Comp_Markable>(); return(comp != null); }