Exemple #1
0
        public override void VerbTickCE()
        {
            //if (CasterPawn != null)
            //{
            //List<IntVec3> cheese = CasterPawn.CellsAdjacent8WayAndInside().ToList();
            //if (cheese != null)
            //{
            //if (this.CasterPawn.jobs.posture != PawnPosture.Standing)
            //{
            //this.CasterPawn.jobs.posture = PawnPosture.Standing;
            //}
            //foreach (IntVec3 element in cheese)
            //{
            //if (element != null)
            //{

            //if (Verse.GridsUtility.GetCover(element, CasterPawn.Map) != null)
            //{
            //Building ting = Verse.GridsUtility.GetCover(element, CasterPawn.Map) as Building;
            //float flat = ting.def.fillPercent;
            //if (this.CasterPawn.jobs.posture != PawnPosture.Standing)
            //{
            //this.CasterPawn.jobs.posture = PawnPosture.Standing;
            //}

            //Log.Error(Verse.GridsUtility.GetCover(element, CasterPawn.Map).ToString());

            //}
            //else
            //{
            //if (!CasterPawn.pather.MovingNow)
            //{
            //if (BipodComp.BipodSetUp)
            //{

            //this.CasterPawn.jobs.posture = PawnPosture.LayingOnGroundNormal;



            //}


            //}

            //}

            //}

            //}
            //}
            //else
            //{
            //Log.Error("cheesent");
            //}

            //}


            //CasterPawn.cell
            if (BipodComp.Props.Recoilchange == this.VerbPropsCE.recoilAmount)
            {
                Log.Error(this.VerbPropsCE.recoilAmount.ToString());
            }
            if (CasterPawn != null)
            {
                if (BipodComp.BipodSetUp)
                {
                    this.VerbPropsCE.recoilAmount = BipodComp.Props.Recoilchange;
                }
                else
                {
                    this.VerbPropsCE.recoilAmount = BipodComp.InitRecoil;
                }
            }
            if (!Myself.TryGetComp <Biped2>().shoe)
            {
                if (Myself.ParentHolder != Myself.Map)
                {
                    if (CasterPawn != null)
                    {
                        if (daPawn != null)
                        {
                            if (daPawn.pather.Moving)
                            {
                                Myself.TryGetComp <Biped2>().BipodSetUp = false;
                            }

                            if (daPawn.Drafted)
                            {
                                if (Myself.TryGetComp <Biped2>().ShouldSetUpBipodGizmoBool)
                                {
                                    if (!daPawn.pather.Moving)
                                    {
                                        if (!daPawn.pather.MovingNow)
                                        {
                                            ThinkNode       jobGiver            = null;
                                            Pawn_JobTracker jobs                = this.CasterPawn.jobs;
                                            Job             job                 = this.TryMakeBipodJob();
                                            Job             newJob              = job;
                                            JobCondition    lastJobEndCondition = JobCondition.InterruptForced;
                                            Job             curJob              = this.CasterPawn.CurJob;
                                            if (jobs.curJob != job)
                                            {
                                                if (Myself.TryGetComp <Biped2>().BipodSetUp != true)
                                                {
                                                    jobs.StartJob(newJob, lastJobEndCondition, jobGiver, ((curJob != null) ? curJob.def : null) != job.def, true, null, null, false, false);
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }



            bool isAiming = this._isAiming;

            if (isAiming)
            {
                bool flag = !this.ShouldAim;
                if (flag)
                {
                    this.WarmupComplete();
                }
                bool flag2;
                if (!(this.caster is Building_TurretGunCE))
                {
                    Pawn shooterPawn = base.ShooterPawn;
                    Type left;
                    if (shooterPawn == null)
                    {
                        left = null;
                    }
                    else
                    {
                        Pawn_StanceTracker stances = shooterPawn.stances;
                        if (stances == null)
                        {
                            left = null;
                        }
                        else
                        {
                            Stance curStance = stances.curStance;
                            left = ((curStance != null) ? curStance.GetType() : null);
                        }
                    }
                    flag2 = (left != typeof(Stance_Warmup));
                }
                else
                {
                    flag2 = false;
                }
                bool flag3 = flag2;
                if (flag3)
                {
                    this._isAiming = false;
                }
            }
        }
        // Token: 0x0600295E RID: 10590 RVA: 0x00139BAC File Offset: 0x00137FAC
        public override void CompTickRare()
        {
            bool  selected = Find.Selector.SingleSelectedThing == this.parent;
            Thing thing    = GenClosest.ClosestThingReachable(this.parent.Position, this.parent.Map, ThingRequest.ForGroup(ThingRequestGroup.Pawn), PathEndMode.OnCell, TraverseParms.For(TraverseMode.NoPassClosedDoors, Danger.Deadly, false), Props.triggerRadius, x => XenomorphUtil.isInfectablePawn(((Pawn)x)), null, 0, -1, false, RegionType.Set_Passable, false);

            if (thing != null)
            {
                Pawn pawn = (Pawn)thing;
                bool flag = XenomorphUtil.isInfectablePawn(pawn);
#if DEBUG
                if (selected)
                {
                    Log.Message(string.Format("{0} isInfectable?: {1}", pawn.Label, flag));
                }
#endif
                if (flag)
                {
                    this.canHatch = true;
                }
                if (canHatch)
                {
                    float  thingdist      = DistanceBetween(this.parent.Position, pawn.Position);
                    float  thingsize      = pawn.BodySize;
                    float  thingstealth   = thing.GetStatValue(StatDefOf.HuntingStealth);
                    float  thingmovespeed = thing.GetStatValue(StatDefOf.MoveSpeed);
                    Stance thingstance    = pawn.stances.curStance;
#if DEBUG
                    if (selected)
                    {
                        Log.Message(string.Format("distance between {1} @{3} and {2} @ {4}: {0}", DistanceBetween(this.parent.Position, pawn.Position), this.parent.LabelShort, pawn.Label, this.parent.Position, pawn.Position));
                        Log.Message(string.Format("{0} thingsize: {1}, thingstealth: {2}, thingmovespeed: {3}, thingstance: {4}", pawn.Label, thingsize, thingstealth, thingmovespeed, thingstance));
                    }
#endif
                    float hatchon = ((100 / thingdist) * thingsize);
                    if (thingstance.GetType() == typeof(Stance_Mobile))
                    {
                        hatchon = (((100 / thingdist) * thingmovespeed) * thingsize);
                    }
                    float roll = (Rand.RangeInclusive(0, 100) / thingstealth);
#if DEBUG
                    if (selected)
                    {
                        Log.Message(string.Format("{0} hatchon: {1}, roll: {2}, moving?: {3}", pawn.Label, hatchon, roll, thingstance.GetType() == typeof(Stance_Mobile)));
                    }
#endif
                    if (roll < hatchon)
                    {
                        this.willHatch = true;
                    }
                }
            }
#if DEBUG
            if (thing == null)
            {
                if (selected)
                {
                    Log.Message(string.Format("{0} @ {1}, Cant hatch No suitable Host Found", this.parent.Label, this.parent.Position, canHatch));
                }
            }
#endif
        }