Ejemplo n.º 1
0
 /*********
 ** Private methods
 *********/
 /// <summary>Get the object IDs for known mod scarecrows.</summary>
 /// <param name="mods">Handles access to the supported mod integrations.</param>
 private IEnumerable <int> GetModScarecrowIDs(ModIntegrations mods)
 {
     if (mods.PrismaticTools.IsLoaded && mods.PrismaticTools.ArePrismaticSprinklersScarecrows())
     {
         yield return(mods.PrismaticTools.GetSprinklerID());
     }
 }
Ejemplo n.º 2
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="config">The data layer settings.</param>
        /// <param name="mods">Handles access to the supported mod integrations.</param>
        /// <param name="input">The API for checking input state.</param>
        /// <param name="monitor">Writes messages to the SMAPI log.</param>
        public SprinklerLayer(ITranslationHelper translations, LayerConfig config, ModIntegrations mods, IInputHelper input, IMonitor monitor)
            : base(translations.Get("sprinklers.name"), config, input, monitor)
        {
            // init
            this.Mods   = mods;
            this.Legend = new[]
            {
                this.Wet = new LegendEntry(translations, "sprinklers.covered", Color.Green),
                this.Dry = new LegendEntry(translations, "sprinklers.dry-crops", Color.Red)
            };

            // get static sprinkler coverage
            this.StaticTilesBySprinklerID = this.GetStaticSprinklerTiles(mods);

            // get max sprinkler radius
            this.MaxRadius = this.StaticTilesBySprinklerID.Max(p => this.GetMaxRadius(p.Value));
            if (mods.BetterSprinklers.IsLoaded)
            {
                this.MaxRadius = Math.Max(this.MaxRadius, mods.BetterSprinklers.MaxRadius);
            }
            if (mods.LineSprinklers.IsLoaded)
            {
                this.MaxRadius = Math.Max(this.MaxRadius, mods.LineSprinklers.MaxRadius);
            }
        }
Ejemplo n.º 3
0
        /*********
        ** Public methods
        *********/
        /// <summary>Construct an instance.</summary>
        /// <param name="config">The data layer settings.</param>
        /// <param name="mods">Handles access to the supported mod integrations.</param>
        /// <param name="input">The API for checking input state.</param>
        /// <param name="monitor">Writes messages to the SMAPI log.</param>
        public SprinklerLayer(LayerConfig config, ModIntegrations mods, IInputHelper input, IMonitor monitor)
            : base(I18n.Sprinklers_Name(), config, input, monitor)
        {
            // init
            this.Mods   = mods;
            this.Legend = new[]
            {
                this.Wet = new LegendEntry(I18n.Keys.Sprinklers_Covered, Color.Green),
                this.Dry = new LegendEntry(I18n.Keys.Sprinklers_DryCrops, Color.Red)
            };

            // get static sprinkler coverage
            this.StaticTilesBySprinklerID = this.GetStaticSprinklerTiles(mods);

            // get max sprinkler radius
            this.MaxRadius = this.StaticTilesBySprinklerID.Max(p => this.GetMaxRadius(p.Value));
            if (mods.BetterSprinklers.IsLoaded)
            {
                this.MaxRadius = Math.Max(this.MaxRadius, mods.BetterSprinklers.MaxRadius);
            }
            if (mods.LineSprinklers.IsLoaded)
            {
                this.MaxRadius = Math.Max(this.MaxRadius, mods.LineSprinklers.MaxRadius);
            }
        }
