// Token: 0x06002514 RID: 9492 RVA: 0x00116FA0 File Offset: 0x001153A0 public override IEnumerable <FloatMenuOption> GetFloatMenuOptions(Pawn pawn) { foreach (FloatMenuOption o in base.GetFloatMenuOptions(pawn)) { if (o.Label != "EnterCryptosleepCasket".Translate()) { yield return(o); } } if (CheatMod) { JobDef jobDef = PS_ReconPodDefsOf.PS_DoConditioning; string jobStr = "PS_PodOption_CheatMode".Translate(); void jobAction() { var job = new Job(jobDef, this); pawn.jobs.TryTakeOrderedJob(job, JobTag.Misc); } yield return(FloatMenuUtility.DecoratePrioritizedTask(new FloatMenuOption(jobStr, jobAction, MenuOptionPriority.Default, null, null, 0f, null, null), pawn, this, "ReservedBy")); yield break; } if (!this.TryGetComp <CompPowerTrader>().PowerOn) { yield return(new FloatMenuOption("CannotUseNoPower".Translate(), null, MenuOptionPriority.Default, null, null, 0f, null, null)); } else if (PS_ConditioningHelper.IsCemented(pawn)) { yield return(new FloatMenuOption(string.Format("PS_CementCantUsePod".Translate(), pawn.LabelShort), null, MenuOptionPriority.Default, null, null, 0f, null, null)); yield break; } else if (PodOwner != null && pawn != PodOwner) { yield return(new FloatMenuOption("PS_OwnedBy".Translate() + PodOwner.LabelShort, null, MenuOptionPriority.Default, null, null, 0f, null, null)); } else if (innerContainer.Count == 0) { if (PS_ConditioningHelper.IsReconditioned(pawn) && PS_PodFinder.FindMyPod(pawn) != this && PS_PodFinder.FindMyPod(pawn) != null) { yield return(new FloatMenuOption(string.Format("PS_NotOwnedBy".Translate(), pawn.LabelShort), null, MenuOptionPriority.Default, null, null, 0f, null, null)); } else if (PS_ConditioningHelper.IsReconditioned(pawn) && PS_PodFinder.FindMyPod(pawn) == null && PodOwner == null) { JobDef jobDef = PS_ReconPodDefsOf.PS_RefreshConditioning; var jobStr = string.Format("PS_PodOption_ClaimPod".Translate(), pawn.LabelShort); void jobAction() { TryAssignPawn(pawn); } yield return(FloatMenuUtility.DecoratePrioritizedTask(new FloatMenuOption(jobStr, jobAction, MenuOptionPriority.Default, null, null, 0f, null, null), pawn, this, "ReservedBy")); } else if (pawn.CanReach(this, PathEndMode.InteractionCell, Danger.Deadly, false, TraverseMode.ByPawn)) { if (PS_ConditioningHelper.IsReconditioned(pawn)) { JobDef jobDef = PS_ReconPodDefsOf.PS_RefreshConditioning; string jobStr = "PS_PodOption_RefreshConditioning".Translate(); void jobAction() { var job = new Job(jobDef, this); pawn.jobs.TryTakeOrderedJob(job, JobTag.Misc); } yield return(FloatMenuUtility.DecoratePrioritizedTask(new FloatMenuOption(jobStr, jobAction, MenuOptionPriority.Default, null, null, 0f, null, null), pawn, this, "ReservedBy")); JobDef jobDef2 = PS_ReconPodDefsOf.PS_ManageConditioning; string jobStr2 = "PS_PodOption_Decondition".Translate(); void jobAction2() { var job2 = new Job(jobDef2, this); pawn.jobs.TryTakeOrderedJob(job2, JobTag.Misc); } yield return(FloatMenuUtility.DecoratePrioritizedTask(new FloatMenuOption(jobStr2, jobAction2, MenuOptionPriority.Default, null, null, 0f, null, null), pawn, this, "ReservedBy")); } else { JobDef jobDef = PS_ReconPodDefsOf.PS_DoConditioning; string jobStr = "PS_PodOption_Condition".Translate(); void jobAction() { var job = new Job(jobDef, this); pawn.jobs.TryTakeOrderedJob(job, JobTag.Misc); } yield return(FloatMenuUtility.DecoratePrioritizedTask(new FloatMenuOption(jobStr, jobAction, MenuOptionPriority.Default, null, null, 0f, null, null), pawn, this, "ReservedBy")); } } } yield break; }
public override IEnumerable <FloatMenuOption> GetFloatMenuOptions(Pawn myPawn) { if (!ReachabilityUtility.CanReach(myPawn, this, (PathEndMode)4, (Danger)2, false, 0)) { FloatMenuOption item = new FloatMenuOption(Translator.Translate("CannotUseNoPath"), null, (MenuOptionPriority)4, null, null, 0f, null, null); return(new List <FloatMenuOption> { item }); } if (Spawned && Map.gameConditionManager.ConditionIsActive(GameConditionDefOf.SolarFlare)) { return(new List <FloatMenuOption> { new FloatMenuOption(Translator.Translate("CannotUseSolarFlare"), null, (MenuOptionPriority)4, null, null, 0f, null, null) }); } if (!myPawn.health.capacities.CapableOf(PawnCapacityDefOf.Talking)) { return(new List <FloatMenuOption> { new FloatMenuOption(Translator.Translate("CannotUseReason", new object[] { Translator.Translate("IncapableOfCapacity", new object[] { PawnCapacityDefOf.Talking.label }) }), null, (Verse.MenuOptionPriority) 4, null, null, 0f, null, null) }); } if (!this.CanUseSignalFireNow) { Log.Error(myPawn + " could not use comm console for unknown reason."); return(new List <FloatMenuOption> { new FloatMenuOption("Cannot use now", null, (MenuOptionPriority)4, null, null, 0f, null, null) }); } List <FloatMenuOption> list = new List <FloatMenuOption>(); foreach (ICommunicable commTarget in Find.FactionManager.AllFactionsInViewOrder) { ICommunicable localCommTarget = commTarget; string text = Translator.Translate("CallOnRadio", new object[] { localCommTarget.GetCallLabel() }); if (localCommTarget is Faction faction) { if (faction.IsPlayer) { continue; } if (!LeaderIsAvailableToTalk(faction)) { string str; if (faction.leader != null) { str = Translator.Translate("LeaderUnavailable", new object[] { faction.leader.LabelShort }); } else { str = Translator.Translate("LeaderUnavailableNoLeader"); } list.Add(new FloatMenuOption(text + " (" + str + ")", null, (MenuOptionPriority)4, null, null, 0f, null, null)); continue; } } void action() { if (commTarget is TradeShip && !Building_OrbitalTradeBeacon.AllPowered(Map).Any()) { Messages.Message(Translator.Translate("MessageNeedBeaconToTradeWithShip"), this, MessageTypeDefOf.RejectInput, false); } else { Job job = new Job(DefDatabase <JobDef> .GetNamed("UseSignalFire", true), this) { commTarget = localCommTarget }; myPawn.jobs.TryTakeOrderedJob(job, 0); PlayerKnowledgeDatabase.KnowledgeDemonstrated(ConceptDefOf.OpeningComms, (KnowledgeAmount)6); } } list.Add(FloatMenuUtility.DecoratePrioritizedTask(new FloatMenuOption(text, action, (MenuOptionPriority)7, null, null, 0f, null, null), myPawn, this, "ReservedBy")); } return(list); }
public override IEnumerable<FloatMenuOption> CompFloatMenuOptions(Pawn myPawn) { foreach (var g in base.CompFloatMenuOptions(myPawn)) yield return g; if (!myPawn.CanReach(parent, PathEndMode.InteractionCell, Danger.Some)) { yield return new FloatMenuOption("CannotUseNoPath".Translate(), null); yield break; } if (parent.Spawned && parent.Map.gameConditionManager.ConditionIsActive(GameConditionDefOf.SolarFlare)) { yield return new FloatMenuOption("CannotUseSolarFlare".Translate(), null); yield break; } if (Props.usesPower && (!parent.TryGetComp<CompPowerTrader>()?.PowerOn ?? false)) { yield return new FloatMenuOption("CannotUseNoPower".Translate(), null); yield break; } if (!myPawn.health.capacities.CapableOf(PawnCapacityDefOf.Talking)) { yield return new FloatMenuOption("CannotUseReason".Translate(new object[] { "IncapableOfCapacity".Translate(new object[] { PawnCapacityDefOf.Talking.label }) }), null); yield break; } if (myPawn.skills.GetSkill(SkillDefOf.Social).TotallyDisabled) { yield return new FloatMenuOption("CannotPrioritizeWorkTypeDisabled".Translate(new object[] { SkillDefOf.Social.LabelCap }), null); yield break; } if (!this.CanUseCommsNow) { Log.Error(myPawn + " could not use " + parent.Label + " for unknown reason."); yield return new FloatMenuOption("Cannot use now", null); yield break; } var list = new List<FloatMenuOption>(); var enumerable = myPawn.Map.passingShipManager.passingShips.Cast<ICommunicable>().Concat(Find.FactionManager.AllFactionsInViewOrder.Cast<ICommunicable>()); using (var enumerator = enumerable.GetEnumerator()) { while (enumerator.MoveNext()) { var localCommTarget = enumerator.Current; if (localCommTarget == null) continue; var text = "CallOnRadio".Translate(localCommTarget.GetCallLabel()); if (localCommTarget is Faction faction) { if (faction.IsPlayer) continue; if (!LeaderIsAvailableToTalk(faction)) { string str; if (faction.leader != null) str = "LeaderUnavailable".Translate(faction.leader.LabelShort); else str = "LeaderUnavailableNoLeader".Translate(); list.Add(new FloatMenuOption(text + " (" + str + ")", null)); continue; } } void Action() { if (localCommTarget is TradeShip && !Building_OrbitalTradeBeacon.AllPowered(parent.Map).Any()) { Messages.Message("MessageNeedBeaconToTradeWithShip".Translate(), parent, MessageTypeDefOf.RejectInput); return; } UseAct(myPawn, localCommTarget); } list.Add(FloatMenuUtility.DecoratePrioritizedTask(new FloatMenuOption(text, Action, MenuOptionPriority.InitiateSocial), myPawn, parent, "ReservedBy")); } } foreach (var option in list) { yield return option; } yield break; }
public static void Postfix(ref List <FloatMenuOption> __result, Vector3 clickPos, Pawn pawn, bool suppressAutoTakeableGoto = false) { if (!pawn.RaceProps.Humanlike) { var compMachine = pawn.GetComp <CompMachine>(); if (compMachine != null && compMachine.Props.canPickupWeapons) { IntVec3 c = IntVec3.FromVector3(clickPos); ThingWithComps equipment = null; List <Thing> thingList2 = c.GetThingList(pawn.Map); for (int i = 0; i < thingList2.Count; i++) { if (thingList2[i].TryGetComp <CompEquippable>() != null) { equipment = (ThingWithComps)thingList2[i]; break; } } if (equipment != null) { string labelShort = equipment.LabelShort; FloatMenuOption item6; string cantReason; if (equipment.def.IsWeapon && pawn.WorkTagIsDisabled(WorkTags.Violent)) { item6 = new FloatMenuOption("CannotEquip".Translate(labelShort) + ": " + "IsIncapableOfViolenceLower".Translate(pawn.LabelShort, pawn), null); } else if (equipment.def.IsRangedWeapon && pawn.WorkTagIsDisabled(WorkTags.Shooting)) { item6 = new FloatMenuOption("CannotEquip".Translate(labelShort) + ": " + "IsIncapableOfShootingLower".Translate(pawn), null); } else if (!pawn.CanReach(equipment, PathEndMode.ClosestTouch, Danger.Deadly)) { item6 = new FloatMenuOption("CannotEquip".Translate(labelShort) + ": " + "NoPath".Translate().CapitalizeFirst(), null); } else if (!pawn.health.capacities.CapableOf(PawnCapacityDefOf.Manipulation)) { item6 = new FloatMenuOption("CannotEquip".Translate(labelShort) + ": " + "Incapable".Translate(), null); } else if (equipment.IsBurning()) { item6 = new FloatMenuOption("CannotEquip".Translate(labelShort) + ": " + "BurningLower".Translate(), null); } else if (pawn.IsQuestLodger() && !EquipmentUtility.QuestLodgerCanEquip(equipment, pawn)) { item6 = new FloatMenuOption("CannotEquip".Translate(labelShort) + ": " + "QuestRelated".Translate().CapitalizeFirst(), null); } else if (!EquipmentUtility.CanEquip(equipment, pawn, out cantReason, checkBonded: false)) { item6 = new FloatMenuOption("CannotEquip".Translate(labelShort) + ": " + cantReason.CapitalizeFirst(), null); } else { string text4 = "Equip".Translate(labelShort); if (equipment.def.IsRangedWeapon && pawn.story != null && pawn.story.traits.HasTrait(TraitDefOf.Brawler)) { text4 += " " + "EquipWarningBrawler".Translate(); } if (EquipmentUtility.AlreadyBondedToWeapon(equipment, pawn)) { text4 += " " + "BladelinkAlreadyBonded".Translate(); TaggedString dialogText = "BladelinkAlreadyBondedDialog".Translate(pawn.Named("PAWN"), equipment.Named("WEAPON"), pawn.equipment.bondedWeapon.Named("BONDEDWEAPON")); item6 = FloatMenuUtility.DecoratePrioritizedTask(new FloatMenuOption(text4, delegate { Find.WindowStack.Add(new Dialog_MessageBox(dialogText)); }, MenuOptionPriority.High), pawn, equipment); } else { item6 = FloatMenuUtility.DecoratePrioritizedTask(new FloatMenuOption(text4, delegate { string personaWeaponConfirmationText = EquipmentUtility.GetPersonaWeaponConfirmationText(equipment, pawn); if (!personaWeaponConfirmationText.NullOrEmpty()) { Find.WindowStack.Add(new Dialog_MessageBox(personaWeaponConfirmationText, "Yes".Translate(), delegate { Equip(); }, "No".Translate())); } else { Equip(); } }, MenuOptionPriority.High), pawn, equipment); } } __result.Add(item6); if (SimpleSidearmsPatch.SimpleSidearmsActive) { AppendSidearmsOptions(pawn, equipment, ref __result); } } void Equip() { equipment.SetForbidden(value: false); pawn.jobs.TryTakeOrderedJob(JobMaker.MakeJob(JobDefOf.Equip, equipment), JobTag.Misc); FleckMaker.Static(equipment.DrawPos, equipment.MapHeld, FleckDefOf.FeedbackEquip); PlayerKnowledgeDatabase.KnowledgeDemonstrated(ConceptDefOf.EquippingWeapons, KnowledgeAmount.Total); } } } }
static void AddMenuItems(Vector3 clickPos, Pawn pawn, List <FloatMenuOption> opts) { // Stabilize if (pawn.health.capacities.CapableOf(PawnCapacityDefOf.Manipulation)) { foreach (LocalTargetInfo curTarget in GenUI.TargetsAt(clickPos, TargetingParameters.ForRescue(pawn), true)) // !! This needs to be patched into A17 { Pawn patient = (Pawn)curTarget.Thing; if (patient.Downed //&& pawn.CanReserveAndReach(patient, PathEndMode.InteractionCell, Danger.Deadly) && pawn.CanReach(patient, PathEndMode.InteractionCell, Danger.Deadly) && patient.health.hediffSet.GetHediffsTendable().Any(h => h.CanBeStabilized())) { if (pawn.story.WorkTypeIsDisabled(WorkTypeDefOf.Doctor)) { opts.Add(new FloatMenuOption("CE_CannotStabilize".Translate() + ": " + "IncapableOfCapacity".Translate(WorkTypeDefOf.Doctor.gerundLabel), null, MenuOptionPriority.Default)); } else { string label = "CE_Stabilize".Translate(patient.LabelCap); Action action = delegate { if (pawn.inventory == null || pawn.inventory.innerContainer == null || !pawn.inventory.innerContainer.Any(t => t.def.IsMedicine)) { Messages.Message("CE_CannotStabilize".Translate() + ": " + "CE_NoMedicine".Translate(pawn), patient, MessageTypeDefOf.RejectInput); return; } // Drop medicine from inventory Medicine medicine = (Medicine)pawn.inventory.innerContainer.OrderByDescending(t => t.GetStatValue(StatDefOf.MedicalPotency)).FirstOrDefault(); Thing medThing; if (medicine != null && pawn.inventory.innerContainer.TryDrop(medicine, pawn.Position, pawn.Map, ThingPlaceMode.Direct, 1, out medThing)) { Job job = new Job(CE_JobDefOf.Stabilize, patient, medThing); job.count = 1; pawn.jobs.TryTakeOrderedJob(job); PlayerKnowledgeDatabase.KnowledgeDemonstrated(CE_ConceptDefOf.CE_Stabilizing, KnowledgeAmount.Total); } }; opts.Add(FloatMenuUtility.DecoratePrioritizedTask(new FloatMenuOption(label, action, MenuOptionPriority.Default, null, patient), pawn, patient, "ReservedBy")); } } } } // Item pickup. IntVec3 c = IntVec3.FromVector3(clickPos); CompInventory compInventory = pawn.TryGetComp <CompInventory>(); if (compInventory != null) { List <Thing> thingList = c.GetThingList(pawn.Map); foreach (Thing item in thingList) { if (item != null && item.def.alwaysHaulable && !(item is Corpse)) { //FloatMenuOption pickUpOption; int count = 0; if (!pawn.CanReach(item, PathEndMode.Touch, Danger.Deadly)) { opts.Add(new FloatMenuOption("CannotPickUp".Translate() + " " + item.LabelShort + " (" + "NoPath".Translate() + ")", null)); } else if (!compInventory.CanFitInInventory(item, out count)) { opts.Add(new FloatMenuOption("CannotPickUp".Translate(item.LabelShort, item) + " (" + "CE_InventoryFull".Translate() + ")", null)); } // Pick up x else if (count == 1) { opts.Add(FloatMenuUtility.DecoratePrioritizedTask(new FloatMenuOption("PickUp".Translate(item.Label, item), delegate { item.SetForbidden(false, false); Job job = new Job(JobDefOf.TakeInventory, item); job.count = 1; pawn.jobs.TryTakeOrderedJob(job, JobTag.Misc); pawn.Notify_HoldTrackerJob(job); PlayerKnowledgeDatabase.KnowledgeDemonstrated(CE_ConceptDefOf.CE_InventoryWeightBulk, KnowledgeAmount.SpecificInteraction); }, MenuOptionPriority.High, null, null, 0f, null, null), pawn, item, "ReservedBy")); } else { if (count < item.stackCount) { opts.Add(new FloatMenuOption("CannotPickUpAll".Translate(item.Label, item) + " (" + "CE_InventoryFull".Translate() + ")", null, MenuOptionPriority.Default, null, null, 0f, null, null)); } else { opts.Add(FloatMenuUtility.DecoratePrioritizedTask(new FloatMenuOption("PickUpAll".Translate(item.Label, item), delegate { item.SetForbidden(false, false); Job job = new Job(JobDefOf.TakeInventory, item); job.count = item.stackCount; pawn.jobs.TryTakeOrderedJob(job, JobTag.Misc); pawn.Notify_HoldTrackerJob(job); PlayerKnowledgeDatabase.KnowledgeDemonstrated(CE_ConceptDefOf.CE_InventoryWeightBulk, KnowledgeAmount.SpecificInteraction); }, MenuOptionPriority.High, null, null, 0f, null, null), pawn, item, "ReservedBy")); } opts.Add(FloatMenuUtility.DecoratePrioritizedTask(new FloatMenuOption("PickUpSome".Translate(item.Label, item), delegate { int to = Mathf.Min(count, item.stackCount); Dialog_Slider window = new Dialog_Slider("PickUpCount".Translate(item.LabelShort, item), 1, to, delegate(int selectCount) { item.SetForbidden(false, false); Job job = new Job(JobDefOf.TakeInventory, item); job.count = selectCount; pawn.jobs.TryTakeOrderedJob(job, JobTag.Misc); pawn.Notify_HoldTrackerJob(job); }, -2147483648); Find.WindowStack.Add(window); PlayerKnowledgeDatabase.KnowledgeDemonstrated(CE_ConceptDefOf.CE_InventoryWeightBulk, KnowledgeAmount.SpecificInteraction); }, MenuOptionPriority.High, null, null, 0f, null, null), pawn, item, "ReservedBy")); } } } } }