public static void CreateActors(List <SimDescription> SimDescs, Lot lot, bool bAddInitialObjects) { List <Sim> sims = new List <Sim>(); foreach (SimDescription description in SimDescs) { try { description.HomeWorld = GameUtils.GetCurrentWorld(); if (description.CreatedSim == null) { if (description.Weight < 0f) { description.ChangeBodyShape(0f, description.Fitness, -description.Weight); } else { description.ChangeBodyShape(description.Weight, description.Fitness, 0f); } SimOutfit outfit = description.GetOutfit(OutfitCategories.Everyday, 0x0); Vector3 position = new Vector3(); // Custom Sim sim = Instantiation.Perform(description, position, outfit, null /*bAddInitialObjects*/); if (sim.SimDescription.IsGhost) { Urnstone.SimToPlayableGhost(sim, true); } sims.Add(sim); } else { sims.Add(description.CreatedSim); } description.GetMiniSimForProtection().AddProtection(MiniSimDescription.ProtectionFlag.PartialFromPlayer); } catch (Exception e) { Common.Exception(description, e); } } if (lot != null) { BinCommon.PlaceSims(sims, lot); } }
protected List <Sim> GeneratePetChildren(SimDescription woman, SimDescription man, int numChildren) { Random pregoRandom = new Random(); float[] chanceOfTwin = new float[] { 1f, PetPregnancy.kChanceEggSizeTwo, PetPregnancy.kChanceEggSizeThree, PetPregnancy.kChanceEggSizeFour }; int index = 0; SimDescription eggLead = null; GeneticsPet.SetName nameSet = GeneticsPet.SetName.SetNameNonInteractive; if (woman.IsHorse) { nameSet = GeneticsPet.SetName.SetNameInteractive; } List <Sim> babies = new List <Sim>(); for (int i = 0; i < numChildren; i++) { try { OccultTypes occult = RandomUtil.CoinFlip() ? woman.OccultManager.CurrentOccultTypes : man.OccultManager.CurrentOccultTypes; if (!OccultManager.DoesOccultTransferToOffspring(occult)) { occult = OccultTypes.None; } SimDescription newBaby = null; if (pregoRandom.NextDouble() > chanceOfTwin[index]) { index = 0x0; } if ((index == 0x0) || (woman.IsHorse)) { CASAgeGenderFlags species = woman.Species; if ((man != null) && (pregoRandom.NextDouble() > 0.5)) { species = man.Species; } newBaby = GeneticsPet.MakePetDescendant(man, woman, CASAgeGenderFlags.Child, NRaas.MasterControllerSpace.Helpers.Baby.InterpretGender(mGender), species, pregoRandom, true, nameSet, i, occult); if (newBaby != null) { if (RandomUtil.CoinFlip()) { newBaby.SetDeathStyle(woman.DeathStyle, true); } else { newBaby.SetDeathStyle(man.DeathStyle, true); } } } else { newBaby = GeneticsPet.MakeSameEggDescendant(eggLead, man, woman, NRaas.MasterControllerSpace.Helpers.Baby.InterpretGender(mGender), pregoRandom, true, nameSet, i); if (newBaby != null) { newBaby.SetDeathStyle(eggLead.DeathStyle, true); } } eggLead = newBaby; index++; if (index >= chanceOfTwin.Length) { index = chanceOfTwin.Length - 1; } if (newBaby == null) { continue; } newBaby.WasCasCreated = false; woman.Household.Add(newBaby); Vector3 position = woman.CreatedSim.Position; Sim babyToHide = Instantiation.Perform(newBaby, position, null, null); babies.Add(babyToHide); if (newBaby.DeathStyle != SimDescription.DeathType.None) { Urnstone.SimToPlayableGhost(babyToHide); } if (i == 0x0) { EventTracker.SendEvent(new SimDescriptionEvent(EventTypeId.kNewBaby, newBaby)); } if (woman.CreatedSim != null) { EventTracker.SendEvent(EventTypeId.kNewOffspringPet, woman.CreatedSim, babyToHide); } if (man.CreatedSim != null) { EventTracker.SendEvent(EventTypeId.kNewOffspringPet, man.CreatedSim, babyToHide); } foreach (Sim sim in CommonSpace.Helpers.Households.AllHumans(woman.Household)) { EventTracker.SendEvent(EventTypeId.kNewPet, sim, babyToHide); } } catch (Exception e) { Common.Exception(woman, man, e); } } return(babies); }