Ejemplo n.º 4
0
        /// <summary>Get the enabled data layers.</summary>
        /// <param name="config">The mod configuration.</param>
        /// <param name="input">The API for checking input state.</param>
        /// <param name="mods">Handles access to the supported mod integrations.</param>
        private IEnumerable <ILayer> GetLayers(ModConfig config, IInputHelper input, ModIntegrations mods)
        {
            ModConfig.LayerConfigs layers = config.Layers;

            if (layers.Accessible.IsEnabled())
            {
                yield return(new AccessibleLayer(layers.Accessible, input, this.Monitor));
            }
            if (layers.Buildable.IsEnabled())
            {
                yield return(new BuildableLayer(layers.Buildable, input, this.Monitor));
            }
            if (layers.CoverageForBeeHouses.IsEnabled())
            {
                yield return(new BeeHouseLayer(layers.CoverageForBeeHouses, input, this.Monitor));
            }
            if (layers.CoverageForScarecrows.IsEnabled())
            {
                yield return(new ScarecrowLayer(layers.CoverageForScarecrows, mods, input, this.Monitor));
            }
            if (layers.CoverageForSprinklers.IsEnabled())
            {
                yield return(new SprinklerLayer(layers.CoverageForSprinklers, mods, input, this.Monitor));
            }
            if (layers.CoverageForJunimoHuts.IsEnabled())
            {
                yield return(new JunimoHutLayer(layers.CoverageForJunimoHuts, mods, input, this.Monitor));
            }
            if (layers.CropWater.IsEnabled())
            {
                yield return(new CropWaterLayer(layers.CropWater, input, this.Monitor));
            }
            if (layers.CropPaddyWater.IsEnabled())
            {
                yield return(new CropPaddyWaterLayer(layers.CropPaddyWater, input, this.Monitor));
            }
            if (layers.CropFertilizer.IsEnabled())
            {
                yield return(new CropFertilizerLayer(layers.CropFertilizer, input, this.Monitor));
            }
            if (layers.CropHarvest.IsEnabled())
            {
                yield return(new CropHarvestLayer(layers.CropHarvest, input, this.Monitor));
            }
            if (layers.Machines.IsEnabled() && mods.Automate.IsLoaded)
            {
                yield return(new MachineLayer(layers.Machines, mods, input, this.Monitor));
            }
            if (layers.Tillable.IsEnabled())
            {
                yield return(new TillableLayer(layers.Tillable, input, this.Monitor));
            }

            // add separate grid layer if grid isn't enabled for all layers
            if (!config.ShowGrid && layers.TileGrid.IsEnabled())
            {
                yield return(new GridLayer(layers.TileGrid, input, this.Monitor));
            }
        }
Ejemplo n.º 5
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)
        {
            // init
            this.Mods   = new ModIntegrations(this.Monitor, this.Helper.ModRegistry, this.Helper.Reflection);
            this.Layers = this.GetLayers(this.Config, this.Helper.Translation, this.Mods).ToArray();

            // disable Data Maps if present
            this.TryDisableLegacyMod();
        }
Ejemplo n.º 6
0
 /*********
 ** Public methods
 *********/
 /// <summary>Construct an instance.</summary>
 /// <param name="config">The data layer settings.</param>
 /// <param name="mods">Handles access to the supported mod integrations.</param>
 /// <param name="input">The API for checking input state.</param>
 /// <param name="monitor">Writes messages to the SMAPI log.</param>
 public ScarecrowLayer(LayerConfig config, ModIntegrations mods, IInputHelper input, IMonitor monitor)
     : base(I18n.Scarecrows_Name(), config, input, monitor)
 {
     this.Legend = new[]
     {
         this.Covered = new LegendEntry(I18n.Keys.Scarecrows_Protected, Color.Green),
         this.Exposed = new LegendEntry(I18n.Keys.Scarecrows_Exposed, Color.Red)
     };
     this.ModObjectIds = this.GetModScarecrowIDs(mods).ToArray();
 }
Ejemplo n.º 7
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="config">The data layer settings.</param>
 /// <param name="mods">Handles access to the supported mod integrations.</param>
 public ScarecrowLayer(ITranslationHelper translations, LayerConfig config, ModIntegrations mods)
     : base(translations.Get("scarecrows.name"), config)
 {
     this.Legend = new[]
     {
         new LegendEntry(translations.Get("scarecrows.protected"), this.CoveredColor),
         new LegendEntry(translations.Get("scarecrows.exposed"), this.ExposedColor)
     };
     this.ModObjectIds = this.GetModScarecrowIDs(mods).ToArray();
 }
