예제 #1
0
        protected static void OnWeather(Event e)
        {
            WeatherEvent weatherEvent = e as WeatherEvent;

            if (weatherEvent == null)
            {
                return;
            }

            if (Household.ActiveHousehold == null)
            {
                return;
            }

            if (Household.ActiveHousehold.LotHome == null)
            {
                return;
            }

            /*
             * switch (weatherEvent.Weather)
             * {
             *  case Weather.Rain:
             *  case Weather.Hail:
             *      foreach (Plant plant in Household.ActiveHousehold.LotHome.GetObjects<Plant>())
             *      {
             *          if ((!plant.IsOutside) || (SeasonsManager.IsShelteredFromPrecipitation(plant))) continue;
             *
             *          if (plant.WaterLevel < 100)
             *          {
             *              plant.WaterLevel = 100;
             *          }
             *      }
             *      break;
             * }
             */
            switch (weatherEvent.Weather)
            {
            case Weather.Hail:
                foreach (Plant plant in Household.ActiveHousehold.LotHome.GetObjects <Plant>())
                {
                    if ((!plant.IsOutside) || (SeasonsManager.IsShelteredFromPrecipitation(plant)))
                    {
                        continue;
                    }

                    if (RandomUtil.RandomChance(Tempest.Settings.mHailKillsPlants))
                    {
                        plant.SetDead();
                    }
                }
                break;
            }

            switch (weatherEvent.Weather)
            {
            case Weather.Hail:
            case Weather.Snow:
                foreach (HarvestPlant plant in Sims3.Gameplay.Queries.GetObjects <HarvestPlant>())
                {
                    if ((!plant.IsOutside) || (SeasonsManager.IsShelteredFromPrecipitation(plant)))
                    {
                        continue;
                    }

                    if (RandomUtil.RandomChance(Tempest.Settings.mHailKillsHarvestables))
                    {
                        HarvestPlant harvest = plant as HarvestPlant;
                        if (harvest != null)
                        {
                            harvest.SetGrowthStateFromHarvestToNext();
                        }
                    }
                }
                break;
            }
        }
예제 #2
0
                public override bool Test(Sim actor, Sim target, bool isAutonomous, ref GreyedOutTooltipCallback greyedOutTooltipCallback)
                {
                    // Test new 6?

                    /*
                     * if (!actor.IsInActiveHousehold && isAutonomous)
                     * {
                     *  return false;
                     * }
                     */
                    if (actor.LotCurrent.IsWorldLot && actor.IsInActiveHousehold)
                    {
                        return(false);
                    }
                    if (SeasonsManager.Enabled && (SeasonsManager.CurrentWeather == Weather.Rain || SeasonsManager.CurrentWeather == Weather.Hail) && !SeasonsManager.IsShelteredFromPrecipitation(actor))
                    {
                        return(false);
                    }
                    return(true);
                }