public override Job JobOnThing(Pawn pawn, Thing t, bool forced = false) { var prisoner = t as Pawn; var need = prisoner?.needs.TryGetNeed <Need_Motivation>(); if (need == null || prisoner == null) { return(null); } if (!ShouldTakeCareOfPrisoner(pawn, prisoner)) { return(null); } if (prisoner.Downed || !pawn.CanReserve(t, 1, -1, null, false) || !prisoner.Awake()) { return(null); } if (pawn.IsPrisoner) { return(null); } var prisonerComp = prisoner.TryGetComp <PrisonerComp>();; if (!PrisonLaborUtility.LaborEnabled(prisoner) && prisonerComp != null && !prisonerComp.EscapeTracker.CanEscape) { return(null); } if ((!PrisonLaborUtility.WorkTime(prisoner) || !need.ShouldBeMotivated) && prisonerComp != null && !prisonerComp.EscapeTracker.CanEscape) { return(null); } return(new Job(DefDatabase <JobDef> .GetNamed("PrisonLabor_PrisonerSupervise"), prisoner)); }
static bool Postfix(bool __result, WorkGiver_Scanner __instance, Pawn pawn, Thing t, bool forced = false) { if (__result && t != null) { return(PrisonLaborUtility.CanWorkHere(t.Position, pawn, __instance.def.workType)); } return(__result); }
protected override bool Satisfied(Pawn pawn) { if (pawn.IsPrisoner) { //show tutorials Tutorials.Introduction(); Tutorials.Management(); IntVec3 c; var need = pawn.needs.TryGetNeed <Need_Motivation>(); if (need == null) { if (!pawn.guest.PrisonerIsSecure || RCellFinder.TryFindBestExitSpot(pawn, out c, TraverseMode.ByPawn)) { return(false); } else if (PrisonLaborUtility.LaborEnabled(pawn)) { return(true); } else { return(false); } } // Prisoner will escape if get ready to run. // If he can run he will start ticking impatient, once complete he will get ready. var prisonerComp = pawn.TryGetComp <PrisonerComp>(); if (pawn.guest.PrisonerIsSecure && RCellFinder.TryFindBestExitSpot(pawn, out c, TraverseMode.ByPawn)) { if (prisonerComp.escapeTracker.ReadyToEscape) { return(false); } else { prisonerComp.escapeTracker.CanEscape = true; } } else { prisonerComp.escapeTracker.CanEscape = false; } if (PrisonLaborUtility.LaborEnabled(pawn)) { return(true); } need.IsPrisonerWorking = false; } return(false); }
private static IEnumerable <IntVec3> checkFields(IEnumerable <IntVec3> __result, WorkGiver_Scanner __instance, Pawn pawn) { foreach (IntVec3 pos in __result) { if (PrisonLaborUtility.canWorkHere(pos, pawn, __instance.def.workType)) { yield return(pos); } } }
protected override bool Satisfied(Pawn pawn) { if (pawn.IsPrisoner) { if (pawn.IsWatched() && PrisonLaborUtility.WorkTime(pawn)) { return(false); } return(true); } return(false); }
private static IEnumerable <Thing> CheckFields(IEnumerable <Thing> __result, WorkGiver_Scanner __instance, Pawn pawn) { foreach (Thing thing in __result) { //Log.Message($"Work type: { __instance.def.workType}, thing is {thing}, value: {PrisonLaborUtility.canWorkHere(thing.Position, pawn, __instance.def.workType)}"); if (thing != null && PrisonLaborUtility.CanWorkHere(thing.Position, pawn, __instance.def.workType)) { // Log.Message($"Work type { __instance.def.workType}, value: {PrisonLaborUtility.canWorkHere(thing.Position, pawn, __instance.def.workType)}"); yield return(thing); } } }
static bool Postfix(bool __result, Pawn pawn, Thing t, bool forced) { if (pawn.Faction != Faction.OfPlayer && !pawn.IsPrisonerOfColony) { return(false); } WorkGiverDef workGiverDef = DefDatabase <WorkGiverDef> .GetNamed("CleanFilth"); return(t is Filth filth && filth.Map.areaManager.Home[filth.Position] && pawn.CanReserve(t, 1, -1, null, forced) && filth.TicksSinceThickened >= MinTicksSinceThickened && PrisonLaborUtility.canWorkHere(filth.Position, pawn, workGiverDef.workType)); }
private float GetChangePoints() { if (pawn.IsPrisoner && pawn.IsPrisonerOfColony) { if (pawn.GetRoomGroup() != null) { var value = InspirationTracker.GetInsiprationValue(pawn, true); if (PrisonLaborUtility.LaborEnabled(pawn)) { if (IsPrisonerWorking) { value -= BGP.Laziness_LazyRate; if (HealthAIUtility.ShouldSeekMedicalRest(pawn)) { value -= BGP.Laziness_HealthRate; } if (pawn.needs.food != null) { //warforged value -= (int)pawn.needs.food.CurCategory * BGP.Laziness_HungryRate; } // Some pawns have no rest need (e.g. Pawns with Circadian Half Cycler or androids from other mods) if (pawn.needs.rest != null) { value -= (int)pawn.needs.rest.CurCategory * BGP.Laziness_TiredRate; } } else if (pawn.timetable != null && pawn.timetable.CurrentAssignment == TimeAssignmentDefOf.Joy) { value += BGP.Laziness_JoyRate; } } _GUIChangeArrow = value.CompareTo(0.0f); return(value); } else { _GUIChangeArrow = 0; return(0.0f); } } else { _GUIChangeArrow = 1; return(+0.01f); } }
public override void MapComponentOnGUI() { try { if (!PrisonLaborPrefs.EnableMotivationIcons) { return; } if (map.mapPawns == null) { return; } foreach (var pawn in map.mapPawns.AllPawns) { if (pawn == null) { continue; } if (pawn.RaceProps == null) { continue; } if (pawn.IsPrisonerOfColony && pawn.CarriedBy == null) { var need = pawn.needs.TryGetNeed <Need_Motivation>(); if (pawn.health.hediffSet.HasTemperatureInjury(TemperatureInjuryStage.Serious) && PrisonLaborUtility.WorkTime(pawn)) { DrawIcon(freezingTexture, pawn.DrawPos); } else if (pawn.IsWatched()) { DrawIcon(watchedTexture, pawn.DrawPos); } else if (need != null && need.IsLazy && PrisonLaborUtility.LaborEnabled(pawn) && PrisonLaborUtility.WorkTime(pawn)) { DrawIcon(lazyTexture, pawn.DrawPos); } } } } catch (NullReferenceException e) { Log.ErrorOnce("PrisonLaborError: null reference in OnGui() : " + e.Message + " trace: " + e.StackTrace, typeof(PawnIcons).GetHashCode()); } }
static bool HasJobOnThingPostfix(bool __result, WorkGiver_DeepDrill __instance, Pawn pawn, Thing t, bool forced) { Building building = t as Building; if (building != null && pawn != null && building.Faction.IsPlayer) { if (pawn.IsPrisonerOfColony) { return pawn.CanReserve(building, 1, -1, null, forced); } else if (pawn.Faction.IsPlayer) { return __result && !PrisonLaborUtility.IsDisabledByLabor(building.Position, pawn, __instance.def.workType); } } return __result; }
public static bool HasJobOnThingFixed(Pawn pawn, Thing t, bool forced) { if (!PawnCanRepairNow(pawn, t)) { return(false); } Building t1 = t as Building; if (PrisonLaborUtility.GetPawnFaction(pawn) == Faction.OfPlayer && !pawn.Map.areaManager.Home[t.Position]) { JobFailReason.Is(WorkGiver_FixBrokenDownBuilding.NotInHomeAreaTrans, null); return(false); } return(pawn.CanReserveAndReach(t1, PathEndMode.ClosestTouch, pawn.NormalMaxDanger(), 1, -1, null, forced) && t1.Map.designationManager.DesignationOn(t1, DesignationDefOf.Deconstruct) == null && (!t1.def.mineable || t1.Map.designationManager.DesignationAt(t1.Position, DesignationDefOf.Mine) == null) && !t1.IsBurning()); }
static bool Postfix(bool __result, Pawn pawn, Thing t, bool forced) { if (!__result) { if (pawn.Faction != Faction.OfPlayer && !pawn.IsPrisonerOfColony) { return(__result); } WorkGiverDef workGiverDef = DefDatabase <WorkGiverDef> .GetNamed("CleanFilth"); return(t is Filth filth && filth.Map.areaManager.Home[filth.Position] && pawn.CanReserveAndReach(t, PathEndMode.ClosestTouch, pawn.NormalMaxDanger(), 1, -1, null, forced) && filth.TicksSinceThickened >= MinTicksSinceThickened && PrisonLaborUtility.CanWorkHere(filth.Position, pawn, workGiverDef.workType)); } return(__result); }
public static IEnumerable <Pawn> Pawns(MainTabWindow mainTabWindow) { foreach (var p in Find.VisibleMap.mapPawns.FreeColonists) { yield return(p); } if (mainTabWindow is MainTabWindow_Work || mainTabWindow is MainTabWindow_Restrict || mainTabWindow.GetType().ToString().Contains("MainTabWindow_WorkTab")) { foreach (var pawn in Find.VisibleMap.mapPawns.PrisonersOfColony) { if (PrisonLaborUtility.LaborEnabled(pawn)) { WorkSettings.InitWorkSettings(pawn); yield return(pawn); } } } }
public override void PostDraw() { if (Active && PrisonLaborPrefs.EnableMotivationIcons) { Pawn pawn = this.parent as Pawn; var need = pawn.needs.TryGetNeed <Need_Motivation>(); if (pawn.health.hediffSet.HasTemperatureInjury(TemperatureInjuryStage.Serious) && PrisonLaborUtility.WorkTime(pawn)) { DrawIcon(TexturePool.freezingTexture); } else if (pawn.IsWatched()) { DrawIcon(TexturePool.watchedTexture); } else if (need != null && need.IsLazy && PrisonLaborUtility.LaborEnabled(pawn) && PrisonLaborUtility.WorkTime(pawn)) { DrawIcon(TexturePool.lazyTexture); } } }
private float GetChangePoints() { if (pawn.IsPrisoner && pawn.IsPrisonerOfColony) { if (pawn.GetRoomGroup() != null) { var value = InspirationTracker.GetInsiprationValue(pawn, true); if (PrisonLaborUtility.LaborEnabled(pawn)) { if (IsPrisonerWorking) { value -= BGP.Laziness_LazyRate; if (HealthAIUtility.ShouldSeekMedicalRest(pawn)) { value -= BGP.Laziness_HealthRate; } value -= (int)pawn.needs.food.CurCategory * BGP.Laziness_HungryRate; value -= (int)pawn.needs.rest.CurCategory * BGP.Laziness_TiredRate; } else if (pawn.timetable != null && pawn.timetable.CurrentAssignment == TimeAssignmentDefOf.Joy) { value += BGP.Laziness_JoyRate; } } _GUIChangeArrow = value.CompareTo(0.0f); return(value); } else { _GUIChangeArrow = 0; return(0.0f); } } else { _GUIChangeArrow = 1; return(+0.01f); } }
public override Job JobOnThing(Pawn pawn, Thing t, bool forced = false) { var prisoner = t as Pawn; if (prisoner == null) { return(null); } if (!ShouldTakeCareOfPrisoner(pawn, prisoner)) { return(null); } if (prisoner.Downed || !pawn.CanReserve(t, 1, -1, null, false) || !prisoner.Awake()) { return(null); } if (pawn.IsPrisoner) { return(null); } if (PrisonLaborUtility.RecruitInLaborEnabled(prisoner)) { return(new Job(JobDefOf.PrisonerAttemptRecruit, t)); } if (PrisonLaborUtility.ConvertInLaborEnabled(prisoner)) { return(new Job(JobDefOf.PrisonerConvert, t)); } if (PrisonLaborUtility.EnslaveInLaborEnabled(prisoner)) { return(new Job(JobDefOf.PrisonerEnslave, t)); } return(null); }
public static IEnumerable <IntVec3> RemoveFromListForbiddenCells(IEnumerable <IntVec3> list, Pawn pawn, WorkTypeDef workType) { return(list.Where(i => !PrisonLaborUtility.IsDisabledByLabor(i, pawn, workType))); }
public override ThinkResult TryIssueJobPackage(Pawn pawn, JobIssueParams jobParams) { var need = pawn.needs.TryGetNeed <Need_Motivation>(); if (pawn.timetable == null) { WorkSettings.InitWorkSettings(pawn); } if (HealthAIUtility.ShouldHaveSurgeryDoneNow(pawn)) { return(ThinkResult.NoJob); } if (PrisonLaborPrefs.EnableFullHealRest && (HealthAIUtility.ShouldBeTendedNowByPlayer(pawn) || HealthAIUtility.ShouldSeekMedicalRest(pawn))) { return(ThinkResult.NoJob); } //Check medical assistance, fed, and rest if not override if (!PrisonLaborUtility.WorkTime(pawn)) { Other.Tutorials.Timetable(); if (need != null) { need.IsPrisonerWorking = false; } return(ThinkResult.NoJob); } //Check motivation if (PrisonLaborPrefs.EnableMotivationMechanics && (need == null || need.IsLazy)) { return(ThinkResult.NoJob); } //Work prisoners will do WorkSettings.InitWorkSettings(pawn); var workList = pawn.workSettings.WorkGiversInOrderNormal; //TODO check this //workList.RemoveAll(workGiver => workGiver.def.defName == "GrowerSow"); if (need != null) { need.IsPrisonerWorking = false; } var num = -999; var targetInfo = TargetInfo.Invalid; WorkGiver_Scanner workGiver_Scanner = null; for (var j = 0; j < workList.Count; j++) { var workGiver = workList[j]; if (workGiver.def.priorityInType != num && targetInfo.IsValid) { break; } if (PawnCanUseWorkGiver(pawn, workGiver)) { try { var job2 = workGiver.NonScanJob(pawn); if (job2 != null) { if (need != null) { need.IsPrisonerWorking = true; } return(new ThinkResult(job2, this, workList[j].def.tagToGive)); } var scanner = workGiver as WorkGiver_Scanner; if (scanner != null) { if (workGiver.def.scanThings) { Predicate <Thing> predicate = t => !t.IsForbidden(pawn) && scanner.HasJobOnThing(pawn, t, false); var enumerable = scanner.PotentialWorkThingsGlobal(pawn); Thing thing; if (scanner.Prioritized) { var enumerable2 = enumerable; if (enumerable2 == null) { enumerable2 = pawn.Map.listerThings.ThingsMatching(scanner.PotentialWorkThingRequest); } var validator = predicate; thing = GenClosest.ClosestThing_Global_Reachable(pawn.Position, pawn.Map, enumerable2, scanner.PathEndMode, TraverseParms.For(pawn, Danger.Deadly, TraverseMode.ByPawn, false), 9999f, validator, x => scanner.GetPriority(pawn, x)); } else { var validator = predicate; var forceGlobalSearch = enumerable != null; thing = GenClosest.ClosestThingReachable(pawn.Position, pawn.Map, scanner.PotentialWorkThingRequest, scanner.PathEndMode, TraverseParms.For(pawn, Danger.Deadly, TraverseMode.ByPawn, false), 9999f, validator, enumerable, 0, scanner.MaxRegionsToScanBeforeGlobalSearch, forceGlobalSearch, RegionType.Set_Passable, false); } if (thing != null) { targetInfo = thing; workGiver_Scanner = scanner; } } if (workGiver.def.scanCells) { var position = pawn.Position; var num2 = 99999f; var num3 = -3.40282347E+38f; var prioritized = scanner.Prioritized; foreach (var current in scanner.PotentialWorkCellsGlobal(pawn)) { var flag = false; float num4 = (current - position).LengthHorizontalSquared; if (prioritized) { if (!current.IsForbidden(pawn) && scanner.HasJobOnCell(pawn, current)) { var priority = scanner.GetPriority(pawn, current); if (priority > num3 || priority == num3 && num4 < num2) { flag = true; num3 = priority; } } } else if (num4 < num2 && !current.IsForbidden(pawn) && scanner.HasJobOnCell(pawn, current)) { flag = true; } if (flag) { targetInfo = new TargetInfo(current, pawn.Map, false); workGiver_Scanner = scanner; num2 = num4; } } } } } catch (Exception ex) { Log.Error(string.Concat(pawn, " threw exception in WorkGiver ", workGiver.def.defName, ": ", ex.ToString())); } finally { } if (targetInfo.IsValid) { Job job3; if (targetInfo.HasThing) { job3 = workGiver_Scanner.JobOnThing(pawn, targetInfo.Thing, false); } else { job3 = workGiver_Scanner.JobOnCell(pawn, targetInfo.Cell); } if (job3 != null) { job3.workGiverDef = workGiver.def; if (need != null) { need.IsPrisonerWorking = true; } return(new ThinkResult(job3, this, workList[j].def.tagToGive)); } Log.ErrorOnce( string.Concat(workGiver_Scanner, " provided target ", targetInfo, " but yielded no actual job for pawn ", pawn, ". The CanGiveJob and JobOnX methods may not be synchronized."), 6112651); } num = workGiver.def.priorityInType; } } return(ThinkResult.NoJob); }
public static Predicate <Thing> CreatePredicate(Pawn pawn, WorkGiver_Scanner scanner) { return(t => !t.IsForbidden(pawn) && scanner.HasJobOnThing(pawn, t, false) && !PrisonLaborUtility.IsDisabledByLabor(t.Position, pawn, scanner.def.workType)); }
static IEnumerable <Widgets.DropdownMenuElement <Pawn> > Postfix_GenerateFields(IEnumerable <Widgets.DropdownMenuElement <Pawn> > values, Dialog_BillConfig __instance) { int check = ModsConfig.IdeologyActive ? 1 : 0; int i = 0; Bill_Production bill = Traverse.Create(__instance).Field("bill").GetValue <Bill_Production>(); Widgets.DropdownMenuElement <Pawn> anyone = new Widgets.DropdownMenuElement <Pawn> { option = new FloatMenuOption("PrisonLabor_ColonyOnly".Translate(), delegate { Traverse.Create(bill).Field("slavesOnly").SetValue(true); Traverse.Create(bill).Field("pawnRestriction").SetValue(null); BillAssignationUtility.SetFor(bill, GroupMode.ColonyOnly); }), payload = null }; yield return(anyone); foreach (Widgets.DropdownMenuElement <Pawn> value in values) { yield return(value); if (check == i) { Widgets.DropdownMenuElement <Pawn> prisonerMenu = new Widgets.DropdownMenuElement <Pawn> { option = new FloatMenuOption("PrisonLabor_PrisonersOnly".Translate(), delegate { bill.SetAnyPawnRestriction(); BillAssignationUtility.SetFor(bill, GroupMode.PrisonersOnly); }), payload = null }; yield return(prisonerMenu); Widgets.DropdownMenuElement <Pawn> anyCaptive = new Widgets.DropdownMenuElement <Pawn> { option = new FloatMenuOption("PrisonLabor_PrisonersAndSlaveOnly".Translate(), delegate { bill.SetAnySlaveRestriction(); BillAssignationUtility.SetFor(bill, GroupMode.CaptiveOnly); }), payload = null }; yield return(anyCaptive); } i++; } WorkGiverDef workGiver = bill.billStack.billGiver.GetWorkgiver(); SkillDef workSkill = bill.recipe.workSkill; IEnumerable <Pawn> allPrisonersOfColony = PawnsFinder.AllMaps_PrisonersOfColony; allPrisonersOfColony = allPrisonersOfColony.OrderBy((Pawn pawn) => pawn.LabelShortCap); if (workSkill != null) { allPrisonersOfColony = allPrisonersOfColony.OrderByDescending((Pawn pawn) => pawn.skills.GetSkill(bill.recipe.workSkill).Level); } if (workGiver == null) { Log.ErrorOnce("Generating pawn restrictions for a BillGiver without a Workgiver", 96455148); yield break; } allPrisonersOfColony = allPrisonersOfColony.OrderByDescending((Pawn pawn) => pawn.workSettings.WorkIsActive(workGiver.workType)); allPrisonersOfColony = allPrisonersOfColony.OrderBy((Pawn pawn) => pawn.WorkTypeIsDisabled(workGiver.workType)); Widgets.DropdownMenuElement <Pawn> dropdownMenuElement; foreach (Pawn pawn in allPrisonersOfColony) { if (PrisonLaborUtility.LaborEnabled(pawn)) { if (pawn.WorkTypeIsDisabled(workGiver.workType)) { dropdownMenuElement = new Widgets.DropdownMenuElement <Pawn> { option = new FloatMenuOption(string.Format("P: {0} ({1})", pawn.LabelShortCap, "WillNever".Translate(workGiver.verb)), null), payload = pawn }; yield return(dropdownMenuElement); } else if (bill.recipe.workSkill != null && !pawn.workSettings.WorkIsActive(workGiver.workType)) { dropdownMenuElement = new Widgets.DropdownMenuElement <Pawn> { option = new FloatMenuOption(string.Format("P: {0} ({1} {2}, {3})", pawn.LabelShortCap, pawn.skills.GetSkill(bill.recipe.workSkill).Level, bill.recipe.workSkill.label, "NotAssigned".Translate()), delegate { bill.SetPawnRestriction(pawn); }), payload = pawn }; yield return(dropdownMenuElement); } else if (!pawn.workSettings.WorkIsActive(workGiver.workType)) { dropdownMenuElement = new Widgets.DropdownMenuElement <Pawn> { option = new FloatMenuOption(string.Format("P: {0} ({1})", pawn.LabelShortCap, "NotAssigned".Translate()), delegate { bill.SetPawnRestriction(pawn); }), payload = pawn }; yield return(dropdownMenuElement); } else if (bill.recipe.workSkill != null) { dropdownMenuElement = new Widgets.DropdownMenuElement <Pawn> { option = new FloatMenuOption($"P: {pawn.LabelShortCap} ({pawn.skills.GetSkill(bill.recipe.workSkill).Level} {bill.recipe.workSkill.label})", delegate { bill.SetPawnRestriction(pawn); }), payload = pawn }; yield return(dropdownMenuElement); } else { dropdownMenuElement = new Widgets.DropdownMenuElement <Pawn> { option = new FloatMenuOption($"P: {pawn.LabelShortCap}", delegate { bill.SetPawnRestriction(pawn); }), payload = pawn }; yield return(dropdownMenuElement); } } } }
private static bool PawnCanRepairEver(Pawn pawn, Thing t) { return(t is Building building && t.def.useHitPoints && (building.def.building.repairable && t.Faction == PrisonLaborUtility.GetPawnFaction(pawn))); }
private static bool PawnCanRepairNow(Pawn pawn, Thing t) { return(PawnCanRepairEver(pawn, t) && pawn.Map.listerBuildingsRepairable.Contains(PrisonLaborUtility.GetPawnFaction(pawn), (Building)t) && t.HitPoints != t.MaxHitPoints); }
public static Job postfix_Job(Job __result, Pawn pawn, Thing t, bool forced) { WorkTypeDef workDef = DefDatabase <WorkTypeDef> .GetNamed("QuarryMining"); if (__result != null && !pawn.IsPrisonerOfColony && pawn.Faction != null && pawn.Faction.IsPlayer && PrisonLaborUtility.IsDisabledByLabor(__result.targetA.Cell, pawn, workDef)) { return(null); } return(__result); }
static IEnumerable <Widgets.DropdownMenuElement <Pawn> > Postfix(IEnumerable <Widgets.DropdownMenuElement <Pawn> > values, Dialog_BillConfig __instance) { foreach (Widgets.DropdownMenuElement <Pawn> value in values) { yield return(value); } Bill_Production bill = Traverse.Create(__instance).Field("bill").GetValue <Bill_Production>(); WorkGiverDef workGiver = bill.billStack.billGiver.GetWorkgiver(); List <Pawn> allPrisonersOfColony = PawnsFinder.AllMaps_PrisonersOfColony; Widgets.DropdownMenuElement <Pawn> dropdownMenuElement; foreach (Pawn pawn in allPrisonersOfColony) { if (PrisonLaborUtility.LaborEnabled(pawn)) { if (pawn.WorkTypeIsDisabled(workGiver.workType)) { dropdownMenuElement = new Widgets.DropdownMenuElement <Pawn> { option = new FloatMenuOption(string.Format("{0} ({1})", pawn.LabelShortCap, "WillNever".Translate(workGiver.verb)), null), payload = pawn }; yield return(dropdownMenuElement); } else if (bill.recipe.workSkill != null && !pawn.workSettings.WorkIsActive(workGiver.workType)) { dropdownMenuElement = new Widgets.DropdownMenuElement <Pawn> { option = new FloatMenuOption(string.Format("{0} ({1} {2}, {3})", pawn.LabelShortCap, pawn.skills.GetSkill(bill.recipe.workSkill).Level, bill.recipe.workSkill.label, "NotAssigned".Translate()), delegate { bill.pawnRestriction = pawn; }), payload = pawn }; yield return(dropdownMenuElement); } else if (!pawn.workSettings.WorkIsActive(workGiver.workType)) { dropdownMenuElement = new Widgets.DropdownMenuElement <Pawn> { option = new FloatMenuOption(string.Format("{0} ({1})", pawn.LabelShortCap, "NotAssigned".Translate()), delegate { bill.pawnRestriction = pawn; }), payload = pawn }; yield return(dropdownMenuElement); } else if (bill.recipe.workSkill != null) { dropdownMenuElement = new Widgets.DropdownMenuElement <Pawn> { option = new FloatMenuOption($"{pawn.LabelShortCap} ({pawn.skills.GetSkill(bill.recipe.workSkill).Level} {bill.recipe.workSkill.label})", delegate { bill.pawnRestriction = pawn; }), payload = pawn }; yield return(dropdownMenuElement); } else { dropdownMenuElement = new Widgets.DropdownMenuElement <Pawn> { option = new FloatMenuOption($"{pawn.LabelShortCap}", delegate { bill.pawnRestriction = pawn; }), payload = pawn }; yield return(dropdownMenuElement); } } } }