Ejemplo n.º 8
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="config">The data layer settings.</param>
 /// <param name="mods">Handles access to the supported mod integrations.</param>
 /// <param name="input">The API for checking input state.</param>
 /// <param name="monitor">Writes messages to the SMAPI log.</param>
 public ScarecrowLayer(ITranslationHelper translations, LayerConfig config, ModIntegrations mods, IInputHelper input, IMonitor monitor)
     : base(translations.Get("scarecrows.name"), config, input, monitor)
 {
     this.Legend = new[]
     {
         this.Covered = new LegendEntry(translations, "scarecrows.protected", Color.Green),
         this.Exposed = new LegendEntry(translations, "scarecrows.exposed", Color.Red)
     };
     this.ModObjectIds = this.GetModScarecrowIDs(mods).ToArray();
 }
Ejemplo n.º 9
0
 /*********
 ** Public methods
 *********/
 /// <summary>Construct an instance.</summary>
 /// <param name="config">The data layer settings.</param>
 /// <param name="mods">Handles access to the supported mod integrations.</param>
 public MachineLayer(LayerConfig config, ModIntegrations mods)
     : base(I18n.Machines_Name(), config)
 {
     this.Legend = new[]
     {
         this.Empty = new LegendEntry(I18n.Keys.Machines_Empty, Color.Red),
         this.Processing = new LegendEntry(I18n.Keys.Machines_Processing, Color.Orange),
         this.Finished = new LegendEntry(I18n.Keys.Machines_Finished, Color.Green)
     };
     this.Mods = mods;
 }
Ejemplo n.º 10
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="config">The data layer settings.</param>
 /// <param name="mods">Handles access to the supported mod integrations.</param>
 public MachineLayer(ITranslationHelper translations, LayerConfig config, ModIntegrations mods)
     : base(translations.Get("machines.name"), config)
 {
     this.Legend = new[]
     {
         this.Empty      = new LegendEntry(translations, "machines.empty", Color.Red),
         this.Processing = new LegendEntry(translations, "machines.processing", Color.Orange),
         this.Finished   = new LegendEntry(translations, "machines.finished", Color.Green)
     };
     this.Mods = mods;
 }
Ejemplo n.º 11
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="config">The data layer settings.</param>
 /// <param name="mods">Handles access to the supported mod integrations.</param>
 public MachineLayer(ITranslationHelper translations, LayerConfig config, ModIntegrations mods)
     : base(translations.Get("machines.name"), config)
 {
     this.Legend = new[]
     {
         new LegendEntry(translations.Get("machines.empty"), this.EmptyColor),
         new LegendEntry(translations.Get("machines.processing"), this.ProcessingColor),
         new LegendEntry(translations.Get("machines.finished"), this.FinishedColor)
     };
     this.Mods = mods;
 }
Ejemplo n.º 12
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 OnGameLaunched(object sender, GameLaunchedEventArgs e)
        {
            // init
            this.Mods   = new ModIntegrations(this.Monitor, this.Helper.ModRegistry, this.Helper.Reflection);
            this.Layers = this.GetLayers(this.Config, this.Helper.Input, this.Helper.Translation, this.Mods).ToArray();

            // cache shortcut keys
            foreach (ILayer layer in this.Layers)
            {
                if (layer.ShortcutKey.ToString() != SButton.None.ToString())
                {
                    this.ShortcutMap[layer.ShortcutKey] = layer;
                }
            }
        }
Ejemplo n.º 13
0
        /*********
        ** Public methods
        *********/
        /// <summary>Construct an instance.</summary>
        /// <param name="config">The data layer settings.</param>
        /// <param name="mods">Handles access to the supported mod integrations.</param>
        public JunimoHutLayer(LayerConfig config, ModIntegrations mods)
            : base(I18n.JunimoHuts_Name(), config)
        {
            // init
            this.Mods   = mods;
            this.Legend = new[]
            {
                this.Covered    = new LegendEntry(I18n.Keys.JunimoHuts_CanHarvest, Color.Green),
                this.NotCovered = new LegendEntry(I18n.Keys.JunimoHuts_CannotHarvest, Color.Red)
            };

            // set max radius
            this.MaxRadius = mods.BetterJunimos.IsLoaded
                ? mods.BetterJunimos.MaxRadius
                : JunimoHut.cropHarvestRadius;
        }
