コード例 #1
0
        private void DoSimpleSprinklers()
        {
            if (SimpleSprinklerLoaded)
            {
                //Lets load up the integration from Simple Sprinklers
                SimpleSprinklerIntegration   ssi       = new SimpleSprinklerIntegration(this.Helper.ModRegistry, this.Monitor);
                IDictionary <int, Vector2[]> ssi_tiles = ssi.GetNewSprinklerTiles();
                sprinkler         = new List <Vector2>();
                quality_sprinkler = new List <Vector2>();
                iridium_sprinkler = new List <Vector2>();

                foreach (KeyValuePair <int, Vector2[]> tiles in ssi_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]);
                            }
                        }
                    }
                }
            }
        }
コード例 #2
0
ファイル: SprinklerMap.cs プロジェクト: pedronc1/StardewMods
        /// <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))