public static void GetExplanationUnfinalized(StatWorker __instance, StatRequest req, ToStringNumberSense numberSense, ref string __result) { if (__instance != null) { StatDef value = Traverse.Create(__instance).Field("stat").GetValue <StatDef>(); if (req != null && req.Thing != null && req.Def != null && (req.Def == YautjaDefOf.RRY_Gun_Hunting_Bow || req.Def == YautjaDefOf.RRY_Gun_Compound_Bow) && value == StatDefOf.RangedWeapon_DamageMultiplier) { DamageArmorCategoryDef CategoryOfDamage = ((ThingDef)req.Def).Verbs[0].defaultProjectile.projectile.damageDef.armorCategory; StringBuilder stringBuilder = new StringBuilder(); stringBuilder.Append(__instance.GetExplanationUnfinalized(req, numberSense)); stringBuilder.AppendLine(); ThingDef def = (ThingDef)req.Def; if (req.StuffDef != null) { StatDef statDef = null; if (CategoryOfDamage != null) { statDef = CategoryOfDamage.multStat; } if (statDef != null) { stringBuilder.AppendLine(req.StuffDef.LabelCap + ": x" + req.StuffDef.GetStatValueAbstract(statDef, null).ToStringPercent()); } } __result = stringBuilder.ToString(); } } return; }
public static float Replacemant(StatWorker statWorker, StatRequest req, bool applyPostProcess) { if (Finder.enabled && Current.Game != null) { var key = Tools.GetKey(statWorker, req, applyPostProcess); var tick = GenTicks.TicksGame; if (!cache.TryGetValue(key, out var store)) { return(UpdateCache(key, statWorker, req, applyPostProcess, tick, store)); } if (tick - store.Second > Finder.statExpiry[statWorker.stat.index]) { return(UpdateCache(key, statWorker, req, applyPostProcess, tick, store)); } return(store.First); } else { return(statWorker.GetValueUnfinalized(req, applyPostProcess)); } }
public static float Replacemant(StatWorker statWorker, StatRequest req, bool applyPostProcess) { var tick = GenTicks.TicksGame; if (true && Finder.enabled && Current.Game != null && tick >= 600) { int key = Tools.GetKey(statWorker, req, applyPostProcess); int signature = -1; if (req.HasThing && req.Thing is Pawn pawn && pawn != null && !signatures.TryGetValue(pawn.thingIDNumber, out signature)) { signatures[pawn.thingIDNumber] = signature = Rand.Int.GetHashCode(); return(UpdateCache(key, statWorker, req, applyPostProcess, tick, null)); } if (!cache.TryGetValue(key, out var store)) { return(UpdateCache(key, statWorker, req, applyPostProcess, tick, store)); } if (tick - store.Item2 > Finder.statExpiry[statWorker.stat.index] || signature != store.Item3) { if (Finder.debug && signature != store.Item3) { Log.Message(string.Format("ROCKETMAN: Invalidated pawn cache with old sig:{0} and new {1}", store.Item3, signature)); } return(UpdateCache(key, statWorker, req, applyPostProcess, tick, store)); } return(store.Item1); } else { return(statWorker.GetValueUnfinalized(req, applyPostProcess)); } }
internal static float UpdateCache(int key, StatWorker statWorker, StatRequest req, bool applyPostProcess, int tick, Pair <float, int> store) { var value = statWorker.GetValueUnfinalized(req, applyPostProcess); if (Finder.debug && !Finder.learning) { Log.Message(string.Format("ROCKETMAN: state {0} for {1} took {2} with key {3}", statWorker.stat.defName, req.thingInt, tick - store.second, key)); } if (Finder.learning) { requests.Add(new Tuple <int, int, float>(statWorker.stat.index, tick - store.second, Mathf.Abs(value - store.first))); } if (req.HasThing && req.Thing is Pawn pawn && pawn != null) { List <int> keys = null; if (!pawnCachedKeys.TryGetValue(pawn.thingIDNumber, out keys)) { pawnCachedKeys[pawn.thingIDNumber] = (keys = new List <int>()); } keys.Add(key); } cache[key] = new Pair <float, int>(value, tick); return(value); }
static bool Prefix(StatWorker __instance, StatRequest req, ref bool __result) { StatDef stat = Traverse.Create(__instance).Field("stat").GetValue <StatDef>(); if (stat.category == WTH_DefOf.WTH_StatCategory_HackedMechanoid && req.Thing is Pawn pawn) { __result = pawn.IsHacked(); return(false); } if (stat.category == WTH_DefOf.WTH_StatCategory_Colonist && req.Thing is Pawn pawn2) { __result = pawn2.IsColonistPlayerControlled; return(false); } if (stat.category == WTH_DefOf.WTH_StatCategory_Platform && req.Thing is Building_BaseMechanoidPlatform) { __result = true; return(false); } if (stat.category == WTH_DefOf.WTH_StatCategory_HackedMechanoid || stat.category == WTH_DefOf.WTH_StatCategory_Colonist || stat.category == WTH_DefOf.WTH_StatCategory_Platform) { __result = false; return(false); } return(true); }
public static void GetValueUnfinalized(StatWorker __instance, StatRequest req, ref float __result) { if (__instance != null) { StatDef value = Traverse.Create(__instance).Field("stat").GetValue <StatDef>(); if (req != null && req.Thing != null && req.Def != null && (req.Def == YautjaDefOf.RRY_Gun_Hunting_Bow || req.Def == YautjaDefOf.RRY_Gun_Compound_Bow) && value == StatDefOf.RangedWeapon_DamageMultiplier) { // Log.Message(string.Format("GetValueUnfinalized value: {0}, Def: {1}, Empty: {2}, HasThing: {3}, QualityCategory: {4}, StuffDef: {5}, Thing: {6}", value, req.Def, req.Empty, req.HasThing, req.QualityCategory, req.StuffDef, req.Thing)); // Log.Message(string.Format("GetValueUnfinalized Original __result: {0}", __result)); DamageArmorCategoryDef CategoryOfDamage = ((ThingDef)req.Def).Verbs[0].defaultProjectile.projectile.damageDef.armorCategory; float num = __result; ThingDef def = (ThingDef)req.Def; if (req.StuffDef != null) { StatDef statDef = null; if (CategoryOfDamage != null) { statDef = CategoryOfDamage.multStat; } if (statDef != null) { num *= req.StuffDef.GetStatValueAbstract(statDef, null); } __result = num; } // Log.Message(string.Format("GetValueUnfinalized Modified __result: {0}", __result)); } } return; }
protected override IEnumerable <Toil> MakeNewToils() { /// //Set fail conditions /// this.FailOnDestroyedOrNull(TargetIndex.A); this.AddEndCondition(() => { return(this.Deliveree.health.ShouldBeTendedNow ? JobCondition.Ongoing : JobCondition.Succeeded); }); //Note we only fail on forbidden if the target doesn't start that way //This helps haul-aside jobs on forbidden items /// //Define Toil /// /// //Toils Start /// //Reserve thing to be stored and storage cell yield return(Toils_Reserve.Reserve(TargetIndex.A)); StatWorker statWorker = new StatWorker(); statWorker.InitSetStat(StatDefOf.BaseHealingQuality); Toil toilApplyMedicine = new Toil(); toilApplyMedicine.initAction = () => { Thing dummy; Medicine.holder.TryDrop(Medicine, pawn.Position + IntVec3.North.RotatedBy(pawn.Rotation), ThingPlaceMode.Direct, out dummy); }; yield return(toilApplyMedicine); yield return(Toils_Tend.PickupMedicine(TargetIndex.B, Deliveree)); Toil toilGoTodeliveree = Toils_Goto.GotoThing(TargetIndex.A, PathEndMode.Touch); yield return(toilGoTodeliveree); int duration = (int)(1.0 / (double)StatExtension.GetStatValue((Thing)pawn, StatDefOf.HealingSpeed, true) * 600.0); Toil toilDelivereeWait = new Toil(); toilDelivereeWait.initAction = () => { Deliveree.drafter.TakeOrderedJob(new Job(JobDefOf.Wait, duration)); }; yield return(Toils_General.Wait(duration)); yield return(Toils_Tend.FinalizeTend(Deliveree)); yield return(Toils_Jump.Jump(toilGoTodeliveree)); }
public static void GetExplanationUnfinalized_Postfix(ref string __result, StatWorker __instance, StatRequest req, ToStringNumberSense numberSense, StatDef ___stat) { if (req.Thing != null) { Pawn pawn = req.Thing as Pawn; if (pawn?.story?.traits != null && ___stat != null && pawn.story.traits.HasTrait(SyrTraitDefOf.SYR_CreativeThinker) && ___stat == StatDefOf.ResearchSpeed) { if (pawn.skills != null && pawn.def.statBases != null) { float statBase = 1f; if (pawn.def.statBases.Find((StatModifier x) => x?.stat != null && x.stat == ___stat) != null) { statBase = pawn.def.statBases.Find((StatModifier x) => x?.stat != null && x.stat == ___stat).value; } float val = 0.115f * pawn.skills.GetSkill(SkillDefOf.Artistic).Level *statBase; StringBuilder stringBuilder = new StringBuilder(); stringBuilder.AppendLine("SyrTraitsDaVinciGene".Translate()); stringBuilder.AppendLine(string.Concat(new object[] { " " + SkillDefOf.Artistic.LabelCap + " (", pawn.skills.GetSkill(SkillDefOf.Artistic).Level, "): ", val.ToStringSign(), __instance.ValueToString(val, false, ToStringNumberSense.Absolute) })); __result += stringBuilder.ToString(); } } } }
public static void GetExplanationUnfinalized_Postfix2(ref string __result, StatWorker __instance, StatRequest req, ToStringNumberSense numberSense, StatDef ___stat) { if (req.Thing != null) { Pawn pawn = req.Thing as Pawn; if (pawn?.story?.traits != null && ___stat != null && pawn.story.traits.HasTrait(SyrTraitDefOf.SlowLearner) && ___stat == StatDefOf.GlobalLearningFactor) { if (pawn.skills != null && pawn.def.statBases != null) { float num = 0f; foreach (SkillRecord skillRecord in pawn.skills.skills) { num += skillRecord.levelInt; } float val = 0.02f * Mathf.Clamp(num, 40, 140); StringBuilder stringBuilder = new StringBuilder(); stringBuilder.AppendLine("SyrTraitsSlowLearnerLabel".Translate()); stringBuilder.AppendLine(string.Concat(new object[] { " " + "SyrTraitsSlowLearner".Translate() + " (", num, "): ", val.ToStringSign(), __instance.ValueToString(val, false, ToStringNumberSense.Absolute) })); __result += stringBuilder.ToString(); } } } }
// Update the explanation string if the turret has been upgraded public static void Postfix(StatWorker __instance, StatRequest req, ref string __result, StatDef ___stat) { if (!req.Thing.IsUpgraded(out var uC)) { return; } var props = uC.Props; var offset = props.statOffsets?.GetStatOffsetFromList(___stat); var factor = props.statFactors?.GetStatFactorFromList(___stat); if (props.statOffsets != null && offset != 0) { if (offset != null) { __result += "\n\n" + "TurretExtensions.TurretUpgradedText".Translate().CapitalizeFirst() + ": " + ((float)offset).ToStringByStyle(___stat.toStringStyle, ToStringNumberSense.Offset); } } if (props.statFactors == null || factor == 1) { return; } if (factor != null) { __result += "\n\n" + "TurretExtensions.TurretUpgradedText".Translate().CapitalizeFirst() + ": " + ((float)factor).ToStringByStyle(___stat.toStringStyle, ToStringNumberSense.Factor); } }
public static void Patch_StatWorker_GetExplanationUnfinalized(StatWorker __instance, ref string __result, ref StatRequest req, ToStringNumberSense numberSense, StatDef ___stat) { //StatDef stat = (StatDef)AccessTools.Field(typeof(StatWorker), "stat").GetValue(__instance); if (req.Thing is ThingWithComps thing && thing.TryGetComp <SocketComp>() is SocketComp socketable) { StringBuilder builder = new StringBuilder(__result); bool statChanged = false; foreach (RuneComp rune in socketable.SocketedRunes) { if (rune.RuneProps.statOffsets.FirstOrDefault(mod => mod.stat == ___stat) is StatModifier statModifer) { if (!statChanged) { builder.AppendLine(); builder.AppendLine(); builder.AppendLine("Runes"); } builder.AppendLine(" " + rune.parent.LabelCapNoCount + ": " + statModifer.value.ToStringByStyle(statModifer.stat.ToStringStyleUnfinalized, ToStringNumberSense.Offset)); statChanged = true; } } if (statChanged) { __result = builder.ToString().TrimEndNewlines(); } } }
internal static float UpdateCache(int key, StatWorker statWorker, StatRequest req, bool applyPostProcess, int tick, Tuple <float, int, int> store) { var value = statWorker.GetValueUnfinalized(req, applyPostProcess); if (Finder.statLogging && !Finder.learning) { Log.Message(string.Format("ROCKETMAN: state {0} for {1} took {2} with key {3}", statWorker.stat.defName, req.thingInt, tick - (store?.Item2 ?? 0), key)); } else if (Finder.learning) { requests.Add(new Tuple <int, int, float>(statWorker.stat.index, tick - (store?.Item2 ?? tick), Mathf.Abs(value - (store?.Item1 ?? value)))); if (Rand.Chance(0.1f)) { ProcessExpiryCache(); } } int signature = -1; if (req.HasThing && req.Thing is Pawn pawn && pawn != null && !signatures.TryGetValue(pawn.thingIDNumber, out signature)) { signatures[pawn.thingIDNumber] = signature = Rand.Int.GetHashCode(); } cache[key] = new Tuple <float, int, int>(value, tick, signature); return(value); }
public static void StatWorker_MarketValue_GetValueUnfinalized_Postfix(StatWorker __instance, ref float __result, StatDef ___stat, ref StatRequest req, bool applyPostProcess) { if (req.HasThing) { StatOverrideService.Get(req.Def, ___stat)?.Apply(ref __result, ___stat, req.Thing); } }
private string GetExplanationFullShip(StatWorker sw, StatRequest req, ToStringNumberSense numSense, float value) { if (sw.IsDisabledFor(req.Thing)) { return("StatsReport_PermanentlyDisabled".Translate()); } return(String.Empty); }
public static float CalculateCapacityLevel(HediffSet diffSet, PawnCapacityDef capacity, List <CapacityImpactor> impactors = null, bool forTradePrice = false) { if (capacity.zeroIfCannotBeAwake && !diffSet.pawn.health.capacities.CanBeAwake) { impactors?.Add(new CapacityImpactorCapacity { capacity = PawnCapacityDefOf.Consciousness }); return(0f); } float num = capacity.Worker.CalculateCapacityLevel(diffSet, impactors); if (num > 0f) { float num2 = 99999f; float num3 = 1f; for (int i = 0; i < diffSet.hediffs.Count; i++) { Hediff hediff = diffSet.hediffs[i]; if (forTradePrice && !hediff.def.priceImpact) { continue; } List <PawnCapacityModifier> capMods = hediff.CapMods; if (capMods == null) { continue; } for (int j = 0; j < capMods.Count; j++) { PawnCapacityModifier pawnCapacityModifier = capMods[j]; if (pawnCapacityModifier.capacity == capacity) { num += pawnCapacityModifier.offset; float num4 = pawnCapacityModifier.postFactor; if (hediff.CurStage != null && hediff.CurStage.capacityFactorEffectMultiplier != null) { num4 = StatWorker.ScaleFactor(num4, hediff.pawn.GetStatValue(hediff.CurStage.capacityFactorEffectMultiplier)); } num3 *= num4; float num5 = pawnCapacityModifier.EvaluateSetMax(diffSet.pawn); if (num5 < num2) { num2 = num5; } impactors?.Add(new CapacityImpactorHediff { hediff = hediff }); } } } num *= num3; num = Mathf.Min(num, num2); } num = Mathf.Max(num, capacity.minValue); return(GenMath.RoundedHundredth(num)); }
public static void Patch_StatWorker_GetValueUnfinalized(StatWorker __instance, ref float __result, ref StatRequest req, bool applyPostProcess) { Pawn pawn = req.Thing as Pawn; if (pawn != null) { __result += StatWorkerInjection_AddShieldValue(pawn, StatDefField_StatWorker(__instance)); } }
static bool Prefix(StatWorker __instance, StatRequest req, ref bool __result, ref StatDef ___stat) { if (___stat.category == Resources.StatCategory.zzShield_stat && req.Thing is Building_Shield) { __result = true; return(false); } return(true); }
public static StatDef Stat(this StatWorker obj) { if (_stat == null) { // Need some reflection to access the internals _stat = typeof(StatWorker).GetField("stat", BindingFlags.Instance | BindingFlags.NonPublic); } return((StatDef)_stat.GetValue(obj)); }
public double GetAnimalCost(Thing thing) { if (statWorker == null) { StatDef marketValueStatDef = StatDefOf.MarketValue; statWorker = marketValueStatDef.Worker; } float value = statWorker.GetValue(StatRequest.For(thing)); return(value); }
public static void Patch_StatWorker_GetValueUnfinalized(StatWorker __instance, ref float __result, ref StatRequest req, bool applyPostProcess, StatDef ___stat) { Pawn pawn = req.Thing as Pawn; if (pawn != null && pawn.GetJobsComp() is DivineJobsComp jobsComp) { if (jobsComp.StatOffsets.FirstOrDefault(mod => mod.stat == ___stat) is StatModifier statModifer) { __result += statModifer.value; } } }
private static string InfoTextLineFrom(StatPart_ApparelStatOffset instance, Thing gear, float heddifSeverity, StatDef apparelStat) { float num = gear.GetStatValue(apparelStat, true); num += StatWorker.StatOffsetFromGear(gear, apparelStat); num = -num; if (!gear.def.HasModExtension <WaterGear>()) { num = num * Mathf.Clamp(1f - heddifSeverity, ModSettings_WaterIsCold.wetInsFactor, 1f); return(" " + gear.LabelCap + ": " + num.ToStringByStyle(instance.parentStat.toStringStyle, ToStringNumberSense.Offset) + " (wet)"); } return(" " + gear.LabelCap + ": " + num.ToStringByStyle(instance.parentStat.toStringStyle, ToStringNumberSense.Offset)); }
protected override IEnumerable<Toil> MakeNewToils() { /// //Set fail conditions /// this.FailOnDestroyed(TargetIndex.A); this.AddEndCondition(() => { return this.Deliveree.health.ShouldBeTreatedNow ? JobCondition.Ongoing : JobCondition.Succeeded; }); //Note we only fail on forbidden if the target doesn't start that way //This helps haul-aside jobs on forbidden items /// //Define Toil /// /// //Toils Start /// //Reserve thing to be stored and storage cell yield return Toils_Reserve.Reserve(TargetIndex.A); StatWorker statWorker = new StatWorker(); statWorker.InitSetStat(StatDefOf.BaseHealingQuality); Toil toilApplyMedicine = new Toil(); toilApplyMedicine.initAction = () => { Thing dummy; Medicine.holder.TryDrop(Medicine, pawn.Position + IntVec3.North.RotatedBy(pawn.Rotation), ThingPlaceMode.Direct, out dummy); }; yield return toilApplyMedicine; yield return Toils_Treat.PickupMedicine(TargetIndex.B, Deliveree); Toil toilGoTodeliveree = Toils_Goto.GotoThing(TargetIndex.A, PathEndMode.Touch); yield return toilGoTodeliveree; int duration = (int) (1.0 / (double) StatExtension.GetStatValue((Thing) pawn, StatDefOf.HealingSpeed, true) * 600.0); Toil toilDelivereeWait = new Toil(); toilDelivereeWait.initAction = () => { Deliveree.drafter.TakeOrderedJob(new Job(JobDefOf.Wait, duration)); }; yield return Toils_General.Wait(duration); yield return Toils_Treat.FinalizeTreatment(Deliveree); yield return Toils_Jump.Jump(toilGoTodeliveree); }
public static bool GetValueDetour(StatWorker __instance, StatRequest req, ref float __result, bool applyPostProcess = true) { if (Active && GetValDetour && __instance is StatWorker sw) { if (sw.stat.minifiedThingInherits) { if (req.Thing is MinifiedThing minifiedThing) { if (minifiedThing.InnerThing == null) { Log.Error("MinifiedThing's inner thing is null."); } __result = minifiedThing.InnerThing.GetStatValue(sw.stat, applyPostProcess); return(false); } } var slag = ""; if (ByDef) { slag = $"{__instance.stat.defName} GetValueUnfinalized for {req.Def.defName}"; } else { slag = $"{__instance.stat.defName} GetValueUnfinalized"; } Analyzer.Start(slag); float valueUnfinalized = sw.GetValueUnfinalized(req, applyPostProcess); Analyzer.Stop(slag); if (ByDef) { slag = $"{__instance.stat.defName} FinalizeValue for {req.Def.defName}"; } else { slag = $"{__instance.stat.defName} FinalizeValue"; } Analyzer.Start(slag); sw.FinalizeValue(req, ref valueUnfinalized, applyPostProcess); Analyzer.Stop(slag); __result = valueUnfinalized; return(false); } return(true); }
public static void PostFix(ref float __result, StatWorker __instance, StatDef ___stat, StatRequest req) { if (!req.HasThing) { return; } var thing = req.Thing; if (!(thing is Pawn pawn)) { return; } var confusedDef = DefDatabase <ThoughtDef> .GetNamed("GGConfused"); bool isConfused; var needs = pawn.needs; if (needs == null) { isConfused = false; } else { var mood = needs.mood; if (mood == null) { isConfused = false; } else { var thoughts = mood.thoughts; isConfused = thoughts?.memories.GetFirstMemoryOfDef(confusedDef) != null; } } if (!isConfused) { return; } var offset = pawn.needs.mood.thoughts.memories.GetFirstMemoryOfDef(confusedDef).MoodOffset(); if (___stat == StatDefOf.AimingDelayFactor) { __result += (0f - offset) / 10f; } }
public static void Interrupt(StatWorker statWorker, StatRequest req, bool applyPostProcess) { if (Finder.learning && Finder.statLogging) { StackTrace trace = new StackTrace(); StackFrame frame = trace.GetFrame(2); MethodBase method = frame.GetMethod(); String handler = method.GetStringHandler(); Log.Message(string.Format("ROCKETMAN: called stats.GetUnfinalizedValue from {0}", handler)); callingMethods.Add(method); } }
public static bool ShouldShowFor_Prefix(StatWorker __instance, StatRequest req, ref bool __result, ref StatDef ___stat) { if (___stat == null || req == null) { return(true); } ThingDef def = req.Def as ThingDef; if (def != null && ___stat.category == Resources.StatCategoryDefs.VoidEnergy && def.thingClass == typeof(Things.VoidNetTerminal)) { __result = true; return(false); } return(true); }
public static void Patch_StatWorker_GetValueUnfinalized(StatWorker __instance, ref float __result, ref StatRequest req, bool applyPostProcess, StatDef ___stat) { //StatDef stat = (StatDef)AccessTools.Field(typeof(StatWorker), "stat").GetValue(__instance); if (req.Thing is ThingWithComps thing && thing.TryGetComp <SocketComp>() is SocketComp socketable) { foreach (RuneComp rune in socketable.SocketedRunes) { if (rune.RuneProps.statOffsets.FirstOrDefault(mod => mod.stat == ___stat) is StatModifier statModifer) { __result += statModifer.value; } } } }
public static void Postfix(StatWorker __instance, StatRequest req, ref float __result, StatDef ___stat) { // Update stats if the turret has been upgraded if (req.Thing.IsUpgraded(out CompUpgradable uC)) { CompProperties_Upgradable props = uC.Props; if (props.statOffsets != null) { __result += props.statOffsets.GetStatOffsetFromList(___stat); } if (props.statFactors != null) { __result *= props.statFactors.GetStatFactorFromList(___stat); } } }
public static int GetKey(StatWorker statWorker, StatRequest req, bool applyPostProcess) { unchecked { int hash; hash = HashUtility.HashOne(statWorker.stat.shortHash); hash = HashUtility.HashOne(req.thingInt?.thingIDNumber ?? 0, hash); hash = HashUtility.HashOne(req.stuffDefInt?.shortHash ?? 0, hash); hash = HashUtility.HashOne((int)req.qualityCategoryInt, hash); hash = HashUtility.HashOne(req.defInt?.shortHash ?? 0, hash); hash = HashUtility.HashOne(req.faction?.loadID ?? 0, hash); hash = HashUtility.HashOne(req.pawn?.thingIDNumber ?? 0, hash); hash = HashUtility.HashOne(applyPostProcess ? 1 : 0, hash); return(hash); } }
public static void PostFix(ref float __result, StatWorker __instance, StatDef ___stat, StatRequest req) { if (!req.HasThing) { return; } Thing thing = req.Thing; if (!(thing is Pawn)) { return; } if (___stat == StatDefOf.MoveSpeed) { __result += JPUtility.GetSlowBurn(thing as Pawn); } }
public static bool RocketMan_Replacemant(StatWorker statWorker, StatRequest req, bool applyPostProcess, ref float __result) { if (!UnityData.IsInMainThread) { // return not cached __result = statWorker.GetValueUnfinalized(req, applyPostProcess); return(false); } if (req.thingInt == null && req.stuffDefInt == null && req.defInt == null) { Log.ErrorOnce($"Try get value from Empty StatRequest!", "rocketman.patch".GetHashCode()); __result = 0; return(false); } return(true); }