static void LogSapienceInfo() { StringBuilder builder = new StringBuilder(); foreach (Pawn pawn in PawnsFinder.AllMaps_SpawnedPawnsInFaction(Faction.OfPlayer)) { var sapienceTracker = pawn.GetSapienceTracker(); Need_Control need = sapienceTracker?.SapienceNeed; if (need == null || sapienceTracker.CurrentState == null) { continue; } builder.AppendLine($"{pawn.Name}[{pawn.ThingID}]: in state {sapienceTracker.CurrentState.StateDef.defName}"); float curLevel = need.CurLevel; float curLevelPercent = need.CurLevelPercentage; float limit = need.Limit; var limitStat = pawn.GetStatValue(PMStatDefOf.SapienceLimit); float limitPercent = need.Limit / need.MaxLevel; builder.AppendLine($"|\t{nameof(curLevel)}:{curLevel}={sapienceTracker.SapienceLevel}"); builder.AppendLine($"|\t{nameof(curLevelPercent)}:{curLevelPercent}"); builder.AppendLine($"|\t{nameof(limitStat)}:{limitStat}"); builder.AppendLine($"|\t{nameof(limit)}:{limit}"); builder.AppendLine($"|\t{nameof(limitPercent)}:{limitPercent}"); } Log.Message(builder.ToString()); }
private void SapienceLevelChanged(Need_Control sender, Pawn pawn, SapienceLevel sapiencelevel) { if (sapiencelevel == SapienceLevel.Sapient) { _waiting = true; } }
private static void GiveSapientAnimalsNeeds(Pawn_NeedsTracker __instance, Pawn ___pawn, NeedDef nd, ref bool __result) { if (nd == PMNeedDefOf.SapientAnimalControl) { __result = Need_Control.IsEnabledFor(___pawn); return; } bool isColonist = ___pawn.Faction?.IsPlayer == true; bool moodIsEnabled = MoodIsEnabled(___pawn); if (nd == PMNeedDefOf.Joy && isColonist) { __result = moodIsEnabled; } if (nd == PMNeedDefOf.Mood || nd == PMNeedDefOf.Comfort || nd == PMNeedDefOf.Beauty) { __result = moodIsEnabled; } if (__result) { __result = nd.IsValidFor(___pawn); } }
private void SapienceLevelChanges(Need_Control sender, Pawn pawn, SapienceLevel sapiencelevel) { if (pawn.Faction != Faction.OfPlayer) { return; } Find.ColonistBar.MarkColonistsDirty(); }
private void SapienceLevelChanged(Need_Control sender, Pawn pawn1, SapienceLevel sapiencelevel) { var idx = (int)sapiencelevel; if (idx < def.stages.Count) { SetStage(idx); } SetLabel(sapiencelevel); }
private void OnSapienceLevelChanged(Need_Control sender, Pawn pawn, SapienceLevel sapienceLevel) { if (sapienceLevel == SapienceLevel.Feral) { _countdownStarted = true; } if (PawnUtility.ShouldSendNotificationAbout(pawn)) { SendFHLetter(pawn, sapienceLevel); } }