Ejemplo n.º 14
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="config">The data layer settings.</param>
        /// <param name="mods">Handles access to the supported mod integrations.</param>
        /// <param name="input">The API for checking input state.</param>
        /// <param name="monitor">Writes messages to the SMAPI log.</param>
        public JunimoHutLayer(ITranslationHelper translations, LayerConfig config, ModIntegrations mods, IInputHelper input, IMonitor monitor)
            : base(translations.Get("junimo-huts.name"), config, input, monitor)
        {
            // init
            this.Mods   = mods;
            this.Legend = new[]
            {
                this.Covered    = new LegendEntry(translations, "junimo-huts.can-harvest", Color.Green),
                this.NotCovered = new LegendEntry(translations, "junimo-huts.cannot-harvest", Color.Red)
            };

            // set max radius
            this.MaxRadius = mods.BetterJunimos.IsLoaded
                ? mods.BetterJunimos.MaxRadius
                : JunimoHut.cropHarvestRadius;
        }
Ejemplo n.º 15
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="config">The data layer settings.</param>
        /// <param name="mods">Handles access to the supported mod integrations.</param>
        public JunimoHutLayer(ITranslationHelper translations, LayerConfig config, ModIntegrations mods)
            : base(translations.Get("junimo-huts.name"), config)
        {
            // init
            this.Mods   = mods;
            this.Legend = new[]
            {
                new LegendEntry(translations.Get("junimo-huts.can-harvest"), this.CoveredColor),
                new LegendEntry(translations.Get("junimo-huts.cannot-harvest"), this.NotCoveredColor)
            };

            // set max radius
            this.MaxRadius = mods.BetterJunimos.IsLoaded
                ? mods.BetterJunimos.MaxRadius
                : JunimoHut.cropHarvestRadius;
        }
