/********* ** Private methods *********/ /// <summary>The method invoked on the first game update tick.</summary> /// <param name="sender">The event sender.</param> /// <param name="e">The event arguments.</param> private void GameEvents_FirstUpdateTick(object sender, EventArgs e) { IModHelper helper = this.Helper; this.PelicanFiber = new PelicanFiberIntegration(helper.ModRegistry, helper.Reflection, this.Monitor); var betterSprinklers = new BetterSprinklersIntegration(helper.ModRegistry, this.Monitor); var cobalt = new CobaltIntegration(helper.ModRegistry, this.Monitor); var simpleSprinklers = new SimpleSprinklerIntegration(helper.ModRegistry, this.Monitor); this.Maps = this.GetDataMaps(this.Config, this.Helper.Translation, this.PelicanFiber, betterSprinklers, cobalt, simpleSprinklers).ToArray(); }
/********* ** Private methods *********/ /// <summary>The method invoked on the first game update tick.</summary> /// <param name="sender">The event sender.</param> /// <param name="e">The event arguments.</param> private void GameEvents_FirstUpdateTick(object sender, EventArgs e) { IModHelper helper = this.Helper; this.PelicanFiber = new PelicanFiberIntegration(helper.ModRegistry, helper.Reflection, this.Monitor); var betterSprinklers = new BetterSprinklersIntegration(helper.ModRegistry, this.Monitor); var cobalt = new CobaltIntegration(helper.ModRegistry, this.Monitor); var simpleSprinklers = new SimpleSprinklerIntegration(helper.ModRegistry, this.Monitor); this.Maps = new IDataMap[] { new AccessibilityMap(helper.Translation), new BeeHouseMap(helper.Translation), new ScarecrowMap(helper.Translation), new SprinklerMap(helper.Translation, betterSprinklers, cobalt, simpleSprinklers), new JunimoHutMap(helper.Translation, this.PelicanFiber) }; }
private void DoBetterSprinklers() { if (BetterSprinklersLoaded) { //Lets load up the integration from Better Sprinklers BetterSprinklersIntegration bsi = new BetterSprinklersIntegration(this.Helper.ModRegistry, this.Monitor); int bsi_area = bsi.MaxRadius; IDictionary <int, Vector2[]> bsi_tiles = bsi.GetSprinklerTiles(); sprinkler = new List <Vector2>(); quality_sprinkler = new List <Vector2>(); iridium_sprinkler = new List <Vector2>(); foreach (KeyValuePair <int, Vector2[]> tiles in bsi_tiles) { for (int i = 0; i < tiles.Value.Length; i++) { if (tiles.Key == 599) { if (!sprinkler.Contains(tiles.Value[i])) { sprinkler.Add(tiles.Value[i]); } } if (tiles.Key == 621) { if (!quality_sprinkler.Contains(tiles.Value[i])) { quality_sprinkler.Add(tiles.Value[i]); } } if (tiles.Key == 645) { if (!iridium_sprinkler.Contains(tiles.Value[i])) { iridium_sprinkler.Add(tiles.Value[i]); } } } } } }
/********* ** Public methods *********/ /// <summary>Construct an instance.</summary> /// <param name="translations">Provides translations in stored in the mod folder's i18n folder.</param> /// <param name="betterSprinklers">Handles access to the Better Sprinklers mod.</param> /// <param name="cobalt">Handles access to the Cobalt mod.</param> /// <param name="simpleSprinkler">Handles access to the Simple Sprinkler mod.</param> public SprinklerMap(ITranslationHelper translations, BetterSprinklersIntegration betterSprinklers, CobaltIntegration cobalt, SimpleSprinklerIntegration simpleSprinkler) { // init this.BetterSprinklers = betterSprinklers; this.Name = translations.Get("maps.sprinklers.name"); this.Legend = new[] { new LegendEntry(translations.Get("maps.sprinklers.covered"), this.WetColor), new LegendEntry(translations.Get("maps.sprinklers.dry-crops"), this.DryColor) }; // get static sprinkler coverage this.StaticTilesBySprinklerID = this.GetStaticSprinklerTiles(cobalt, simpleSprinkler); // get max sprinkler radius this.MaxRadius = this.StaticTilesBySprinklerID.Max(p => this.GetMaxRadius(p.Value)); if (betterSprinklers.IsLoaded) { this.MaxRadius = Math.Max(this.MaxRadius, betterSprinklers.MaxRadius); } }
/// <summary>Get the enabled data maps.</summary> /// <param name="config">The mod configuration.</param> /// <param name="translation">Provides translations for the mod.</param> /// <param name="pelicanFiber">Handles access to the Pelican Fiber mod.</param> /// <param name="betterSprinklers">Handles access to the Better Sprinklers mod.</param> /// <param name="cobalt">Handles access to the Cobalt mod.</param> /// <param name="simpleSprinklers">Handles access to the Simple Sprinklers mod.</param> private IEnumerable <IDataMap> GetDataMaps(ModConfig config, ITranslationHelper translation, PelicanFiberIntegration pelicanFiber, BetterSprinklersIntegration betterSprinklers, CobaltIntegration cobalt, SimpleSprinklerIntegration simpleSprinklers) { if (config.EnableMaps.Accessibility) { yield return(new AccessibilityMap(translation)); } if (config.EnableMaps.CoverageForBeeHouses) { yield return(new BeeHouseMap(translation)); } if (config.EnableMaps.CoverageForScarecrows) { yield return(new ScarecrowMap(translation)); } if (config.EnableMaps.CoverageForSprinklers) { yield return(new SprinklerMap(translation, betterSprinklers, cobalt, simpleSprinklers)); } if (config.EnableMaps.CoverageForJunimoHuts) { yield return(new JunimoHutMap(translation, this.PelicanFiber)); } if (config.EnableMaps.CropWater) { yield return(new CropWaterMap(translation)); } if (config.EnableMaps.CropFertilizer) { yield return(new CropFertilizerMap(translation)); } }