private static void OnWarped(object sender, WarpedEventArgs e) { if ((!CustomCPTokens.FoxbloomCanSpawn(e.NewLocation, spawned_today)) || e.NewLocation.modData["RSV_foxbloomSpawned"] == "true") { //Log.Trace("RSV: Not spawning Foxbloom."); return; } Random random = new(); Vector2 spawn_spot = spawn_spots.ElementAt(random.Next(0, 7)); try { int FOXBLOOMID = ExternalAPIs.JA.GetObjectId("Foxbloom"); UtilFunctions.SpawnForage(FOXBLOOMID, e.NewLocation, spawn_spot, true); Log.Trace("RSV: Foxbloom spawned as forage."); spawned_today = true; e.NewLocation.modData["RSV_foxbloomSpawned"] = "true"; } catch (Exception ex) { Log.Error($"RSV: Error spawning Foxbloom at {spawn_spot.X}, {spawn_spot.Y}\n{ex}"); } }
public override void Entry(IModHelper helper) { ModMonitor = Monitor; Helper = helper; if (!new InstallationChecker().checkInstallation(helper)) { return; } ConfigMenu = new ConfigMenu(this); CustomCPTokens = new CustomCPTokens(this); helper.Events.GameLoop.GameLaunched += OnGameLaunched; helper.Events.GameLoop.SaveLoaded += OnSaveLoaded; helper.Events.GameLoop.DayStarted += OnDayStarted; BgUtils.Initialize(this); TortsBackground.Initialize(this); BloomProjectile.Initialize(this); MistProjectile.Initialize(this); Mistblade.Initialize(this); Patcher = new Patcher(this); Patcher.PerformPatching(); HotelMenu.Initialize(this); Minecarts.Initialize(this); SpiritRealm.Initialize(this); SpecialOrders.Initialize(this); IanShop.Initialize(this); Elves.Initialize(this); Greenhouses.Initialize(this); Loan.Initialize(this); //SummitHouse.Initialize(this); WarpTotem.Initialize(this); PaulaClinic.Initialize(this); Offering.OfferingTileAction.Initialize(this); NightlyEvent.Initialize(this); NinjaBooks.Initialize(this); Foxbloom.Initialize(this); //not done (yet?) //new CliffBackground(); Helper.ConsoleCommands.Add("LocationModData", "show ModData of given location", printLocationModData); Helper.ConsoleCommands.Add("remove_equipment", "Remove all clothes and equipment from farmer", RemoveEquipment); }