当前位置: 首页>>代码示例>>C#>>正文


C# Pawn.InBed方法代码示例

本文整理汇总了C#中Pawn.InBed方法的典型用法代码示例。如果您正苦于以下问题:C# Pawn.InBed方法的具体用法?C# Pawn.InBed怎么用?C# Pawn.InBed使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Pawn的用法示例。


在下文中一共展示了Pawn.InBed方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: _ShouldBeFed

 internal static bool _ShouldBeFed( Pawn p )
 {
     if(
         ( !p.InBed() )||
         ( !p.health.PrefersMedicalRest )
     )
     {
         return false;
     }
     if( p.IsPrisonerOfColony )
     {
         return p.guest.ShouldBeBroughtFood;
     }
     var compPrisoner = p.TryGetComp<CompPrisoner>();
     if( compPrisoner != null )
     {
         return compPrisoner.wasArrested;
     }
     return false;
 }
开发者ID:ForsakenShell,项目名称:Es-Small-Mods,代码行数:20,代码来源:Detours_WardenFeedUtility.cs

示例2: updateColonistStats

        // stats recalculation routine
        public void updateColonistStats(Pawn colonist)
        {
            if (!stats_dict.ContainsKey(colonist)) stats_dict.Add(colonist, new PawnStats());
            PawnStats pawnStats = stats_dict[colonist];
            ///////////////////////////////////////////////////////////////

            pawnStats.isNudist = false;

            foreach (Trait trait in colonist.story.traits.allTraits)
            {
                switch (trait.def.defName)
                {
                    case "Nudist":
                        pawnStats.isNudist = true;
                        break;
                }
            }

            // efficiency
            float efficiency = 10;            

            foreach (PawnCapacityDef act in pawnCapacities)
            {
                
                if (act != PawnCapacityDefOf.Consciousness) efficiency = Math.Min(efficiency, colonist.health.capacities.GetEfficiency(act));
            }

            if (efficiency < 0) efficiency = 0;
            pawnStats.total_efficiency = efficiency;

            // target
            pawnStats.targetPos = Vector3.zero;

            if (colonist.jobs.curJob != null)
            {
                JobDriver curDriver = colonist.jobs.curDriver;
                Job curJob = colonist.jobs.curJob;
                TargetInfo tp = curJob.targetA;

                if (curDriver is JobDriver_HaulToContainer || curDriver is JobDriver_HaulToCell ||
                    curDriver is JobDriver_FoodDeliver || curDriver is JobDriver_FoodFeedPatient ||
                    curDriver is JobDriver_TakeToBed) tp = curJob.targetB;

                if (curDriver is JobDriver_DoBill)
                {
                    JobDriver_DoBill bill = (JobDriver_DoBill)curDriver;
                    if (bill.workLeft == 0.0f) tp = curJob.targetA;
                    else if (bill.workLeft <= 0.01f) tp = curJob.targetB;

                    //Log.Message("" + ((JobDriver_DoBill)colonist.jobs.curDriver).workLeft);
                }

                if (curDriver is JobDriver_Hunt)
                {
                    if (colonist.carryHands != null && colonist.carryHands.CarriedThing != null)
                        tp = curJob.targetB;
                }
                
                if (curJob.def == JobDefOf.Wait) tp = null;
                if (curDriver is JobDriver_Ingest) tp = null;
                if (curJob.def == JobDefOf.LayDown && colonist.InBed()) tp = null;
                if (!curJob.playerForced && curJob.def == JobDefOf.Goto) tp = null;                

                //Log.Message(colonist.jobs.curJob.def.ToString()+" "+colonist.jobs.curDriver.GetType().ToString());

                if (tp != null && tp.Cell != null)
                {
                    Vector3 pos = tp.Cell.ToVector3Shifted();
                    pawnStats.targetPos = pos + new Vector3(0.0f, 3.0f, 0.0f);
                }
            }

            // temperature

            float temper = GenTemperature.GetTemperatureForCell(colonist.Position);
            pawnStats.tooCold = (colonist.ComfortableTemperatureRange().min - settings.limit_tempComfortOffset - temper) / 10.0f;
            pawnStats.tooHot = (temper - colonist.ComfortableTemperatureRange().max - settings.limit_tempComfortOffset) / 10.0f;

            pawnStats.tooCold = Mathf.Clamp(pawnStats.tooCold, 0, 2);
            pawnStats.tooHot = Mathf.Clamp(pawnStats.tooHot, 0, 2);

            // diseases

            pawnStats.diseaseDisappearance = 1;
            pawnStats.drunkness = DrugUtility.DrunknessPercent(colonist);

            using (IEnumerator<Hediff_Staged> enumerator = colonist.health.hediffSet.GetDiseases().GetEnumerator())
            {
                while (enumerator.MoveNext())
                {
                    Hediff_Staged disease = enumerator.Current;
                    if (disease == null || disease.FullyImmune || !disease.Visible) continue;
                    if (disease.CurStage != null && !disease.CurStage.everVisible) continue;                    
                    if (!disease.def.Treatable && !disease.def.naturallyHealed) continue;

                    pawnStats.diseaseDisappearance = Math.Min(pawnStats.diseaseDisappearance, disease.Immunity);
                }

            }
//.........这里部分代码省略.........
开发者ID:scyde,项目名称:Hardcore-SK,代码行数:101,代码来源:PSI.cs

示例3: RecipeOptionsMaker

 public static void RecipeOptionsMaker( Pawn pawn )
 {
     Thing thingForMedBills = pawn;
     List<FloatMenuOption> list = new List<FloatMenuOption>( );
     foreach ( RecipeDef current in thingForMedBills.def.AllRecipes )
     {
         if ( current.AvailableNow )
         {
             IEnumerable<ThingDef> enumerable = current.PotentiallyMissingIngredients( null );
             IEnumerable<ThingDef> thingDefs = enumerable as ThingDef[] ?? enumerable.ToArray( );
             if ( !thingDefs.Any( x => x.isBodyPartOrImplant ) )
             {
                 IEnumerable<BodyPartRecord> partsToApplyOn = current.Worker.GetPartsToApplyOn( pawn, current );
                 IEnumerable<BodyPartRecord> bodyPartRecords = partsToApplyOn as BodyPartRecord[] ?? partsToApplyOn.ToArray( );
                 if ( bodyPartRecords.Any( ) )
                 {
                     foreach ( BodyPartRecord current2 in bodyPartRecords )
                     {
                         RecipeDef localRecipe = current;
                         BodyPartRecord localPart = current2;
                         string text = localRecipe == RecipeDefOf.RemoveBodyPart ? HealthCardUtility.RemoveBodyPartSpecialLabel( pawn, current2 ) : localRecipe.LabelCap;
                         if ( !current.hideBodyPartNames )
                         {
                             text = text + " (" + current2.def.label + ")";
                         }
                         Action action = null;
                         if ( thingDefs.Any( ) )
                         {
                             text += " (";
                             bool flag = true;
                             foreach ( ThingDef current3 in thingDefs )
                             {
                                 if ( !flag )
                                 {
                                     text += ", ";
                                 }
                                 flag = false;
                                 text += "MissingMedicalBillIngredient".Translate( current3.label );
                             }
                             text += ")";
                         }
                         else
                         {
                             action = delegate
                             {
                                 if (
                                     !Find.ListerPawns.FreeColonists.Any( col => localRecipe.PawnSatisfiesSkillRequirements( col ) ) )
                                 {
                                     Bill.CreateNoPawnsWithSkillDialog( localRecipe );
                                 }
                                 Pawn pawn2 = thingForMedBills as Pawn;
                                 if ( pawn2 != null && !pawn.InBed( ) && pawn.RaceProps.Humanlike )
                                 {
                                     if (
                                         !Find.ListerBuildings.allBuildingsColonist.Any( x => x is Building_Bed && ( (Building_Bed) x ).Medical ) )
                                     {
                                         Messages.Message( "MessageNoMedicalBeds".Translate( ),
                                                           MessageSound.Negative );
                                     }
                                 }
                                 Bill_Medical billMedical = new Bill_Medical( localRecipe );
                                 if ( pawn2 != null ) {
                                     pawn2.BillStack.AddBill( billMedical );
                                     billMedical.Part = localPart;
                                     if ( pawn2.Faction != null && !pawn2.Faction.def.hidden &&
                                          !pawn2.Faction.HostileTo( Faction.OfColony ) &&
                                          localRecipe.Worker.IsViolationOnPawn( pawn2, localPart, Faction.OfColony ) )
                                     {
                                         Messages.Message(
                                             "MessageMedicalOperationWillAngerFaction".Translate( pawn2.Faction ),
                                             MessageSound.Negative );
                                     }
                                 }
                             };
                         }
                         list.Add( new FloatMenuOption( text, action ) );
                     }
                 }
             }
         }
     }
     Find.WindowStack.Add( new FloatMenu( list ) );
 }
开发者ID:Kiggerbare,项目名称:RW_MedicalInfo,代码行数:83,代码来源:Utility_Medical.cs

示例4: RecipeOptionsMaker

        public static void RecipeOptionsMaker( Pawn pawn )
        {
            if (pawn.RaceProps.Animal)
            {
                // TODO: See if we can auto-detect ADS, and/or auto-detect available bills on animals.
                Log.Warning( "Medical bills are currently not supported on animals. Stay tuned!");
                return;
            }

            Thing thingForMedBills = pawn;
            var list = new List<FloatMenuOption>( );
            foreach ( var current in thingForMedBills.def.AllRecipes )
            {
                if (!current.AvailableNow) continue;
                IEnumerable<ThingDef> enumerable = current.PotentiallyMissingIngredients( null );
                IEnumerable<ThingDef> thingDefs = enumerable as ThingDef[] ?? enumerable.ToArray( );
                if (thingDefs.Any(x => x.isBodyPartOrImplant)) continue;
                {
                    IEnumerable<BodyPartRecord> partsToApplyOn = current.Worker.GetPartsToApplyOn( pawn, current );
                    IEnumerable<BodyPartRecord> bodyPartRecords = partsToApplyOn as BodyPartRecord[] ?? partsToApplyOn.ToArray( );
                    if (!bodyPartRecords.Any()) continue;
                    foreach ( var current2 in bodyPartRecords )
                    {
                        var localRecipe = current;
                        var localPart = current2;
                        var text = localRecipe == RecipeDefOf.RemoveBodyPart ? HealthCardUtility.RemoveBodyPartSpecialLabel( pawn, current2 ) : localRecipe.LabelCap;
                        if ( !current.hideBodyPartNames )
                        {
                            text = text + " (" + current2.def.label + ")";
                        }
                        Action action = null;
                        if ( thingDefs.Any( ) )
                        {
                            text += " (";
                            var flag = true;
                            foreach ( var current3 in thingDefs )
                            {
                                if ( !flag )
                                {
                                    text += ", ";
                                }
                                flag = false;
                                text += "MissingMedicalBillIngredient".Translate( current3.label );
                            }
                            text += ")";
                        }
                        else
                        {
                            action = delegate
                            {
                                if (
                                    !Find.MapPawns.FreeColonists.Any( col => localRecipe.PawnSatisfiesSkillRequirements( col ) ) )
                                {
                                    Bill.CreateNoPawnsWithSkillDialog( localRecipe );
                                }
                                var pawn2 = thingForMedBills as Pawn;
                                if ( pawn2 != null && !pawn.InBed( ) && pawn.RaceProps.Humanlike )
                                {
                                    if (
                                        !Find.ListerBuildings.allBuildingsColonist.Any( x => x is Building_Bed && ( (Building_Bed) x ).Medical ) )
                                    {
                                        Messages.Message( "MessageNoMedicalBeds".Translate( ),
                                            MessageSound.Negative );
                                    }
                                }
                                var billMedical = new Bill_Medical( localRecipe );
                                if (pawn2 == null) return;
                                pawn2.BillStack.AddBill( billMedical );
                                billMedical.Part = localPart;
                                if ( pawn2.Faction != null && !pawn2.Faction.def.hidden &&
                                     !pawn2.Faction.HostileTo( Faction.OfPlayer ) &&
                                     localRecipe.Worker.IsViolationOnPawn( pawn2, localPart, Faction.OfPlayer ) )
                                {
                                    Messages.Message(
                                        "MessageMedicalOperationWillAngerFaction".Translate( pawn2.Faction ),
                                        MessageSound.Negative );
                                }
                            };
                        }
                        list.Add( new FloatMenuOption( text, action ) );
                    }
                }
            }
            Find.WindowStack.Add( new FloatMenu( list ) );
        }
开发者ID:FluffierThanThou,项目名称:RW_MedicalInfo,代码行数:85,代码来源:Utility_Medical.cs


注:本文中的Pawn.InBed方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。