public override void DoEditInterface(Listing_ScenEdit listing) { Rect scenPartRect = listing.GetScenPartRect(this, ScenPart.RowHeight); if (Widgets.ButtonText(scenPartRect, this.method.ToStringHuman(), true, false, true)) { List <FloatMenuOption> list = new List <FloatMenuOption>(); IEnumerator enumerator = Enum.GetValues(typeof(PlayerPawnsArriveMethod)).GetEnumerator(); try { while (enumerator.MoveNext()) { PlayerPawnsArriveMethod playerPawnsArriveMethod = (PlayerPawnsArriveMethod)enumerator.Current; PlayerPawnsArriveMethod localM = playerPawnsArriveMethod; list.Add(new FloatMenuOption(localM.ToStringHuman(), delegate { this.method = localM; }, MenuOptionPriority.Default, null, null, 0f, null, null)); } } finally { IDisposable disposable; if ((disposable = (enumerator as IDisposable)) != null) { disposable.Dispose(); } } Find.WindowStack.Add(new FloatMenu(list)); } }
public static string ToStringHuman(this PlayerPawnsArriveMethod method) { return(method switch { PlayerPawnsArriveMethod.Standing => "PlayerPawnsArriveMethod_Standing".Translate(), PlayerPawnsArriveMethod.DropPods => "PlayerPawnsArriveMethod_DropPods".Translate(), _ => throw new NotImplementedException(), });
public static string ToStringHuman(this PlayerPawnsArriveMethod method) { if (method == PlayerPawnsArriveMethod.Standing) { return("PlayerPawnsArriveMethod_Standing".Translate()); } if (method != PlayerPawnsArriveMethod.DropPods) { throw new NotImplementedException(); } return("PlayerPawnsArriveMethod_DropPods".Translate()); }
public static string ToStringHuman(this PlayerPawnsArriveMethod method) { switch (method) { case PlayerPawnsArriveMethod.Standing: return("PlayerPawnsArriveMethod_Standing".Translate()); case PlayerPawnsArriveMethod.DropPods: return("PlayerPawnsArriveMethod_DropPods".Translate()); default: throw new NotImplementedException(); } }
public override void DoEditInterface(Listing_ScenEdit listing) { if (Widgets.ButtonText(listing.GetScenPartRect(this, ScenPart.RowHeight), method.ToStringHuman())) { List <FloatMenuOption> list = new List <FloatMenuOption>(); foreach (PlayerPawnsArriveMethod value in Enum.GetValues(typeof(PlayerPawnsArriveMethod))) { PlayerPawnsArriveMethod localM = value; list.Add(new FloatMenuOption(localM.ToStringHuman(), delegate { method = localM; })); } Find.WindowStack.Add(new FloatMenu(list)); } }
// Token: 0x060047C4 RID: 18372 RVA: 0x00180E40 File Offset: 0x0017F040 public override void DoEditInterface(Listing_ScenEdit listing) { if (Widgets.ButtonText(listing.GetScenPartRect(this, ScenPart.RowHeight), this.method.ToStringHuman(), true, true, true)) { List <FloatMenuOption> list = new List <FloatMenuOption>(); foreach (object obj in Enum.GetValues(typeof(PlayerPawnsArriveMethod))) { PlayerPawnsArriveMethod localM2 = (PlayerPawnsArriveMethod)obj; PlayerPawnsArriveMethod localM = localM2; list.Add(new FloatMenuOption(localM.ToStringHuman(), delegate() { this.method = (PlayerPawnsArriveMethod)localM; }, MenuOptionPriority.Default, null, null, 0f, null, null)); } Find.WindowStack.Add(new FloatMenu(list)); } }
public override void Randomize() { this.method = (PlayerPawnsArriveMethod)((Rand.Value < 0.5) ? 1 : 0); }
public override void Randomize() { this.method = ((Rand.Value >= 0.5f) ? PlayerPawnsArriveMethod.Standing : PlayerPawnsArriveMethod.DropPods); }
internal void <> m__0() { this.$this.method = this.localM; }
public override void GenerateIntoMap(Map map) { if (Find.GameInitData == null) { return; } List <List <Thing> > list = new List <List <Thing> >(); foreach (Pawn item in Find.GameInitData.startingAndOptionalPawns) { list.Add(new List <Thing> { item }); } List <Thing> list2 = new List <Thing>(); foreach (ScenPart scenPart in Find.Scenario.AllParts) { list2.AddRange(scenPart.PlayerStartingThings()); } int num = 0; for (int i = 0; i < list2.Count; i++) { Thing thing = list2[i]; if (thing.def.CanHaveFaction) { thing.SetFactionDirect(Faction.OfPlayer); } list[num].Add(thing); num++; if (num >= list.Count) { num = 0; } } PlayerPawnsArriveMethod method = (PlayerPawnsArriveMethod)AccessTools.Field(typeof(ScenPart_PlayerPawnsArriveMethod), "method").GetValue(this); // Log.Message("method = " + method.ToStringHuman() + " dropship: "+ (DropshipDef != null)); if (DropshipDef != null && method == PlayerPawnsArriveMethod.DropPods) { Thing ship = ThingMaker.MakeThing(this.DropshipDef); CompDropship dropship = ship.TryGetCompFast <CompDropship>(); if (dropship != null) { foreach (List <Thing> item in list) { if (item.Contains(ship)) { item.Remove(ship); } dropship.Transporter.innerContainer.TryAddRangeOrTransfer(item); } dropship.autodustoff = AutoDustoff; if (DropCellFinder.TryFindDropSpotNear(MapGenerator.PlayerStartSpot, map, out IntVec3 spot, false, false, false, ship.def.Size)) { GenPlace.TryPlaceThing(SkyfallerMaker.MakeSkyfaller(ThingDef.Named(ship.def.defName + "_Incoming"), ship), spot, map, ThingPlaceMode.Near, null, null, default(Rot4)); } else { GenPlace.TryPlaceThing(SkyfallerMaker.MakeSkyfaller(ThingDef.Named(ship.def.defName + "_Incoming"), ship), MapGenerator.PlayerStartSpot, map, ThingPlaceMode.Near, null, null, default(Rot4)); } return; } }
public override void Randomize() { method = ((Rand.Value < 0.5f) ? PlayerPawnsArriveMethod.DropPods : PlayerPawnsArriveMethod.Standing); }
// Copy of ScenPart_PlayerPawnsArriveMethod.GenerateIntoMap(), but with changes to spawn custom // equipment. public void SpawnColonistsWithEquipment(Map map, ScenPart_PlayerPawnsArriveMethod arriveMethodPart) { List <List <Thing> > list = new List <List <Thing> >(); foreach (Pawn current in Find.GameInitData.startingPawns) { list.Add(new List <Thing> { current }); } List <Thing> list2 = new List <Thing>(); foreach (ScenPart current2 in Find.Scenario.AllParts) { ScenPart_StartingThing_Defined startingThings = current2 as ScenPart_StartingThing_Defined; ScenPart_StartingAnimal animal = current2 as ScenPart_StartingAnimal; if (startingThings == null && animal == null) { list2.AddRange(current2.PlayerStartingThings()); } } int num = 0; foreach (Thing current3 in list2) { if (current3.def.CanHaveFaction) { current3.SetFactionDirect(Faction.OfPlayer); } list[num].Add(current3); num++; if (num >= list.Count) { num = 0; } } // Spawn custom equipment List <Thing> weapons = new List <Thing>(); List <Thing> food = new List <Thing>(); List <Thing> apparel = new List <Thing>(); List <Thing> animals = new List <Thing>(); List <Thing> other = new List <Thing>(); int maxStack = 50; foreach (var e in PrepareCarefully.Instance.Equipment) { EquipmentDatabaseEntry entry = PrepareCarefully.Instance.EquipmentEntries[e.EquipmentKey]; if (entry == null) { string thing = e.def != null ? e.def.defName : "null"; string stuff = e.stuffDef != null ? e.stuffDef.defName : "null"; Log.Warning(string.Format("Unrecognized resource/equipment. This may be caused by an invalid thing/stuff combination. (thing = {0}, stuff={1})", thing, stuff)); continue; } if (entry.gear) { int count = e.Count; int idealStackCount = count / list.Count; while (count > 0) { int stackCount = idealStackCount; if (stackCount < 1) { stackCount = 1; } if (stackCount > entry.def.stackLimit) { stackCount = entry.def.stackLimit; } if (stackCount > maxStack) { stackCount = maxStack; } if (stackCount > count) { stackCount = count; } Thing thing = null; if (entry.def.MadeFromStuff && entry.stuffDef == null) { ThingDef defaultStuffDef = null; if (entry.def.apparel != null) { defaultStuffDef = ThingDef.Named("Synthread"); } if (thing == null) { Log.Warning("Item " + entry.def.defName + " is \"made from stuff\" but no material was specified. This may be caused by a misconfigured modded item or scenario."); Log.Warning("The item will be spawned into the map and assigned a default material, if possible, but you will see an error if you are in Development Mode."); } thing = ThingMaker.MakeThing(entry.def, defaultStuffDef); } else { thing = ThingMaker.MakeThing(entry.def, entry.stuffDef); } if (thing != null) { thing.stackCount = stackCount; if (entry.def.weaponTags != null && entry.def.weaponTags.Count > 0) { weapons.Add(thing); } else if (entry.def.apparel != null) { apparel.Add(thing); } else if (entry.def.ingestible != null) { food.Add(thing); } else { other.Add(thing); } } // Decrement the count whether we were able to add a valid thing or not. If we don't decrement, // we'll be stuck in an infinite while loop. count -= stackCount; } } else if (entry.animal) { int count = e.Count; for (int i = 0; i < count; i++) { Thing animal = CreateAnimal(entry); if (animal != null) { animals.Add(animal); } } } } List <Thing> combined = new List <Thing>(); combined.AddRange(weapons); combined.AddRange(food); combined.AddRange(apparel); combined.AddRange(animals); combined.AddRange(other); num = 0; foreach (Thing thing in combined) { if (thing.def.CanHaveFaction) { thing.SetFactionDirect(Faction.OfPlayer); } list[num].Add(thing); num++; if (num >= list.Count) { num = 0; } } // Get the arrive method from the scenario part. PlayerPawnsArriveMethod arriveMethod = PlayerPawnsArriveMethod.DropPods; if (arriveMethodPart != null) { arriveMethod = (PlayerPawnsArriveMethod)typeof(ScenPart_PlayerPawnsArriveMethod).GetField("method", BindingFlags.NonPublic | BindingFlags.Instance).GetValue(arriveMethodPart); } bool instaDrop = Find.GameInitData.QuickStarted || arriveMethod != PlayerPawnsArriveMethod.DropPods; DropPodUtility.DropThingGroupsNear(MapGenerator.PlayerStartSpot, map, list, 110, instaDrop, true, true); }