public static List <Sim> GetTreatableSims(Sim actor, Lot lot)
        {
            List <Sim> list = null;

            if (!lot.IsWorldLot)
            {
                foreach (Sim s in lot.GetAllActors())
                {
                    if (s != actor && s.BuffManager.HasElement(LoadThis.buffNamePetstilence))
                    {
                        Lazy.Add(ref list, s);
                    }
                }
            }

            Sim[] objects = Queries.GetObjects <Sim>(actor.Position, kRadiusForValidSims);
            foreach (Sim sim in objects)
            {
                if (sim != actor && sim.BuffManager.HasElement(LoadThis.buffNamePetstilence) &&
                    !Lazy.Contains(list, sim))
                {
                    Lazy.Add(ref list, sim);
                }
            }
            return(list);
        }
Exemple #2
0
        public static List <Sim> GetTreatableSims(Sim actor, Lot lot)
        {
            List <Sim> list = null;

            if (!lot.IsWorldLot)
            {
                foreach (Sim s in lot.GetAllActors())
                {
                    if (s != actor && s.IsPet)
                    {
                        Lazy.Add(ref list, s);
                    }
                }
            }

            Sim[] objects = Queries.GetObjects <Sim>(actor.Position, kRadiusForValidSims);
            foreach (Sim sim in objects)
            {
                if (sim != actor && sim.IsPet && !Lazy.Contains(list, sim))
                {
                    Lazy.Add(ref list, sim);
                }
            }
            return(list);
        }
Exemple #3
0
 public static void OnWorldLoadFinishedHandler(object sender, System.EventArgs e)
 {
     Sim[] pets = Queries.GetObjects <Sim>();
     foreach (Sim pet in pets)
     {
         InitializePetBreed(pet);
     }
     Sim.CustomizeCollarAndCoats.Singleton = EWCustomizeCollarAndCoats.Singleton;
     EventTracker.AddListener(EventTypeId.kNewOffspringPet, new ProcessEventDelegate(OnNewOffspringPet));
     EventTracker.AddListener(EventTypeId.kSimInstantiated, new ProcessEventDelegate(OnSimInstantiated));
     EventTracker.AddListener(EventTypeId.kPlannedOutfitPet, new ProcessEventDelegate(OnPlannedOutfitPet));
 }
Exemple #4
0
        public static void OnWorldLoadFinishedHandler(object sender, System.EventArgs e)
        {
            // Add custom fishing interaction that uses custom fishing skill
            if (Terrain.Singleton != null)
            {
                Terrain.Singleton.RemoveInteractionByType(Terrain.CatFishHere.Singleton);
                Terrain.Singleton.AddInteraction(EWCatFishHere.Singleton);
                Terrain.Singleton.AddInteraction(EWCatInspectWater.Singleton);
                Terrain.Singleton.AddInteraction(EWCatPlayInWater.Singleton);
                Terrain.Singleton.AddInteraction(EWCatFishAWhile.Singleton);
            }

            try
            {
                // If there's no existing tuning for EWCatEatFish, copy over the Hunger output from PetEatPrey
                InteractionTuning eatTuning = AutonomyTuning.GetTuning(EWCatEatFish.Singleton.GetType().FullName,
                                                                       "Sims3.Gameplay.Interfaces.ICatPrey");
                if (eatTuning == null)
                {
                    InteractionTuning oldTuning = AutonomyTuning.GetTuning(PetEatPrey.Singleton.GetType().FullName,
                                                                           "Sims3.Gameplay.Interfaces.ICatPrey");
                    AutonomyTuning.AddTuning(EWCatEatFish.Singleton.GetType().FullName,
                                             "Sims3.Gameplay.Interfaces.ICatPrey", oldTuning);
                }
            }
            catch (Exception ex)
            {
                StyledNotification.Show(new StyledNotification.Format("ERROR loading EWCatEatFish tuning: " + ex.Message,
                                                                      StyledNotification.NotificationStyle.kDebugAlert));
            }

            MinorPet[] objects = Queries.GetObjects <MinorPet>();
            foreach (MinorPet val in objects)
            {
                if (val.CatHuntingComponent != null)
                {
                    val.AddInventoryInteraction(EWCatDropHere.Singleton);
                }
            }
            Fish[] fish = Queries.GetObjects <Fish>();
            foreach (Fish f in fish)
            {
                if (f.CatHuntingComponent != null)
                {
                    // Separate out eating fish from land prey.
                    f.AddInventoryInteraction(EWCatDropHere.Singleton);
                    f.RemoveInteractionByType(PetEatPrey.Singleton);
                    f.AddInteraction(EWCatEatFish.Singleton);
                }
            }
            EventTracker.AddListener(EventTypeId.kInventoryObjectAdded, new ProcessEventDelegate(OnObjectChanged));
            EventTracker.AddListener(EventTypeId.kObjectStateChanged, new ProcessEventDelegate(OnObjectChanged));
        }
Exemple #5
0
        public static void OnWorldLoadFinishedHandler(object sender, System.EventArgs e)
        {
            foreach (Plant p in Queries.GetObjects <Plant>())
            {
                //p.AddInteraction(EWPetMarkPlant.Singleton);
                p.AddInteraction(EWPetWatchPlant.Singleton);
                p.AddInteraction(EWPetHarvest.Singleton);
                p.AddInteraction(EWPetWeedPlant.Singleton);
                p.AddInteraction(EWPetWaterPlant.Singleton);
                p.AddInteraction(EWPetDisposePlant.Singleton);
            }

            foreach (GameObject p in Queries.GetObjects <GameObject>())
            {
                if (!(p.Plantable == null))
                {
                    p.AddInteraction(EWPetPickUpPlantable.Singleton);
                    p.AddInventoryInteraction(EWPetPlantSeed.Singleton);
                    p.AddInventoryInteraction(EWPetTreatNausea.Singleton);
                }
                if (p.CatHuntingComponent != null)
                {
                    if (p.CatHuntingComponent.mPreyData.PreyType == CatHuntingSkill.PreyType.Rodent)
                    {
                        p.AddInventoryInteraction(EWPetTreatFleas.Singleton);
                    }
                }

                Fish fish = p as Fish;
                if (fish != null)
                {
                    fish.AddInventoryInteraction(EWCarryFish.Singleton);
                }
            }

            EventTracker.AddListener(EventTypeId.kInventoryObjectAdded, new ProcessEventDelegate(OnObjectChanged));
            EventTracker.AddListener(EventTypeId.kObjectStateChanged, new ProcessEventDelegate(OnObjectChanged));
        }