示例#1
0
        /// <summary>
        /// Smash Well, make (3x3) Pond with the same contents and data
        /// </summary>
        /// <param name="pondTile"></param>
        private void ConvertWellToPond(Vector2 pondTile)
        {
            Farm     farm    = Game1.getLocationFromName("Farm") as Farm;
            FishPond oldWell = (FishPond)farm.getBuildingAt(pondTile);
            FishPond NewPond = new FishPond(new BluePrint("Fish Pond"), Vector2.Zero);

            this.Monitor.Log($"Well -> Pond conversion at {pondTile}.", LogLevel.Trace);
            ReplacePondData(oldWell, NewPond);
            NewPond.tilesWide.Value = 3;
            NewPond.tilesHigh.Value = 3;
            bool destroyed = farm.destroyStructure(oldWell);
            bool built     = farm.buildStructure(NewPond, pondTile, Game1.player, true);

            NewPond.performActionOnBuildingPlacement();
            NewPond.UpdateMaximumOccupancy();
        }
示例#2
0
 private void AddFishToPond(FishPond pond, SObject o)
 {
     // We don't want to call the game's addFishToPond because it requires a farmer object and
     //   1) reduces the currently selected item of the farmer by 1
     //   2) tries to show the throwing animation into the pond
     // These are problems because we want to stealthily add items on day start.
     // To counter this, instead of calling that single function via reflection, we
     //   try to mimic most of what that function does, reflecting whenever necessary
     if (pond.currentOccupants == 0)
     {
         pond.fishType.Value = o.ParentSheetIndex;
         Helper.Reflection.GetField <FishPondData>(pond, "_fishPondData").SetValue(null);
         pond.UpdateMaximumOccupancy();
     }
     pond.currentOccupants.Value++;
 }