Ejemplo n.º 16
0
        /// <summary>Get the relative sprinkler tile coverage, including any mod customisations which don't change after launch.</summary>
        /// <param name="mods">Handles access to the supported mod integrations.</param>
        private IDictionary <int, Vector2[]> GetStaticSprinklerTiles(ModIntegrations mods)
        {
            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 sprinkler
            if (mods.Cobalt.IsLoaded)
            {
                tiles[mods.Cobalt.GetSprinklerId()] = mods.Cobalt.GetSprinklerTiles().ToArray();
            }

            // Prismatic Sprinkler
            if (mods.PrismaticTools.IsLoaded)
            {
                tiles[mods.PrismaticTools.GetSprinklerID()] = mods.PrismaticTools.GetSprinklerCoverage().ToArray();
            }

            // Simple Sprinkler mod adds tiles to default coverage
            if (mods.SimpleSprinkler.IsLoaded)
            {
                foreach (var pair in mods.SimpleSprinkler.GetNewSprinklerTiles())
                {
                    int sprinklerID = pair.Key;
                    if (tiles.TryGetValue(sprinklerID, out Vector2[] currentTiles))
Ejemplo n.º 17
0
        /*********
        ** Public methods
        *********/
        /// <summary>Construct an instance.</summary>
        /// <param name="config">The data layer settings.</param>
        /// <param name="mods">Handles access to the supported mod integrations.</param>
        public CropFertilizerLayer(LayerConfig config, ModIntegrations mods)
            : base(I18n.CropFertilizer_Name(), config)
        {
            this.Legend =
                new[]
            {
                this.Fertilizer    = new LegendEntry(I18n.Keys.CropFertilizer_Fertilizer, Color.Green),
                this.RetainingSoil = new LegendEntry(I18n.Keys.CropFertilizer_RetainingSoil, Color.Blue),
                this.SpeedGro      = new LegendEntry(I18n.Keys.CropFertilizer_SpeedGro, Color.Magenta),
                this.Multiple      = mods.MultiFertilizer.IsLoaded
                        ? new LegendEntry(I18n.Keys.CropFertilizer_Multiple, Color.Red)
                        : null
            }
            .WhereNotNull()
            .ToArray();

            this.Mods = mods;
        }
Ejemplo n.º 18
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 OnGameLaunched(object sender, GameLaunchedEventArgs e)
        {
            // init
            this.Mods   = new ModIntegrations(this.Monitor, this.Helper.ModRegistry, this.Helper.Reflection);
            this.Layers = this.GetLayers(this.Config, this.Helper.Translation, this.Mods).ToArray();

            // cache shortcut keys
            foreach (ILayer layer in this.Layers)
            {
                foreach (SButton button in layer.ShortcutKey)
                {
                    if (!this.ShortcutMap.ContainsKey(button))
                    {
                        this.ShortcutMap[button] = layer;
                    }
                }
            }
        }
Ejemplo n.º 19
0
        /*********
        ** Public methods
        *********/
        /// <summary>Construct an instance.</summary>
        /// <param name="config">The data layer settings.</param>
        /// <param name="mods">Handles access to the supported mod integrations.</param>
        public SprinklerLayer(LayerConfig config, ModIntegrations mods)
            : base(I18n.Sprinklers_Name(), config)
        {
            // init
            this.Mods   = mods;
            this.Legend = new[]
            {
                this.Wet = new LegendEntry(I18n.Keys.Sprinklers_Covered, Color.Green),
                this.Dry = new LegendEntry(I18n.Keys.Sprinklers_DryCrops, Color.Red)
            };

            // get search radius
            this.SearchRadius = 10;
            if (mods.BetterSprinklers.IsLoaded)
            {
                this.SearchRadius = Math.Max(this.SearchRadius, mods.BetterSprinklers.MaxRadius);
            }
            if (mods.LineSprinklers.IsLoaded)
            {
                this.SearchRadius = Math.Max(this.SearchRadius, mods.LineSprinklers.MaxRadius);
            }
        }
Ejemplo n.º 20
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 OnGameLaunched(object sender, GameLaunchedEventArgs e)
 {
     // init mod integrations
     this.Mods = new ModIntegrations(this.Monitor, this.Helper.ModRegistry, this.Helper.Reflection);
 }
Ejemplo n.º 21
0
        /// <summary>Get the enabled data layers.</summary>
        /// <param name="config">The mod configuration.</param>
        /// <param name="translation">Provides translations for the mod.</param>
        /// <param name="mods">Handles access to the supported mod integrations.</param>
        private IEnumerable <ILayer> GetLayers(ModConfig config, ITranslationHelper translation, ModIntegrations mods)
        {
            ModConfig.LayerConfigs layers = config.Layers;

            if (layers.Accessibility.IsEnabled())
            {
                yield return(new AccessibilityLayer(translation, layers.Accessibility));
            }
            if (layers.CoverageForBeeHouses.IsEnabled())
            {
                yield return(new BeeHouseLayer(translation, layers.CoverageForBeeHouses));
            }
            if (layers.CoverageForScarecrows.IsEnabled())
            {
                yield return(new ScarecrowLayer(translation, layers.CoverageForScarecrows, mods));
            }
            if (layers.CoverageForSprinklers.IsEnabled())
            {
                yield return(new SprinklerLayer(translation, layers.CoverageForSprinklers, mods));
            }
            if (layers.CoverageForJunimoHuts.IsEnabled())
            {
                yield return(new JunimoHutLayer(translation, layers.CoverageForJunimoHuts, mods));
            }
            if (layers.CropWater.IsEnabled())
            {
                yield return(new CropWaterLayer(translation, layers.CropWater));
            }
            if (layers.CropFertilizer.IsEnabled())
            {
                yield return(new CropFertilizerLayer(translation, layers.CropFertilizer));
            }
            if (layers.CropHarvest.IsEnabled())
            {
                yield return(new CropHarvestLayer(translation, layers.CropHarvest));
            }
        }
Ejemplo n.º 22
0
        /// <summary>Get the enabled data layers.</summary>
        /// <param name="config">The mod configuration.</param>
        /// <param name="translation">Provides translations for the mod.</param>
        /// <param name="mods">Handles access to the supported mod integrations.</param>
        private IEnumerable <ILayer> GetLayers(ModConfig config, ITranslationHelper translation, ModIntegrations mods)
        {
            ModConfig.LayerConfigs layers = config.Layers;

            if (layers.Accessible.IsEnabled())
            {
                yield return(new AccessibleLayer(translation, layers.Accessible));
            }
            if (layers.Buildable.IsEnabled())
            {
                yield return(new BuildableLayer(translation, layers.Buildable));
            }
            if (layers.CoverageForBeeHouses.IsEnabled())
            {
                yield return(new BeeHouseLayer(translation, layers.CoverageForBeeHouses, hasBeeHouseFlowerRangeFix: mods.HasMod("kirbylink.beehousefix")));
            }
            if (layers.CoverageForScarecrows.IsEnabled())
            {
                yield return(new ScarecrowLayer(translation, layers.CoverageForScarecrows, mods));
            }
            if (layers.CoverageForSprinklers.IsEnabled())
            {
                yield return(new SprinklerLayer(translation, layers.CoverageForSprinklers, mods));
            }
            if (layers.CoverageForJunimoHuts.IsEnabled())
            {
                yield return(new JunimoHutLayer(translation, layers.CoverageForJunimoHuts, mods));
            }
            if (layers.CropWater.IsEnabled())
            {
                yield return(new CropWaterLayer(translation, layers.CropWater));
            }
            if (layers.CropFertilizer.IsEnabled())
            {
                yield return(new CropFertilizerLayer(translation, layers.CropFertilizer));
            }
            if (layers.CropHarvest.IsEnabled())
            {
                yield return(new CropHarvestLayer(translation, layers.CropHarvest));
            }
            if (layers.Machines.IsEnabled() && mods.Automate.IsLoaded)
            {
                yield return(new MachineLayer(translation, layers.Machines, mods));
            }
            if (layers.Tillable.IsEnabled())
            {
                yield return(new TillableLayer(translation, layers.Tillable));
            }
        }
Ejemplo n.º 23
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 OnGameLaunched(object sender, GameLaunchedEventArgs e)
 {
     // init
     this.Mods   = new ModIntegrations(this.Monitor, this.Helper.ModRegistry, this.Helper.Reflection);
     this.Layers = this.GetLayers(this.Config, this.Helper.Translation, this.Mods).ToArray();
 }
Ejemplo n.º 24
0
        /// <summary>Get the enabled data layers.</summary>
        /// <param name="config">The mod configuration.</param>
        /// <param name="translation">Provides translations for the mod.</param>
        /// <param name="mods">Handles access to the supported mod integrations.</param>
        private IEnumerable <ILayer> GetLayers(ModConfig config, ITranslationHelper translation, ModIntegrations mods)
        {
            ModConfig.LayerConfigs layers = config.Layers;

            if (layers.Accessible.IsEnabled())
            {
                yield return(new AccessibleLayer(translation, layers.Accessible, this.Monitor));
            }
            if (layers.Buildable.IsEnabled())
            {
                yield return(new BuildableLayer(translation, layers.Buildable, this.Monitor));
            }
            if (layers.CoverageForBeeHouses.IsEnabled())
            {
                yield return(new BeeHouseLayer(translation, layers.CoverageForBeeHouses, this.Monitor));
            }
            if (layers.CoverageForScarecrows.IsEnabled())
            {
                yield return(new ScarecrowLayer(translation, layers.CoverageForScarecrows, mods, this.Monitor));
            }
            if (layers.CoverageForSprinklers.IsEnabled())
            {
                yield return(new SprinklerLayer(translation, layers.CoverageForSprinklers, mods, this.Monitor));
            }
            if (layers.CoverageForJunimoHuts.IsEnabled())
            {
                yield return(new JunimoHutLayer(translation, layers.CoverageForJunimoHuts, mods, this.Monitor));
            }
            if (layers.CropWater.IsEnabled())
            {
                yield return(new CropWaterLayer(translation, layers.CropWater, this.Monitor));
            }
            if (layers.CropPaddyWater.IsEnabled())
            {
                yield return(new CropPaddyWaterLayer(translation, layers.CropPaddyWater, this.Monitor));
            }
            if (layers.CropFertilizer.IsEnabled())
            {
                yield return(new CropFertilizerLayer(translation, layers.CropFertilizer, this.Monitor));
            }
            if (layers.CropHarvest.IsEnabled())
            {
                yield return(new CropHarvestLayer(translation, layers.CropHarvest, this.Monitor));
            }
            if (layers.Machines.IsEnabled() && mods.Automate.IsLoaded)
            {
                yield return(new MachineLayer(translation, layers.Machines, mods, this.Monitor));
            }
            if (layers.Tillable.IsEnabled())
            {
                yield return(new TillableLayer(translation, layers.Tillable, this.Monitor));
            }
        }