// Token: 0x06000018 RID: 24 RVA: 0x00003654 File Offset: 0x00001854 private static PawnKindDef FindRandomAnimalForSpawn() { GenCollection.TryRandomElement <PawnKindDef>(from td in DefDatabase <PawnKindDef> .AllDefs where td.RaceProps.Animal && td.combatPower < 200f select td, out PawnKindDef result); return(result); }
// Token: 0x06000018 RID: 24 RVA: 0x00003654 File Offset: 0x00001854 private static PawnKindDef FindRandomXenomorphForSpawn() { GenCollection.TryRandomElement <PawnKindDef>(from td in DefDatabase <PawnKindDef> .AllDefs where td.race.defName.Contains("RRY_Xenomorph") && td.combatPower < 200f select td, out PawnKindDef result); return(result); }
// Token: 0x06000018 RID: 24 RVA: 0x00003654 File Offset: 0x00001854 private static PawnKindDef FindRandomPreSpacerPawnForSpawn() { GenCollection.TryRandomElement <PawnKindDef>(from td in DefDatabase <PawnKindDef> .AllDefs where td.RaceProps.Humanlike && (td.defaultFactionType != null && td.defaultFactionType.techLevel < (TechLevel)5) && td.combatPower < 200f select td, out PawnKindDef result); return(result); }
// Token: 0x06002ADD RID: 10973 RVA: 0x00143464 File Offset: 0x00141864 public override bool CanBeUsedBy(Pawn p, out string failReason) { bool selected = Find.Selector.SelectedObjects.Contains(p); bool flag = GenCollection.Any <Apparel>(p.apparel.WornApparel, (Apparel x) => x.def.defName.Contains("RRY_Equipment_HunterGauntlet")); if (flag) { Cloakgen injector = (Cloakgen)p.apparel.WornApparel.Find((Apparel x) => x.def.defName.Contains("RRY_Equipment_HunterGauntlet")); if (injector != null) { CompMedicalInjector medicalInjector = injector.TryGetComp <CompMedicalInjector>(); if (injector.uses < medicalInjector.Props.Uses) { failReason = null; return(true); } else { failReason = "Injector full"; return(false); } } else { failReason = "Not wearing Injector"; return(false); } } else { failReason = "Not wearing Injector"; return(false); } // return base.CanBeUsedBy(p, out failReason); }
public override void Generate(Map map, GenStepParams parms) { IntVec3 intVec; if (RCellFinder.TryFindRandomCellNearTheCenterOfTheMapWith((IntVec3 x) => GenGrid.Standable(x, map) && !GridsUtility.Fogged(x, map) && GridsUtility.GetRoom(x, map, (RegionType)6).CellCount >= 4, map, out intVec)) { float num = this.pointsRange.RandomInRange; List <Pawn> list = new List <Pawn>(); for (int i = 0; i < 50; i++) { PawnKindDef pawnKindDef = GenCollection.RandomElementByWeight <PawnKindDef>(from kind in DefDatabase <PawnKindDef> .AllDefsListForReading where kind.RaceProps.IsMechanoid select kind, (PawnKindDef kind) => 1f / kind.combatPower); list.Add(PawnGenerator.GeneratePawn(pawnKindDef, Faction.OfMechanoids)); num -= pawnKindDef.combatPower; if (num <= 0f) { break; } } IntVec3 intVec2 = default(IntVec3); for (int j = 0; j < list.Count; j++) { IntVec3 intVec3 = CellFinder.RandomSpawnCellForPawnNear(intVec, map, 10); intVec2 = intVec3; GenSpawn.Spawn(list[j], intVec3, map, Rot4.Random, WipeMode.Vanish, false); } LordMaker.MakeNewLord(Faction.OfMechanoids, new LordJob_DefendPoint(intVec2), map, list); } }
protected override bool TryExecuteWorker(IncidentParms parms) { Map map = (Map)parms.target; IEnumerable <Pawn> freeColonists = map.mapPawns.FreeColonists; Func <Pawn, bool> predicate; bool flag = (predicate = MOIncidentWorker_Amnesia.amnesiac.instancePawn) == null; if (flag) { predicate = (MOIncidentWorker_Amnesia.amnesiac.instancePawn = new Func <Pawn, bool>(MOIncidentWorker_Amnesia.amnesiac.IncidentAmnesia.TryExecute)); } Pawn pawn = null; bool flag2 = GenCollection.TryRandomElement <Pawn>(freeColonists.Where(predicate), out pawn); bool flag3 = flag2; bool result; if (flag3) { pawn.jobs.EndCurrentJob(JobCondition.Succeeded, false); pawn.jobs.ClearQueuedJobs(true); pawn.needs.mood.thoughts.memories.TryGainMemory(ThoughtDef.Named("MO_Amnesia"), null); Find.LetterStack.ReceiveLetter("MO_Amnesia".Translate(), "MO_AmnesiaDesc".Translate(pawn.Label, pawn.Named("PAWN")), LetterDefOf.NegativeEvent, pawn, null); //pawn.Name + " suddenly forgot what he was doing. He can't remember what to do." //pawn.Name + " suddenly forgot what she was doing. She can't remember what to do.", LetterDefOf.NegativeEvent, pawn, null); result = true; } else { result = false; } return(result); }
public new Command_PawnAbility GetGizmo() { Command_PawnAbility command_PawnAbility = new Command_PawnAbility(abilityUser, this, CooldownTicksLeft) { verb = Verb, defaultLabel = this.magicDef.LabelCap, order = 9999 }; command_PawnAbility.curTicks = CooldownTicksLeft; StringBuilder stringBuilder = new StringBuilder(); stringBuilder.AppendLine(magicDef.GetDescription()); stringBuilder.AppendLine(PostAbilityVerbCompDesc(Verb.UseAbilityProps)); command_PawnAbility.defaultDesc = stringBuilder.ToString(); stringBuilder = null; command_PawnAbility.targetingParams = magicDef.MainVerb.targetParams; command_PawnAbility.icon = magicDef.uiIcon; command_PawnAbility.action = delegate(Thing target) { LocalTargetInfo target2 = GenCollection.FirstOrFallback <LocalTargetInfo>(GenUI.TargetsAt_NewTemp(UI.MouseMapPosition(), Verb.verbProps.targetParams, false, null), target); TryCastAbility(AbilityContext.Player, target2); }; string reason = ""; if (!CanCastPowerCheck(AbilityContext.Player, out reason)) { command_PawnAbility.Disable(reason); } return(command_PawnAbility); }
// Token: 0x06000144 RID: 324 RVA: 0x0000CE2C File Offset: 0x0000B22C private Pawn MakeGeniusPawn() { PawnGenerationRequest pawnGenerationRequest = new PawnGenerationRequest(PawnKindDefOf.SpaceRefugee, Faction.OfPlayer, (PawnGenerationContext)1, -1, true, false, false, false, false, false, 0f, true, true, true, false, false, false, false, null, null, null, null); Pawn pawn = PawnGenerator.GeneratePawn(pawnGenerationRequest); List <Trait> list = new List <Trait>(); foreach (Trait trait in pawn.story.traits.allTraits) { if (trait.def == TraitDefOf.Psychopath || trait.def == TraitDefOf.Cannibal || trait.def == TraitDefOf.Pyromaniac || trait.def == TraitDefOf.BodyPurist) { list.Add(trait); } } foreach (Trait item in list) { pawn.story.traits.allTraits.Remove(item); } List <SkillRecord> list2 = (from s in pawn.skills.skills where !s.TotallyDisabled select s).ToList <SkillRecord>(); SkillRecord skillRecord = GenCollection.RandomElement <SkillRecord>(list2); skillRecord.Level = 20; skillRecord.passion = (RimWorld.Passion) 2; list2.Remove(skillRecord); skillRecord = GenCollection.RandomElement <SkillRecord>(list2); skillRecord.Level = 20; skillRecord.passion = (RimWorld.Passion) 2; return(pawn); }
public override void Tick() { int ticksGame = Find.TickManager.TicksGame; int num = this.cellsToAffect.Count - 1; while (num >= 0 && ticksGame >= this.GetCellAffectTick(this.cellsToAffect[num])) { try { this.AffectCell(this.cellsToAffect[num]); } catch (Exception ex) { Log.Error(string.Concat(new object[] { "Explosion could not affect cell ", this.cellsToAffect[num], ": ", ex }), false); } this.cellsToAffect.RemoveAt(num); num--; } bool flag = !GenCollection.Any <IntVec3>(this.cellsToAffect); if (flag) { this.Destroy(0); } }
public bool Equals(CellRequest other) { if (cell.Equals(other.cell) && radius.Equals(other.radius) && GenCollection.ListsEqual(defs, other.defs)) { return(forThing == other.forThing); } return(false); }
// Token: 0x06000052 RID: 82 RVA: 0x0000553E File Offset: 0x0000373E public static List <string> MaladyMods() { List <string> list = new List <string>(); GenCollection.AddDistinct <string>(list, "VN;Vanilla"); GenCollection.AddDistinct <string>(list, "CA;Common Ailments"); GenCollection.AddDistinct <string>(list, "DO;Diseases Overhauled"); return(list); }
// Token: 0x0600002D RID: 45 RVA: 0x00002758 File Offset: 0x00000958 public override ThinkResult TryIssueJobPackage(Pawn pawn, JobIssueParams jobParm) { bool flag = !HealthAIUtility.ShouldSeekMedicalRest(pawn); ThinkResult result; if (flag) { result = ThinkResult.NoJob; } else { bool flag2 = !HealthAIUtility.ShouldBeTendedNowByPlayer(pawn); if (flag2) { result = ThinkResult.NoJob; } else { bool flag3 = !GenCollection.Any <Apparel>(pawn.apparel.WornApparel, (Apparel x) => x.def.defName.Contains("RRY_Equipment_HunterGauntlet")); if (flag3) { result = ThinkResult.NoJob; } else { Thing thing = RestUtility.FindPatientBedFor(pawn); bool flag4 = thing == null; if (flag4) { result = ThinkResult.NoJob; } else { Thing thing2 = null; bool flag5 = Medicine.GetMedicineCountToFullyHeal(pawn) > 0; if (flag5) { thing2 = HealthAIUtility.FindBestMedicine(pawn, pawn); } bool flag6 = thing2 != null; Job job; if (flag6) { job = new Job(YautjaDefOf.RRY_Yautja_TendSelf, thing, thing2); } else { job = new Job(YautjaDefOf.RRY_Yautja_TendSelf, thing); } result = new ThinkResult(job, this, null, false); } } } } return(result); }
public static ThingDef SelectChunkFromAvailableOptions() { return(GenCollection.RandomElement <ThingDef>(DefDatabase <ThingDef> .AllDefs.Where <ThingDef>((ThingDef defs) => { if (!defs.defName.StartsWith("ShipChunk")) { return false; } return !defs.defName.Contains("Incoming"); }))); }
// Token: 0x0600000E RID: 14 RVA: 0x00002584 File Offset: 0x00000784 public virtual void MakeProductsAndStartNewRecipe() { bool flag = GenCollection.Any <ThingDefCountClass>(this.Extension.products); if (flag) { this.MakeProducts(); } this.InitializeNewRecipe(); }
// Token: 0x06000003 RID: 3 RVA: 0x0000211C File Offset: 0x0000031C public static List <string> JPNames() { List <string> list = new List <string>(); GenCollection.AddDistinct <string>(list, "SpacerJetPack"); GenCollection.AddDistinct <string>(list, "BoosterJetPack"); GenCollection.AddDistinct <string>(list, "JT-12_Jetpack"); GenCollection.AddDistinct <string>(list, "PazVizla_Jetpack"); return(list); }
public static bool TryRandomlyMissingColonist(out Pawn pawn) { bool result = false; pawn = GenCollection.RandomElement <Pawn>(Enumerable.Where <Pawn>(Find.WorldPawns.AllPawnsDead, (Pawn x) => x.Faction == Faction.OfPlayer && x.Corpse == null)); if (pawn != null) { result = true; } return(result); }
private static IntVec3 getMinNeighbor(int x, int z, IntVec3 direction, IntVec3 step1, IntVec3 step2, int[,] riverMap, int width, int height, ModuleBase moduleBase) { IntVec3 intVec = new IntVec3(x, 0, z) + direction; return(GenCollection.MinBy <IntVec3, float>(new List <IntVec3> { intVec, intVec + step1, intVec + step2 }, (IntVec3 v) => MapGen.getValue(v, width, height, moduleBase, true))); }
public void SpawnIvy(IntVec3 dir) { if (GenCollection.Any <Thing>(GridsUtility.GetThingList(dir, Map), (Thing t) => (t.def.IsBuildingArtificial || t.def.IsNonResourceNaturalRock))) { return; } Plant newivy = new Plant(); newivy = (Plant)ThingMaker.MakeThing(PurpleIvyDefOf.PurpleIvy); GenSpawn.Spawn(newivy, dir, this.Map); }
public override void PostMapGenerate(Map map) { IncidentParms incidentParms = StorytellerUtility.DefaultParmsNow(Find.Storyteller.def, (IncidentCategory)3, map); incidentParms.forced = true; IntVec3 spawnCenter; if (RCellFinder.TryFindRandomPawnEntryCell(out spawnCenter, map, 0f, (IntVec3 v) => GenGrid.Standable(v, map))) { incidentParms.spawnCenter = spawnCenter; } Faction faction; if (GenCollection.TryRandomElement <Faction>(from f in Find.FactionManager.AllFactions where !f.def.hidden && FactionUtility.HostileTo(f, Faction.OfPlayer) select f, out faction)) { IntVec3 spawnCenter2; if (CellFinder.TryFindRandomEdgeCellWith((IntVec3 c) => map.reachability.CanReachColony(c), map, 0f, out spawnCenter2)) { incidentParms.faction = Faction.OfMechanoids; incidentParms.raidStrategy = RaidStrategyDefOf.ImmediateAttack; incidentParms.generateFightersOnly = true; incidentParms.raidNeverFleeIndividual = true; incidentParms.raidArrivalMode = PawnsArriveMode.CenterDrop; incidentParms.spawnCenter = spawnCenter2; incidentParms.points *= 20f; incidentParms.points = Math.Max(incidentParms.points, 250f); QueuedIncident queuedIncident = new QueuedIncident(new FiringIncident(TorannMagicDefOf.ArcaneEnemyRaid, null, incidentParms), Find.TickManager.TicksGame + Rand.RangeInclusive(500, 5000)); Find.Storyteller.incidentQueue.Add(queuedIncident); System.Random random = new System.Random(); int rnd = GenMath.RoundRandom(random.Next(0, 10)); if (rnd < 5) { incidentParms.points = Math.Max(incidentParms.points * 2, 500f); queuedIncident = new QueuedIncident(new FiringIncident(TorannMagicDefOf.ArcaneEnemyRaid, null, incidentParms), Find.TickManager.TicksGame + Rand.RangeInclusive(2000, 3000)); Find.Storyteller.incidentQueue.Add(queuedIncident); } if (rnd < 3) { if (GenCollection.TryRandomElement <Faction>(from f in Find.FactionManager.AllFactions where !f.def.hidden && FactionUtility.HostileTo(f, Faction.OfPlayer) select f, out faction)) { incidentParms.faction = faction; incidentParms.points = Math.Max(250f, 500f); queuedIncident = new QueuedIncident(new FiringIncident(TorannMagicDefOf.ArcaneEnemyRaid, null, incidentParms), Find.TickManager.TicksGame + Rand.RangeInclusive(5000, 10000)); Find.Storyteller.incidentQueue.Add(queuedIncident); } } } } }
public static void SpawnNests(Thing spawner) { int nestCount = 0; List <IntVec3> freeTiles = new List <IntVec3>(); foreach (IntVec3 dir in GenRadial.RadialCellsAround(spawner.Position, 50, true)) { if (GenGrid.InBounds(dir, spawner.Map) && spawner.Map.fertilityGrid.FertilityAt(dir) >= 0.5) { var plant = dir.GetPlant(spawner.Map); if (plant?.def == PurpleIvyDefOf.PI_Nest) { nestCount++; } if (plant?.Faction != PurpleIvyData.AlienFaction && !GenCollection.Any <Thing> (GridsUtility.GetThingList(dir, spawner.Map), (Thing t) => (t.def.IsBuildingArtificial || t.def.IsNonResourceNaturalRock))) { if (freeTiles.Count < 50) { freeTiles.Add(dir); } else { break; } } } if (nestCount == 4) { break; } } if (nestCount < 4) { var rnd = new System.Random(); foreach (IntVec3 current in freeTiles.OrderBy(x => rnd.Next()).Take(4 - nestCount)) { var plant = current.GetPlant(spawner.Map); if (plant == null) { Thing newNest = ThingMaker.MakeThing(ThingDef.Named("PI_Nest")); GenSpawn.Spawn(newNest, current, spawner.Map); } else { plant.Destroy(); Thing newNest = ThingMaker.MakeThing(ThingDef.Named("PI_Nest")); GenSpawn.Spawn(newNest, current, spawner.Map); } } } }
// Token: 0x0600000C RID: 12 RVA: 0x00002364 File Offset: 0x00000564 public override void Tick() { base.Tick(); bool ruined = this.Ruined; if (ruined) { this.InitializeNewRecipe(); bool flag = base.AmbientTemperature > base.GetComp <CompTemperatureRuinable>().Props.maxSafeTemperature || base.AmbientTemperature < base.GetComp <CompTemperatureRuinable>().Props.minSafeTemperature; if (flag) { this.ManageTemperature(); } } else { bool flag2 = this.PowerOn && Find.TickManager.TicksGame % this.Extension.tickRateDivisor == 0; if (flag2) { bool hasTemperatureManagement = this.Extension.temperatureManagement.hasTemperatureManagement; if (hasTemperatureManagement) { this.ManageTemperature(); } else { bool flag3 = base.GetComp <CompPowerTrader>() != null; if (flag3) { base.GetComp <CompPowerTrader>().powerOutputInt = -this.def.GetCompProperties <CompProperties_Power>().basePowerConsumption; } } bool flag4 = GenCollection.Any <Building_AutomatedVat._ThingCountClass>(this.localRecord, (Building_AutomatedVat._ThingCountClass x) => x.count > 0); if (flag4) { this.AcceptIngredientsForNextRecipe(); } else { bool flag5 = this.workLeft > 0; if (flag5) { this.DoWork(Mathf.RoundToInt(this.Extension.workSpeedMultiplier * (float)this.Extension.tickRateDivisor)); } else { this.MakeProductsAndStartNewRecipe(); } } } } }
// Token: 0x06000036 RID: 54 RVA: 0x00003D00 File Offset: 0x00001F00 public static List <string> CamoTypes() { List <string> list = new List <string>(); GenCollection.AddDistinct <string>(list, "Arctic"); GenCollection.AddDistinct <string>(list, "Desert"); GenCollection.AddDistinct <string>(list, "Jungle"); GenCollection.AddDistinct <string>(list, "Stone"); GenCollection.AddDistinct <string>(list, "Woodland"); GenCollection.AddDistinct <string>(list, "Urban"); GenCollection.AddDistinct <string>(list, "notDefined"); return(list); }
// Token: 0x06000011 RID: 17 RVA: 0x000024BC File Offset: 0x000006BC private static void ObserverSetup_Comp(Type compType, Func <ThingDef, bool> qualifier) { List <ThingDef> list = DefDatabase <ThingDef> .AllDefsListForReading.Where(qualifier).ToList(); GenList.RemoveDuplicates <ThingDef>(list); foreach (ThingDef item in list) { if (item.comps != null && !GenCollection.Any <CompProperties>(item.comps, (Predicate <CompProperties>)((CompProperties c) => (object)((object)c).GetType() == compType))) { item.comps.Add((CompProperties)(object)(CompProperties)Activator.CreateInstance(compType)); } } }
internal static void Postfix(int tile, ref IEnumerable <ThingDef> __result, ref World __instance) { Traverse traverse = Traverse.Create(__instance); WorldGrid value = traverse.Field("grid").GetValue <WorldGrid>(); bool flag = value[tile].biome.defName.Equals("RockMoonBiome"); if (flag) { List <ThingDef> list1 = new List <ThingDef>(); list1.Add(DefDatabase <ThingDef> .GetNamed("BiomesNEO_MariaRock")); list1.Add(DefDatabase <ThingDef> .GetNamed("BiomesNEO_HighlandRock")); __result = list1; Find.World.NaturalRockTypesIn(1); } else { bool flag2 = __result.Contains(DefDatabase <ThingDef> .GetNamed("BiomesNEO_HighlandRock")); bool flag4 = __result.Contains(DefDatabase <ThingDef> .GetNamed("BiomesNEO_MariaRock")); if (flag2 || flag4) { Rand.PushState(); Rand.Seed = tile; List <ThingDef> rocks = __result.ToList <ThingDef>(); if (flag2) { rocks.Remove(DefDatabase <ThingDef> .GetNamed("BiomesNEO_HighlandRock")); } if (flag4) { rocks.Remove(DefDatabase <ThingDef> .GetNamed("BiomesNEO_MariaRock")); } List <ThingDef> list2 = (from d in DefDatabase <ThingDef> .AllDefs where d.category.Equals(ThingCategory.Building) && d.building.isNaturalRock && !d.building.isResourceRock && !d.IsSmoothed && !rocks.Contains(d) && d.defName != "BiomesNEO_HighlandRock" && d.defName != "BiomesNEO_MariaRock" select d).ToList <ThingDef>(); bool flag3 = !GenList.NullOrEmpty <ThingDef>(list2); if (flag3) { rocks.Add(GenCollection.RandomElement <ThingDef>(list2)); } __result = rocks; Rand.PopState(); } } }
// Token: 0x0600005B RID: 91 RVA: 0x00005C64 File Offset: 0x00003E64 public static void ClearDRValues(string m, bool doAll, List <string> master, out List <string> newMaster) { newMaster = new List <string>(); if (!doAll && master != null && master.Count > 0) { foreach (string value in master) { if (MSDRUtility.HValuePart(value) != m) { GenCollection.AddDistinct <string>(newMaster, value); } } } }
// Token: 0x06000043 RID: 67 RVA: 0x00004CA0 File Offset: 0x00002EA0 private static bool GenAdminOption(Pawn patient, RecipeDef recipe, BodyPartRecord part = null) { bool result = false; if (patient != null) { Bill_Medical bill_Medical = new Bill_Medical(recipe); patient.BillStack.AddBill(bill_Medical); result = true; bill_Medical.Part = part; if (recipe.conceptLearned != null) { PlayerKnowledgeDatabase.KnowledgeDemonstrated(recipe.conceptLearned, KnowledgeAmount.Total); } Pawn patient2 = patient; Map map = patient2?.Map; if (map != null) { if (!map.mapPawns.FreeColonists.Any((Pawn col) => recipe.PawnSatisfiesSkillRequirements(col))) { Bill.CreateNoPawnsWithSkillDialog(recipe); } if (!RestUtility.InBed(patient) && patient.RaceProps.IsFlesh) { if (patient.RaceProps.Humanlike) { if (!GenCollection.Any(map.listerBuildings.allBuildingsColonist, (Building x) => x is Building_Bed bed && RestUtility.CanUseBedEver(patient, x.def) && bed.Medical)) { Messages.Message(Translator.Translate("MessageNoMedicalBeds"), patient, MessageTypeDefOf.CautionInput, false); } } else if (!GenCollection.Any <Building>(map.listerBuildings.allBuildingsColonist, (Building x) => x is Building_Bed && RestUtility.CanUseBedEver(patient, x.def))) { Messages.Message(Translator.Translate("MessageNoAnimalBeds"), patient, MessageTypeDefOf.CautionInput, false); } } if (patient.Faction != null && !patient.Faction.def.hidden && !FactionUtility.HostileTo(patient.Faction, Faction.OfPlayer) && recipe.Worker.IsViolationOnPawn(patient, part, Faction.OfPlayer)) { Messages.Message(TranslatorFormattedStringExtensions.Translate("MessageMedicalOperationWillAngerFaction", patient.Faction), patient, MessageTypeDefOf.CautionInput, false); } ThingDef minRequiredMedicine = MSAddDrugBill.GetMinRequiredMedicine(recipe); if (minRequiredMedicine != null && patient.playerSettings != null && !MedicalCareUtility.AllowsMedicine(patient.playerSettings.medCare, minRequiredMedicine)) { Messages.Message(TranslatorFormattedStringExtensions.Translate("MessageTooLowMedCare", minRequiredMedicine.label, patient.LabelShort, MedicalCareUtility.GetLabel(patient.playerSettings.medCare), NamedArgumentUtility.Named(patient, "PAWN")), patient, MessageTypeDefOf.CautionInput, false); } } } return(result); }
public void AlienAmbush(Caravan caravan, WorldObjectComp_InfectedTile site) { LongEventHandler.QueueLongEvent(delegate() { IncidentParms incidentParms = StorytellerUtility.DefaultParmsNow (IncidentCategoryDefOf.ThreatBig, caravan); List <Pawn> list = this.generateAliensFrom(site); Map map = CaravanIncidentUtility.SetupCaravanAttackMap(caravan, list, false); Find.TickManager.CurTimeSpeed = 0; GlobalTargetInfo globalTargetInfo = (!GenCollection.Any <Pawn>(list)) ? GlobalTargetInfo.Invalid : new GlobalTargetInfo(list[0].Position, map, false); Find.LetterStack.ReceiveLetter("AlienAmbush".Translate(), "AlienAmbushDesc".Translate() , LetterDefOf.ThreatBig, globalTargetInfo, null, null, null, null); }, "GeneratingMapForNewEncounter", false, null, true); }
private void doChewCorpse() { Corpse corpse = base.TargetThingA as Corpse; bool flag = corpse != null; bool flag2 = flag; if (flag2) { IntVec3 position = corpse.Position; List <Thing> list = theThing_Utility.ButcherCorpseProducts(corpse, this.pawn).ToList <Thing>(); Thing thing = null; int num; for (int i = 0; i < list.Count; i = num + 1) { bool flag3 = !GenPlace.TryPlaceThing(list[i], position, base.Map, ThingPlaceMode.Near, out thing, null); bool flag4 = flag3; if (flag4) { this.pawn.jobs.EndCurrentJob(JobCondition.Incompletable, true); } bool flag5 = thing != null; bool flag6 = flag5; if (flag6) { ForbidUtility.SetForbidden(thing, true, true); } num = i; } bool flag7 = this.pawn.needs.mood != null; bool flag8 = flag7; if (flag8) { this.pawn.needs.mood.thoughts.memories.TryGainMemory(ThoughtDef.Named("AteCorpse"), null); } corpse.Destroy(0); IEnumerable <Faction> allFactions = Find.FactionManager.AllFactions; Func <Faction, bool> predicate; bool flag9 = (predicate = JobDriver_Segmentation.segment.letSegment) == null; if (flag9) { predicate = (JobDriver_Segmentation.segment.letSegment = new Func <Faction, bool>(JobDriver_Segmentation.segment.JobSegment.doChewCorpse)); } Faction faction = GenCollection.RandomElement <Faction>(allFactions.Where(predicate)); this.abom = PawnGenerator.GeneratePawn(MODefOf.MO_AbominationPawnKind, faction); GenSpawn.Spawn(this.abom, position, base.Map); } this.pawn.jobs.EndCurrentJob(JobCondition.Succeeded, true); }
private void CheckRelatives() { Pawn pawn = null; Pawn pawn2 = null; if (this.relations.DirectRelations.Count > 0) { foreach (DirectPawnRelation current in this.relations.DirectRelations) { if (current.def == PawnRelationDefOf.Parent) { if (current.otherPawn.gender == Gender.Female) { pawn = current.otherPawn; } else if (current.otherPawn.gender == Gender.Male) { pawn2 = current.otherPawn; } } } } else { Log.Warning("Fug, no relations!"); } if (pawn != null) { int index; if (pawn2 != null) { index = ((AnimalMultiSkins)GenCollection.RandomElement <Pawn>(new List <Pawn> { pawn, pawn2 })).skin_index; } else { index = ((AnimalMultiSkins)pawn).skin_index; } this.ApplyNewSkin(index); } else { Log.Message("No mother found"); } }
public static ThingDef RandomExpensiveWallStuff(Faction faction, bool notVeryFlammable = true) { ThingDef result; if (faction != null && TechLevelUtility.IsNeolithicOrWorse(faction.def.techLevel)) { result = ThingDefOf.WoodLog; } else { result = GenCollection.RandomElement <ThingDef>(from d in DefDatabase <ThingDef> .AllDefsListForReading where d.IsStuff && d.stuffProps.CanMake(ThingDefOf.Wall) && (!notVeryFlammable || d.BaseFlammability < 0.5f) && d.BaseMarketValue / d.VolumePerUnit > 8f select d); } return(result); }