Ejemplo n.º 1
0
 internal static bool AttemptPlanting(Vector2 grabTile, GameLocation location, Farmer who = null)
 {
     if (CaveCarrotSeed.canPlaceHere(location, grabTile))
     {
         try
         {
             location.terrainFeatures.Remove(grabTile);
             int  X                  = (int)grabTile.X;
             int  Y                  = (int)grabTile.Y;
             int  seedIndex          = CaveCarrotSeed.getIndex();
             bool isReallyGreenhouse = location.isGreenhouse.Value;
             location.isGreenhouse.Value = true;
             HoeDirt dirtPatch = new HoeDirt(0, location);
             location.terrainFeatures.Add(grabTile, (TerrainFeature)dirtPatch);
             bool planted2 = dirtPatch.plant(seedIndex, X, Y, Game1.player, false, location);
             location.isGreenhouse.Value = isReallyGreenhouse;
             return(true);
         } catch
         {
             return(false);
         }
     }
     else
     {
         if (!IsValidLocation(location))
         {
             Game1.showRedMessage("This plant would not thrive here.");
         }
         return(false);
     }
 }