Exemple #1
0
        // Token: 0x06000420 RID: 1056 RVA: 0x0002CD30 File Offset: 0x0002B130
        protected override IntVec3 GetWanderRoot(Pawn pawn)
        {
            if (pawn.isXenomorph())
            {
                HiveLike hivelike = pawn.mindState.duty != null && pawn.mindState.duty.focus != null ? pawn.mindState.duty.focus.Thing as HiveLike : null;
                if (hivelike != null)
                {
                    return(hivelike.Position);
                }

                /*
                 * if (hivelike==null)
                 * {
                 *  hivelike = FindClosestHiveLike(pawn);
                 * }
                 */
                if (hivelike == null || !hivelike.Spawned)
                {
                    if (XenomorphUtil.HivelikesPresent(pawn.Map))
                    {
                        return(XenomorphUtil.ClosestReachableHivelike(pawn).Position);
                    }
                    if (!XenomorphKidnapUtility.hiveslimepresent)
                    {
                        if (XenomorphKidnapUtility.TryFindGoodHiveLoc(pawn, out IntVec3 c))
                        {
                            return(c);
                        }
                    }
                    else if (!XenomorphUtil.ClosestReachableHiveSlime(pawn).DestroyedOrNull())
                    {
                        return(XenomorphUtil.ClosestReachableHiveSlime(pawn).Position);
                    }
                    return(pawn.Position);
                }
                //    Log.Message(string.Format("JobGiver_WanderHiveLike hivelike.Position: {0}", hivelike.Position));
                return(hivelike.Position);
            }
            else if (pawn.isNeomorph())
            {
                Corpse corpse = (Corpse)GenClosest.ClosestThingReachable(pawn.Position, pawn.Map, ThingRequest.ForGroup(ThingRequestGroup.Corpse), PathEndMode.Touch, TraverseParms.For(pawn, Danger.Deadly), 20f);
                if (corpse != null)
                {
                    return(corpse.Position);
                }
                return(pawn.Position);
            }
            else
            {
                return(pawn.Position);
            }
        }
Exemple #2
0
        // Token: 0x06000860 RID: 2144 RVA: 0x00047694 File Offset: 0x00045A94
        public override void UpdateAllDuties()
        {
            QueenPresent = XenomorphUtil.QueenPresent(Map, out Pawn Queen);
            if (QueenPresent)
            {
                if (this.Data.HiveQueen.DestroyedOrNull())
                {
                    this.Data.HiveQueen = Queen;
                }
            }
            eggsPresent = XenomorphUtil.EggsPresent(Map);
            base.FilterOutUnspawnedHiveLikes();
            for (int i = 0; i < this.lord.ownedPawns.Count; i++)
            {
                Pawn     pawn = this.lord.ownedPawns[i];
                PawnDuty duty;
                if (XenomorphUtil.HivelikesPresent(Map))
                {
                    HiveLike hiveFor = base.GetHiveLikeFor(this.lord.ownedPawns[i]);
                    if (hiveFor.parentHiveLike != null)
                    {
                        duty = new PawnDuty(OGHiveLikeDefOf.RRY_DefendAndExpandHiveLike, hiveFor.parentHiveLike, this.distToHiveToAttack);
                        this.Data.HiveLoc = hiveFor.parentHiveLike.Position;
                    }
                    else if (hiveFor != null)
                    {
                        duty = new PawnDuty(OGHiveLikeDefOf.RRY_DefendAndExpandHiveLike, hiveFor, this.distToHiveToAttack);
                        this.Data.HiveLoc = hiveFor.Position;
                    }
                    else
                    {
                        //     Log.Message(string.Format("hives present but not found, we dun f****d up boss"));
                        duty = null;
                    }
                }
                else
                {
                    if (XenomorphUtil.HiveSlimePresent(Map))
                    {
                        duty = new PawnDuty(OGHiveLikeDefOf.RRY_DefendAndExpandHiveLike, XenomorphUtil.ClosestReachableHiveSlime(pawn), this.distToHiveToAttack);
                        this.Data.HiveLoc = XenomorphUtil.ClosestReachableHiveSlime(pawn).Position;
                    }
                    else if (XenomorphKidnapUtility.TryFindGoodHiveLoc(pawn, out IntVec3 c))
                    {
                        duty = new PawnDuty(OGHiveLikeDefOf.RRY_DefendAndExpandHiveLike, c, this.distToHiveToAttack);
                        this.Data.HiveLoc = c;
                    }
                    else
                    {
                        duty = null;
                    }

                    /*
                     * ThingDef named = pawn.RaceProps.Humanlike ? XenomorphDefOf.RRY_Xenomorph_Humanoid_Cocoon : XenomorphDefOf.RRY_Xenomorph_Animal_Cocoon;
                     * cocoonsPresent = XenomorphUtil.CocoonsPresent(pawn.Map, named);
                     * eggsReachable = !XenomorphUtil.ClosestReachableEgg(pawn).DestroyedOrNull();
                     * closestReachableEgg = XenomorphUtil.ClosestReachableEgg(pawn);
                     *
                     * hivelikesReachable = !XenomorphUtil.ClosestReachableHivelike(pawn).DestroyedOrNull();
                     * closestReachableHivelike = XenomorphUtil.ClosestReachableHivelike(pawn);
                     *
                     * cocoonsReachable = !XenomorphUtil.ClosestReachableCocoon(pawn, named).DestroyedOrNull();
                     * closestReachableCocoon = XenomorphUtil.ClosestReachableCocoon(pawn, named);
                     *
                     * if (XenomorphUtil.EggsPresent(Map))
                     * {
                     * //     Log.Message(string.Format("eggsPresent: {0}", closestReachableEgg.Position));
                     *  duty = new PawnDuty(OGHiveLikeDefOf.RRY_DefendAndExpandHiveLike, closestReachableEgg, this.distToHiveToAttack);
                     * }
                     * else if (cocoonsPresent)
                     * {
                     * //     Log.Message(string.Format("cocoonsPresent: {0}", closestReachableCocoon.Position));
                     *  duty = new PawnDuty(OGHiveLikeDefOf.RRY_DefendAndExpandHiveLike, closestReachableCocoon, this.distToHiveToAttack);
                     * }
                     * else if (myFocus.Cell != IntVec3.Zero)
                     * {
                     * //     Log.Message(string.Format("myFocus {0}", myFocus.Cell));
                     *  duty = new PawnDuty(OGHiveLikeDefOf.RRY_DefendAndExpandHiveLike, myFocus, this.distToHiveToAttack);
                     * }
                     * else if (InfestationLikeCellFinder.TryFindCell(out IntVec3 c, Map, false))
                     * {
                     * //     Log.Message(string.Format("InfestationLikeCellFinder: {0}", c));
                     *  duty = new PawnDuty(OGHiveLikeDefOf.RRY_DefendAndExpandHiveLike, c, this.distToHiveToAttack);
                     * }
                     * else
                     * {
                     * //     Log.Message(string.Format("pawn: {0}", pawn.Position));
                     *  duty = new PawnDuty(OGHiveLikeDefOf.RRY_DefendAndExpandHiveLike, pawn, this.distToHiveToAttack);
                     * }
                     */
                }
                this.lord.ownedPawns[i].mindState.duty = duty;
                if (duty != null)
                {
                    if (duty.focus != null && duty.focus != IntVec3.Invalid && duty.focus != IntVec3.Zero)
                    {
                        myFocus = duty.focus;
                    }
                }
            }
        }