Ejemplo n.º 1
0
 public override void Tick()
 {
     for (int i = 0; i < base.SleepingSlotsCount; i++)
     {
         bool flag = base.GetCurOccupant(i) != null;
         if (flag)
         {
             Pawn curOccupant = base.GetCurOccupant(i);
             this.TicksCounted[i]++;
             bool flag2 = this.TicksCounted[i] == 1250 && PawnUtility.GetPosture(curOccupant) == PawnPosture.LayingInBed;
             if (flag2)
             {
                 Hediff firstHediffOfDef = curOccupant.health.hediffSet.GetFirstHediffOfDef(MFSpacer.HediffDefOf.Bed_RefreshingSleep, false);
                 bool   flag3            = firstHediffOfDef == null;
                 if (flag3)
                 {
                     curOccupant.health.AddHediff(MFSpacer.HediffDefOf.Bed_RefreshingSleep, null, null, null);
                 }
                 else
                 {
                     firstHediffOfDef.Severity += 0.05f;
                 }
                 this.TicksCounted[i] = 0;
             }
         }
     }
     base.Tick();
 }
Ejemplo n.º 2
0
        public override void Tick()
        {
            for (int i = 0; i < SleepingSlotsCount; i++)
            {
                if (base.GetCurOccupant(i) != null)
                {
                    Pawn curOccupant = base.GetCurOccupant(i);
                    TicksCounted[i]++;
                    if (TicksCounted[i] == 1250 && PawnUtility.GetPosture(curOccupant) == PawnPosture.LayingInBed)
                    {
                        Hediff firstHediffOfDef = curOccupant.health.hediffSet.GetFirstHediffOfDef(HediffDefOf.Bed_RefreshingSleep, false);
                        if (firstHediffOfDef == null)
                        {
                            curOccupant.health.AddHediff(HediffDefOf.Bed_RefreshingSleep, null, null, null);
                        }
                        else
                        {
                            firstHediffOfDef.Severity += 0.05f;
                        }
                        TicksCounted[i] = 0;
                    }
                }
            }

            base.Tick();
        }
Ejemplo n.º 3
0
 // Token: 0x0600000A RID: 10 RVA: 0x000022B0 File Offset: 0x000004B0
 public bool JobIsLyingDown(Pawn pawn)
 {
     if (pawn != null && pawn.CurJob != null)
     {
         PawnPosture posture = PawnUtility.GetPosture(pawn);
         if (posture == PawnPosture.LayingOnGroundNormal || posture == PawnPosture.LayingOnGroundFaceUp || posture == PawnPosture.LayingInBed)
         {
             return(true);
         }
     }
     return(false);
 }
Ejemplo n.º 4
0
        // Token: 0x06000066 RID: 102 RVA: 0x00004308 File Offset: 0x00002508
        private void ImpactSomething()
        {
            bool flag = this.usedTarget != null;

            if (flag)
            {
                Pawn pawn  = this.usedTarget as Pawn;
                bool flag2 = pawn != null && PawnUtility.GetPosture(pawn) != null && GenGeo.MagnitudeHorizontalSquared(this.origin - this.destination) >= 20.25f && Rand.Value > 0.2f;
                if (flag2)
                {
                    this.Impact(null);
                }
                else
                {
                    this.Impact(this.usedTarget);
                }
            }
            else
            {
                this.Impact(null);
            }
        }
Ejemplo n.º 5
0
 // Token: 0x06000023 RID: 35 RVA: 0x000029F0 File Offset: 0x00000BF0
 public override void Tick()
 {
     base.Tick();
     if (this.JPCooldownTicks > 0)
     {
         this.JPCooldownTicks--;
     }
     if (Settings.AllowSlowBurn)
     {
         if (base.Wearer == null)
         {
             this.JPSlowBurn = false;
             return;
         }
         if (this.JPSlowBurn && base.Wearer.Spawned && PawnUtility.GetPosture(base.Wearer) != PawnPosture.LayingInBed && PawnUtility.GetPosture(base.Wearer) != PawnPosture.LayingOnGroundFaceUp && PawnUtility.GetPosture(base.Wearer) != PawnPosture.LayingOnGroundNormal)
         {
             if (this.JPSlowBurnTicks > 0)
             {
                 this.JPSlowBurnTicks--;
                 return;
             }
             if (this.JPFuelAmount > 0)
             {
                 this.JPFuelAmount--;
                 this.JPSlowBurnTicks = JPUtility.GetSlowBurnTicks(this.JPFuelItem);
                 return;
             }
             this.JPSlowBurn = false;
             Messages.Message(TranslatorFormattedStringExtensions.Translate("JetPack.SBOutOfFuel", GenText.CapitalizeFirst(base.Wearer.LabelShort), GenText.CapitalizeFirst(this.Label)), base.Wearer, MessageTypeDefOf.NeutralEvent, false);
             return;
         }
     }
     else
     {
         this.JPSlowBurn = false;
     }
 }
