本文整理汇总了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;
}
示例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);
}
}
//.........这里部分代码省略.........
示例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 ) );
}
示例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 ) );
}