Exemplo n.º 1
0
        /// <summary>
        /// Smash Pond, make Well with the same contents and data
        /// </summary>
        /// <param name="pondTile"></param>
        private void ConvertPondToWell(Vector2 pondTile)
        {
            Farm     farm    = Game1.getLocationFromName("Farm") as Farm;
            FishPond oldPond = (FishPond)farm.getBuildingAt(pondTile);
            FishWell NewWell = new FishWell(new BluePrint("Fish Well"), Vector2.Zero);

            this.Monitor.Log($"Pond -> Well conversion at {pondTile}.", LogLevel.Trace);
            ReplacePondData(oldPond, NewWell);
            NewWell.Config = Config;
            bool destroyed = farm.destroyStructure(oldPond);
            bool built     = farm.buildStructure(NewWell, pondTile, Game1.player, true);

            NewWell.performActionOnBuildingPlacement();
            NewWell.ApplyPopulationCap();
            NewWell.resetTexture();
        }
Exemplo n.º 2
0
        /// <summary>
        /// Create dummy blueprint, building for the build menu.
        /// Find 3x3 Fish Ponds on the Farm and convert them into Fish Wells.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void OnDayStarted(object sender, DayStartedEventArgs e)
        {
            wellBlueprint = fishWellBlueprint();
            dummyFishWell = new FishWell(new BluePrint("Fish Well"), Vector2.Zero);
            List <Vector2> tilesWithPonds = new List <Vector2>();

            if (Context.IsMainPlayer)
            {
                foreach (Building building in Game1.getFarm().buildings)
                {
                    if (building.buildingType.Value == "Fish Pond" && building.tilesWide.Value == 3)
                    {
                        tilesWithPonds.Add(new Vector2(building.tileX, building.tileY));
                    }
                }
                tilesWithPonds.ForEach(ConvertPondToWell);
            }
        }
 /// <summary>
 /// Adjusted initial shadow placement
 /// </summary>
 /// <param name="pond"></param>
 public WellFishSilhouette(FishWell pond, float bWidth)
     : base(pond)
 {
     _pond        = pond;
     _fishObject  = _pond.GetFishObject();
     border_width = bWidth;
     if (_fishObject.HasContextTag("fish_upright"))
     {
         _upRight = true;
     }
     position = new Vector2(
         _pond.tileX.Value + Utility.Lerp(border_width + 0.2f, (float)_pond.tilesWide - border_width - 0.2f, (float)Game1.random.NextDouble()),
         _pond.tileY.Value + Utility.Lerp(border_width + 0.2f, (float)_pond.tilesHigh - border_width - 0.2f, (float)Game1.random.NextDouble())
         ) * 64f;
     _age          = 0f;
     _randomOffset = Utility.Lerp(0f, 500f, (float)Game1.random.NextDouble());
     ResetDartTime();
 }