Ejemplo n.º 6
0
        private void ImpactSomething()
        {
            if (this.def.projectile.flyOverhead)
            {
                RoofDef roofDef = base.Map.roofGrid.RoofAt(base.Position);
                if (roofDef != null)
                {
                    if (roofDef.isThickRoof)
                    {
                        SoundStarter.PlayOneShot(this.def.projectile.soundHitThickRoof, new TargetInfo(base.Position, base.Map, false));
                        this.Destroy(0);
                        return;
                    }
                    if (GridsUtility.GetEdifice(base.Position, base.Map) == null || GridsUtility.GetEdifice(base.Position, base.Map).def.Fillage != FillCategory.Full)
                    {
                        RoofCollapserImmediate.DropRoofInCells(base.Position, base.Map, null);
                    }
                }
            }
            if (!this.usedTarget.HasThing || !base.CanHit(this.usedTarget.Thing))
            {
                List <Thing> list = new List <Thing>();
                list.Clear();
                List <Thing> thingList = GridsUtility.GetThingList(base.Position, base.Map);
                for (int i = 0; i < thingList.Count; i++)
                {
                    Thing thing = thingList[i];
                    if ((thing.def.category == ThingCategory.Building || thing.def.category == ThingCategory.Pawn || thing.def.category == ThingCategory.Item || thing.def.category == ThingCategory.Plant) && base.CanHit(thing))
                    {
                        list.Add(thing);
                    }
                }
                GenList.Shuffle <Thing>(list);
                for (int j = 0; j < list.Count; j++)
                {
                    Thing thing2 = list[j];
                    Pawn  pawn   = thing2 as Pawn;
                    float num;
                    if (pawn != null)
                    {
                        num = 0.5f * Mathf.Clamp(pawn.BodySize, 0.1f, 2f);
                        if (PawnUtility.GetPosture(pawn) != null && GenGeo.MagnitudeHorizontalSquared(this.origin - this.destination) >= 20.25f)
                        {
                            num *= 0.2f;
                        }
                        if (this.launcher != null && pawn.Faction != null && this.launcher.Faction != null && !FactionUtility.HostileTo(pawn.Faction, this.launcher.Faction))
                        {
                            num *= VerbUtility.InterceptChanceFactorFromDistance(this.origin, base.Position);
                        }
                    }
                    else
                    {
                        num = 1.5f * thing2.def.fillPercent;
                    }
                    if (Rand.Chance(num))
                    {
                        this.Impact(GenCollection.RandomElement <Thing>(list));
                        return;
                    }
                }
                this.Impact(null);
                return;
            }
            Pawn pawn2 = this.usedTarget.Thing as Pawn;

            if (pawn2 != null && PawnUtility.GetPosture(pawn2) != null && GenGeo.MagnitudeHorizontalSquared(this.origin - this.destination) >= 20.25f && !Rand.Chance(0.2f))
            {
                this.Impact(null);
                return;
            }
            this.Impact(this.usedTarget.Thing);
        }
Ejemplo n.º 7
0
 // Token: 0x060000B4 RID: 180 RVA: 0x00009F74 File Offset: 0x00008174
 public virtual bool CanDrawAddon(Pawn pawn)
 {
     return(((GenList.NullOrEmpty <string>(this.hiddenUnderApparelTag) && GenList.NullOrEmpty <BodyPartGroupDef>(this.hiddenUnderApparelFor)) || !GenCollection.Any <Apparel>(pawn.apparel.WornApparel, (Apparel ap) => GenCollection.Any <BodyPartGroupDef>(ap.def.apparel.bodyPartGroups, (BodyPartGroupDef bpgd) => this.hiddenUnderApparelFor.Contains(bpgd)) || GenCollection.Any <string>(ap.def.apparel.tags, (string s) => this.hiddenUnderApparelTag.Contains(s)))) && (PawnUtility.GetPosture(pawn) == null || (RestUtility.InBed(pawn) && this.drawnInBed) || this.drawnOnGround) && (GenText.NullOrEmpty(this.backstoryRequirement) || pawn.story.AllBackstories.Any((Backstory b) => b.identifier == this.backstoryRequirement)) && (GenText.NullOrEmpty(this.bodyPart) || pawn.health.hediffSet.GetNotMissingParts(0, 0, null, null).Any((BodyPartRecord bpr) => bpr.untranslatedCustomLabel == this.bodyPart || bpr.def.defName == this.bodyPart)));
 }