Пример #1
0
        /*********
        ** 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();
        }
Пример #2
0
        /*********
        ** 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)
            };
        }
Пример #3
0
        /// <summary>Get the relative sprinkler tile coverage, including any mod customisations which don't change after launch.</summary>
        /// <param name="cobalt">Handles access to the Cobalt mod.</param>
        /// <param name="simpleSprinkler">Handles access to the Simple Sprinkler mod.</param>
        private IDictionary <int, Vector2[]> GetStaticSprinklerTiles(CobaltIntegration cobalt, SimpleSprinklerIntegration simpleSprinkler)
        {
            IDictionary <int, Vector2[]> tiles = new Dictionary <int, Vector2[]>();

            // vanilla coverage
            {
                Vector2 center = Vector2.Zero;

                // basic sprinkler
                tiles[599] = Utility.getAdjacentTileLocationsArray(center).Concat(new[] { center }).ToArray();

                // quality sprinkler
                tiles[621] = Utility.getSurroundingTileLocationsArray(center).Concat(new[] { center }).ToArray();

                // iridium sprinkler
                List <Vector2> iridiumTiles = new List <Vector2>(4 * 4);
                for (int x = -2; x <= 2; x++)
                {
                    for (int y = -2; y <= 2; y++)
                    {
                        iridiumTiles.Add(new Vector2(x, y));
                    }
                }
                tiles[645] = iridiumTiles.ToArray();
            }

            // Cobalt mod adds new sprinkler
            if (cobalt.IsLoaded)
            {
                tiles[cobalt.GetSprinklerId()] = cobalt.GetSprinklerTiles().ToArray();
            }

            // Simple Sprinkler mod adds tiles to default coverage
            if (simpleSprinkler.IsLoaded)
            {
                foreach (var pair in simpleSprinkler.GetNewSprinklerTiles())
                {
                    int sprinklerID = pair.Key;
                    if (tiles.TryGetValue(sprinklerID, out Vector2[] currentTiles))
Пример #4
0
 /// <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));
     }
 }
Пример #5
0
        /*********
        ** 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);
            }
        }