public override void Resolve(ResolveParams rp) { int? ancientCryptosleepCasketGroupID = rp.ancientCryptosleepCasketGroupID; int groupID = (ancientCryptosleepCasketGroupID == null) ? Find.UniqueIDsManager.GetNextAncientCryptosleepCasketGroupID() : ancientCryptosleepCasketGroupID.Value; PodContentsType?podContentsType = rp.podContentsType; PodContentsType value = (podContentsType == null) ? Gen.RandomEnumValue <PodContentsType>(true) : podContentsType.Value; Rot4? thingRot = rp.thingRot; Rot4 rot = (thingRot == null) ? Rot4.North : thingRot.Value; Building_AncientCryptosleepCasket building_AncientCryptosleepCasket = (Building_AncientCryptosleepCasket)ThingMaker.MakeThing(ThingDefOf.AncientCryptosleepCasket, null); building_AncientCryptosleepCasket.groupID = groupID; ThingSetMakerParams parms = default(ThingSetMakerParams); parms.podContentsType = new PodContentsType?(value); List <Thing> list = ThingSetMakerDefOf.MapGen_AncientPodContents.root.Generate(parms); for (int i = 0; i < list.Count; i++) { if (!building_AncientCryptosleepCasket.TryAcceptThing(list[i], false)) { Pawn pawn = list[i] as Pawn; if (pawn != null) { Find.WorldPawns.PassToWorld(pawn, PawnDiscardDecideMode.Discard); } else { list[i].Destroy(DestroyMode.Vanish); } } } GenSpawn.Spawn(building_AncientCryptosleepCasket, rp.rect.RandomCell, BaseGen.globalSettings.map, rot, WipeMode.Vanish, false); }
protected override void Generate(ThingSetMakerParams parms, List <Thing> outThings) { PodContentsType podContentsType = parms.podContentsType ?? Gen.RandomEnumValue <PodContentsType>(disallowFirstValue: true); switch (podContentsType) { case PodContentsType.AncientFriendly: outThings.Add(GenerateFriendlyAncient()); break; case PodContentsType.AncientIncapped: outThings.Add(GenerateIncappedAncient()); break; case PodContentsType.AncientHostile: outThings.Add(GenerateAngryAncient()); break; case PodContentsType.Slave: outThings.Add(GenerateSlave()); break; case PodContentsType.AncientHalfEaten: outThings.Add(GenerateHalfEatenAncient()); outThings.AddRange(GenerateScarabs()); break; default: Log.Error("Pod contents type not handled: " + podContentsType); break; case PodContentsType.Empty: break; } }
public override void Resolve(ResolveParams rp) { int groupID = rp.ancientCryptosleepCasketGroupID ?? Find.UniqueIDsManager.GetNextAncientCryptosleepCasketGroupID(); PodContentsType value = rp.podContentsType ?? Gen.RandomEnumValue <PodContentsType>(disallowFirstValue: true); Rot4 rot = rp.thingRot ?? Rot4.North; Building_AncientCryptosleepCasket building_AncientCryptosleepCasket = (Building_AncientCryptosleepCasket)ThingMaker.MakeThing(ThingDefOf.AncientCryptosleepCasket); building_AncientCryptosleepCasket.groupID = groupID; ThingSetMakerParams parms = default(ThingSetMakerParams); parms.podContentsType = value; List <Thing> list = ThingSetMakerDefOf.MapGen_AncientPodContents.root.Generate(parms); for (int i = 0; i < list.Count; i++) { if (!building_AncientCryptosleepCasket.TryAcceptThing(list[i], allowSpecialEffects: false)) { Pawn pawn = list[i] as Pawn; if (pawn != null) { Find.WorldPawns.PassToWorld(pawn, PawnDiscardDecideMode.Discard); } else { list[i].Destroy(); } } } GenSpawn.Spawn(building_AncientCryptosleepCasket, rp.rect.RandomCell, BaseGen.globalSettings.map, rot); }
protected override void Generate(ItemCollectionGeneratorParams parms, List <Thing> outThings) { PodContentsType?podContentsType = parms.podContentsType; PodContentsType podContentsType2 = (!podContentsType.HasValue) ? Gen.RandomEnumValue <PodContentsType>(true) : podContentsType.Value; switch (podContentsType2) { case PodContentsType.Empty: break; case PodContentsType.SpacerFriendly: outThings.Add(this.GenerateFriendlySpacer()); break; case PodContentsType.SpacerIncapped: outThings.Add(this.GenerateIncappedSpacer()); break; case PodContentsType.SpacerHostile: outThings.Add(this.GenerateAngrySpacer()); break; case PodContentsType.Slave: outThings.Add(this.GenerateSlave()); break; case PodContentsType.SpacerHalfEaten: outThings.Add(this.GenerateHalfEatenSpacer()); outThings.AddRange(this.GenerateScarabs()); break; default: Log.Error("Pod contents type not handled: " + podContentsType2); break; } }