Esempio n. 1
0
        MutaChamber FindValidChamberFor([NotNull] Pawn worker, [NotNull] Pawn prisoner)
        {
            var chamber = MutaChamber.FindMutaChamberFor(prisoner, worker);

            return(chamber);
        }
Esempio n. 2
0
            private static bool Prefix_AddHumanlikeOrders(Vector3 clickPos, Pawn pawn, List <FloatMenuOption> opts)
            {
                if (pawn.health.capacities.CapableOf(PawnCapacityDefOf.Manipulation))
                {
                    foreach (LocalTargetInfo localTargetInfo3 in GenUI.TargetsAt_NewTemp(clickPos, TargetingParameters.ForRescue(pawn), true))
                    {
                        LocalTargetInfo localTargetInfo4 = localTargetInfo3;
                        var             victim           = (Pawn)localTargetInfo4.Thing;
                        MutagenDef      mutagen          = MutagenDefOf.MergeMutagen;
                        if (mutagen.CanTransform(victim) &&
                            pawn.CanReserveAndReach(victim, PathEndMode.OnCell, Danger.Deadly, 1, -1, null, true))
                        {
                            if (MutaChamber.FindMutaChamberFor(victim, pawn, true, ChamberUse.Tf) != null)
                            {
                                string text4   = "CarryToChamber".Translate(localTargetInfo4.Thing.LabelCap, localTargetInfo4.Thing);
                                JobDef jDef    = Mutagen_JobDefOf.CarryToMutagenChamber;
                                Action action3 = delegate
                                {
                                    var building_chamber =
                                        MutaChamber.FindMutaChamberFor(victim, pawn);
                                    if (building_chamber == null)
                                    {
                                        building_chamber = MutaChamber.FindMutaChamberFor(victim, pawn, true);
                                    }
                                    if (building_chamber == null)
                                    {
                                        Messages.Message("CannotCarryToChamber".Translate() + ": " + "NoChamber".Translate(), victim,
                                                         MessageTypeDefOf.RejectInput, false);
                                        return;
                                    }

                                    var job = new Job(jDef, victim, building_chamber);
                                    job.count = 1;
                                    pawn.jobs.TryTakeOrderedJob(job);
                                };
                                string label   = text4;
                                Action action2 = action3;
                                Pawn   revalidateClickTarget = victim;
                                opts.Add(FloatMenuUtility
                                         .DecoratePrioritizedTask(new FloatMenuOption(label, action2, MenuOptionPriority.Default, null, revalidateClickTarget),
                                                                  pawn, victim));
                            }
                            if (MutaChamber.FindMutaChamberFor(victim, pawn, true, ChamberUse.Merge) != null)
                            {
                                string text4   = "PMCarryToChamberMerge".Translate(localTargetInfo4.Thing.LabelCap, localTargetInfo4.Thing);
                                JobDef jDef    = Mutagen_JobDefOf.CarryToMutagenChamber;
                                Action action3 = delegate
                                {
                                    var building_chamber =
                                        MutaChamber.FindMutaChamberFor(victim, pawn);
                                    if (building_chamber == null)
                                    {
                                        building_chamber = MutaChamber.FindMutaChamberFor(victim, pawn, true);
                                    }
                                    if (building_chamber == null)
                                    {
                                        Messages.Message("CannotCarryToChamber".Translate() + ": " + "NoChamber".Translate(), victim,
                                                         MessageTypeDefOf.RejectInput, false);
                                        return;
                                    }

                                    var job = new Job(jDef, victim, building_chamber);
                                    job.count = 1;
                                    pawn.jobs.TryTakeOrderedJob(job);
                                };
                                string label   = text4;
                                Action action2 = action3;
                                Pawn   revalidateClickTarget = victim;
                                opts.Add(FloatMenuUtility
                                         .DecoratePrioritizedTask(new FloatMenuOption(label, action2, MenuOptionPriority.Default, null, revalidateClickTarget),
                                                                  pawn, victim));
                            }
                        }
                    }
                }

                return(true);
            }