/// <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; }
public static void Player_Warped(object sender, StardewModdingAPI.Events.WarpedEventArgs e) { //monitor.Log($"{e.NewLocation.Name} terrain features: {e.NewLocation.terrainFeatures.Count()}"); }