private void InitPawn_Setup() { // Do not init when scribe is working? Should be reinitialised from savegame! if (Scribe.mode != LoadSaveMode.Inactive) { return; } this.equipment = new Pawn_EquipmentTracker(this); this.apparel = new Pawn_ApparelTracker(this); // Add base shielding //X2_Building_AIRobotRechargeStation.GenerateBaseApparel(this); // Skills are needed for some skills (like Cleaning) this.skills = new Pawn_SkillTracker(this); SetSkills(); // Story is needed for some skills (like Growing) this.story = new Pawn_StoryTracker(this); if (this.gender == Gender.Male) { this.story.bodyType = BodyTypeDefOf.Male; } else { this.story.bodyType = BodyTypeDefOf.Female; } this.story.crownType = CrownType.Average; this.Drawer.renderer.graphics.ResolveApparelGraphics(); // To allow the robot to be drafted -> Still not possible to draft, because 1. not humanlike and 2. the GetGizmos in Pawn_Drafter is internal! //this.drafter = new Pawn_DraftController(this); // Not needed because not usable if (this.relations == null) { this.relations = new Pawn_RelationsTracker(this); } this.relations.ClearAllRelations(); if (!this.ignoreSpawnRename) { SetBasename(this); } ignoreSpawnRename = false; // Robots are not allowed to have JOY like partying! timetable = new Pawn_TimetableTracker(this); for (int i = 0; i < 24; i++) { timetable.SetAssignment(i, TimeAssignmentDefOf.Work); } }
public static void Postfix(Pawn_TimetableTracker __instance, Pawn pawn) { // AutoOwl functionality if (TinyTweaksSettings.autoOwl && pawn.story?.traits?.HasTrait(TraitDefOf.NightOwl) == true) { for (int i = 0; i < GenDate.HoursPerDay; i++) { if (i >= 11 && i <= 18) { __instance.times[i] = TimeAssignmentDefOf.Sleep; } else { __instance.times[i] = TimeAssignmentDefOf.Anything; } } } }
static Exception Finalizer(Exception __exception, Pawn_TimetableTracker __instance, int hour, ref TimeAssignmentDef __result) { if (__exception != null) { try { __result = TimeAssignmentDefOf.Anything; __instance.SetAssignment(hour, TimeAssignmentDefOf.Anything); } catch { return(__exception); } finally { } } return(null); }
public static bool VampCanMeditateNow(ref bool __result, Pawn pawn) { bool flag = pawn.IsVampire(); bool result; if (flag) { bool flag2 = pawn.needs.rest != null && pawn.needs.rest.CurCategory >= RestCategory.VeryTired; if (flag2) { __result = false; result = false; } else { bool starving = pawn.needs.TryGetNeed <Need_Blood>().Starving; if (starving) { __result = false; result = false; } else { bool flag3 = !pawn.Awake(); if (flag3) { __result = false; result = false; } else { bool flag4 = pawn.health.hediffSet.BleedRateTotal <= 0f; if (flag4) { bool flag5 = HealthAIUtility.ShouldSeekMedicalRest(pawn); if (flag5) { Pawn_TimetableTracker timetable = pawn.timetable; bool flag6 = ((timetable != null) ? timetable.CurrentAssignment : null) != TimeAssignmentDefOf.Meditate; if (flag6) { __result = false; return(false); } } bool flag7 = !HealthAIUtility.ShouldSeekMedicalRestUrgent(pawn); if (flag7) { __result = true; return(false); } } __result = false; result = false; } } } } else { result = true; } return(result); }