Exemple #1
0
 internal void updateCritterLocations(GameLocation location)
 {
     if (location.IsOutdoors)
     {
         CritterLocations thisLocation = new CritterLocations(location);
         thisLocation.buildAllPossibleHomes();
         thisLocation.balanceSpawning();
         AllCritterLocations.AddOrReplace(thisLocation);
     }
 }
Exemple #2
0
        /*********
        ** Private methods
        *********/
        private void createCritterLocationList(object sender, StardewModdingAPI.Events.DayStartedEventArgs args)
        {
            Log.debug("in create critter day start event");
            SeasonalCritters = AllCritters.Where(c => c.SpawnConditions.Seasons.Contains(Game1.currentSeason)).ToList();
            CritterLocations Farm = new CritterLocations(Game1.getFarm());

            Farm.buildAllPossibleHomes();
            Farm.balanceSpawning();
            AllCritterLocations.AddOrReplace(Farm);
            //Helper.Events.GameLoop.DayStarted -= createCritterLocationList;
        }
Exemple #3
0
        /// <summary>Raised after the player presses a button on the keyboard, controller, or mouse.</summary>
        /// <param name="sender">The event sender.</param>
        /// <param name="args">The event data.</param>
        ///
        private void onLocationChanged(object sender, StardewModdingAPI.Events.WarpedEventArgs args)
        {
            Log.info($"Location changed to {args.NewLocation}");
            try
            {
                CritterLocations CritterLocator = AllCritterLocations.Where(l => l.Location == Game1.currentLocation).SingleOrDefault();
                CritterLocator.spawnCritters();
            }
            catch
            {
                Log.debug("CritterLocator failed, creating new CritterLocations");
                CritterLocations CritterLocator = new CritterLocations(args.NewLocation);
                CritterLocator.buildAllPossibleHomes();
                CritterLocator.balanceSpawning();
                CritterLocator.spawnCritters();
                AllCritterLocations.AddOrReplace(CritterLocator);
            }

            // Helper.Events.Player.Warped -= onLocationChanged;
        }