private static void CheckForDisabledTypes(Pawn_WorkSettings _this, Pawn pawn) { foreach (var workTypeDef in WorkTypeDefsUtility.WorkTypeDefsInPriorityOrder) { if (pawn.story.WorkTypeIsDisabled(workTypeDef)) { _this.Disable(workTypeDef); } } }
private void SpawnSetupWorkSettings() { if (workTypes == null) { //Log.Warning("Unexpected creation of converted pawn."); workTypes = GetRandomWorkTypes(story); } WorkType = workTypes.Count > 0 ? workTypes[0].ToString() : String.Empty; // Work workSettings = new Pawn_WorkSettings(this); workSettings.EnableAndInitialize(); var skillsDefs = new List <SkillDef>(); foreach (WorkTypeDef current in DefDatabase <WorkTypeDef> .AllDefs) { if (workTypes.Contains(current)) { workSettings.SetPriority(current, 1); skillsDefs.AddRange(current.relevantSkills); } else { workSettings.Disable(current); } } skillsDefs.RemoveDuplicates(); foreach (var skillDef in skillsDefs) { var record = skills.GetSkill(skillDef); var minSkillLevel = KindDef.minSkillPoints; if (record == null || record.XpTotalEarned < minSkillLevel) { skills.Learn(skillDef, Rand.Range(minSkillLevel, KindDef.maxSkillPoints)); } } //foreach (WorkTypeDef current in DefDatabase<WorkTypeDef>.AllDefs) //{ // if (workTypes.Contains(current)) // { // } //} }