/// <summary> /// Checks the family members and removes ones no longer living here /// </summary> /// <param name="c"></param> public static void CleanupFamily(Controller c) { foreach (ApartmentFamily af in c.Families) { if (af.Residents != null) { List<SimDescription> remove = new List<SimDescription>(); foreach (SimDescription sd in af.Residents) { //Remove if dead //Not living on lot if ((sd.IsDead && !sd.IsPlayableGhost) || sd.Household == null || (sd.Household != null && sd.Household.LotHome != null && sd.LotHome.LotId != c.LotCurrent.LotId)) { remove.Add(sd); } } if (remove != null && remove.Count > 0) { foreach (SimDescription sd in remove) { af.Residents.Remove(sd); CommonMethods.PrintMessage(sd.FullName + " removed from resident list of " + af.FamilyName); } } } } }
public static List<MinorPet> ReturnHomelessPets(Controller c) { List<MinorPet> homeless = ReturnMinorPets(c); foreach (ApartmentFamily af in c.Families) { if (af.MinorPets != null) { foreach (MinorPet p in af.MinorPets) { MinorPet p2 = homeless.Find(delegate(MinorPet p3) { return p3.ObjectId == p.ObjectId; }); if (p2 != null) homeless.Remove(p2); } } } return homeless; }
/// <summary> /// Returns list of minor pets in household /// </summary> /// <param name="c"></param> /// <returns></returns> public static List<MinorPet> ReturnMinorPets(Controller c) { List<MinorPet> pets = new List<MinorPet>(); //Find pets on lot MinorPet[] petArray = c.LotCurrent.GetObjects<MinorPet>(); if(petArray != null) foreach (var item in petArray) { pets.Add(item); } //Find pets in sim inventory if (c.LotCurrent.Household != null) { foreach (Sim s in c.LotCurrent.Household.Sims) { if (s.Inventory != null) { pets.AddRange(s.Inventory.FindAll<MinorPet>(false)); } } } return pets; }
/// <summary> /// Delete the selected family /// </summary> /// <param name="c"></param> /// <param name="f"></param> public static void DeleteFamily(Controller c, ApartmentFamily f) { if (f.Residents != null && f.Residents.Count > 0) { foreach (SimDescription item in f.Residents) { if (item.IsNeverSelectable) RemoveRoommate(item); } } //If not active family, join the funds if (!f.IsActive) c.LotCurrent.Household.SetFamilyFunds(c.LotCurrent.Household.FamilyFunds + f.FamilyFunds); c.Families.Remove(f); }
/// <summary> /// Reset the apartment lot and combine families /// </summary> /// <param name="c"></param> public static void ResetLot(Controller c) { //Reset families foreach (ApartmentFamily f in c.Families) { if (!f.IsActive) { foreach (SimDescription s in f.Residents) { RemoveRoommate(s); } c.LotCurrent.Household.SetFamilyFunds(c.LotCurrent.Household.FamilyFunds + f.FamilyFunds); } } c.Families = new List<ApartmentFamily>(); //Select the first sim in the active household if (c.LotCurrent != null && c.LotCurrent.Household != null && c.LotCurrent.Household.Sims != null && c.LotCurrent.Household.Sims.Count > 0) PlumbBob.SelectActor(c.LotCurrent.Household.Sims[0]); }
public static void LoadActiveHousehold(ApartmentFamily activeFamily, Controller c) { try { //Clean the families first CleanupFamily(c); //Change active families int currentFunds = c.LotCurrent.Household.FamilyFunds; int currentUnpaidBills = c.LotCurrent.Household.UnpaidBills; //Handle the new active family first foreach (ApartmentFamily f in c.Families) { if (f.FamilyId == activeFamily.FamilyId) { f.IsActive = true; c.LotCurrent.Household.SetFamilyFunds(f.FamilyFunds); c.LotCurrent.Household.UnpaidBills = f.UnpaidBills; ApartmentController.SwitchActive(f, true); break; } } //Select the first sim in the active household if (activeFamily.Residents.Count > 0 && c.LotCurrent.Household.IsActive) { PlumbBob.ForceSelectActor(activeFamily.Residents[0].CreatedSim); } //Make everybody else roommates foreach (ApartmentFamily f in c.Families) { if (f.FamilyId != activeFamily.FamilyId) { //If this is the previous active family if (f.IsActive) { f.FamilyFunds = currentFunds; f.UnpaidBills = currentUnpaidBills; } f.IsActive = false; ApartmentController.SwitchActive(f, false); } } //Household.ActiveHousehold.mh // HudModel hudModel = Sims3.UI.Responder.Instance.HudModel as HudModel; } catch (Exception ex) { CommonMethods.PrintMessage("LoadActiveHousehold: " + ex.Message); } }