public override IEnumerable <FloatMenuOption> GetFloatMenuOptions(Pawn myPawn)
        {
            ///This code returns all the other float menu options first!
            var enumerator = base.GetFloatMenuOptions(myPawn).GetEnumerator();

            while (enumerator.MoveNext())
            {
                var current = enumerator.Current;
                yield return(current);
            }

            if (CultUtility.AreCultObjectsAvailable(Map) == false)
            {
                if (CultUtility.IsSomeoneInvestigating(Map) == false)
                {
                    void action0()
                    {
                        var job = new Job(CultsDefOf.Cults_Investigate, myPawn, this)
                        {
                            playerForced = true
                        };

                        myPawn.jobs.TryTakeOrderedJob(job);
                        //mypawn.CurJob.EndCurrentJob(JobCondition.InterruptForced);
                    }

                    yield return(new FloatMenuOption("Cults_Investigate".Translate(), action0));
                }
            }
        }
        public override IEnumerable <FloatMenuOption> GetFloatMenuOptions(Pawn myPawn)
        {
            ///This code returns all the other float menu options first!
            IEnumerator <FloatMenuOption> enumerator = base.GetFloatMenuOptions(myPawn).GetEnumerator();

            while (enumerator.MoveNext())
            {
                FloatMenuOption current = enumerator.Current;
                yield return(current);
            }

            if (this.def != null && this is Building_Monolith)
            {
                if (this.def.hasInteractionCell)
                {
                    if (CultUtility.AreCultObjectsAvailable(Map) == false)
                    {
                        if (CultUtility.IsSomeoneInvestigating(Map) == false)
                        {
                            if (Map.reservationManager.CanReserve(myPawn, this))
                            {
                                Action action0 = delegate
                                {
                                    Job job = new Job(CultsDefOf.Cults_Investigate, myPawn, this);
                                    job.playerForced = true;
                                    myPawn.jobs.TryTakeOrderedJob(job);
                                    //mypawn.CurJob.EndCurrentJob(JobCondition.InterruptForced);
                                };
                                yield return(new FloatMenuOption("Investigate", action0, MenuOptionPriority.Default, null, null, 0f, null));
                            }
                        }
                    }
                }
            }
        }
        public override IEnumerable <FloatMenuOption> GetFloatMenuOptions(Pawn myPawn)
        {
            ///This code returns all the other float menu options first!
            IEnumerator <FloatMenuOption> enumerator = base.GetFloatMenuOptions(myPawn).GetEnumerator();

            while (enumerator.MoveNext())
            {
                FloatMenuOption current = enumerator.Current;
                yield return(current);
            }

            if (this.def != null && this is Building_Monolith)
            {
                if (this.def.hasInteractionCell)
                {
                    if (CultUtility.AreCultObjectsAvailable(Map) == false)
                    {
                        if (CultUtility.IsSomeoneInvestigating(Map) == false)
                        {
                            if (Map.reservationManager.CanReserve(myPawn, this))
                            {
                                Action action0 = delegate
                                {
                                    DoInvestigateJob(myPawn);
                                };
                                yield return(new FloatMenuOption("Investigate", action0, MenuOptionPriority.Default, null, null, 0f, null));
                            }
                        }
                    }
                }
            }
        }
Example #4
0
        public override bool HasJobOnThing(Pawn pawn, Thing t, bool forced = false)
        {
            if (t == null)
            {
                return(false);
            }

            if (t.def != CultsDefOf.Cults_PlantTreeNightmare &&
                t.def != CultsDefOf.Cults_MonolithNightmare)
            {
                return(false);
            }

            //Log.Message("1");

            //Log.Message("2");

            MapComponent_LocalCultTracker cultTracker = pawn.MapHeld.GetComponent <MapComponent_LocalCultTracker>();

            if (cultTracker != null && cultTracker.CurrentSeedState > CultSeedState.NeedSeeing)
            {
                return(false);
            }
            //Log.Message("3");

            if (CultUtility.AreCultObjectsAvailable(pawn.MapHeld) == false)
            {
                if (CultUtility.IsSomeoneInvestigating(pawn.MapHeld))
                {
                    return(false);
                }
            }
            //Log.Message("4");

            if (pawn.Faction != Faction.OfPlayerSilentFail)
            {
                return(false);
            }
            //if (pawn.Faction == Faction.OfPlayer && !pawn.Map.areaManager.Home[t.Position])
            //{
            //    JobFailReason.Is(WorkGiver_FixBrokenDownBuilding.NotInHomeAreaTrans);
            //    return false;
            //}
            //Log.Message("5");

            if (!pawn.CanReserveAndReach(t, PathEndMode.ClosestTouch, Danger.None))
            {
                return(false);                                                                   // pawn.Map.reservationManager.IsReserved(t, pawn.Faction)) return false;
            }
            //Log.Message("6");

            return(true);
        }
        public override IEnumerable <FloatMenuOption> GetFloatMenuOptions(Pawn myPawn)
        {
            using var enumerator = base.GetFloatMenuOptions(myPawn).GetEnumerator();
            while (enumerator.MoveNext())
            {
                var current = enumerator.Current;
                yield return(current);
            }

            if (def == null || this is not Building_Monolith)
            {
                yield break;
            }

            if (!def.hasInteractionCell)
            {
                yield break;
            }

            if (CultUtility.AreCultObjectsAvailable(Map))
            {
                yield break;
            }

            if (CultUtility.IsSomeoneInvestigating(Map))
            {
                yield break;
            }

            if (!Map.reservationManager.CanReserve(myPawn, this))
            {
                yield break;
            }

            void action0()
            {
                var job = new Job(CultsDefOf.Cults_Investigate, myPawn, this)
                {
                    playerForced = true
                };

                myPawn.jobs.TryTakeOrderedJob(job);
                //mypawn.CurJob.EndCurrentJob(JobCondition.InterruptForced);
            }

            yield return(new FloatMenuOption("Investigate", action0));
        }