Пример #1
0
 public string LoadVegetationParameter(Guid datasetid, string dataname, bool isLAI, string paramName, string value)
 {
     try
     {
         if (Crops == null || Crops.Count == 0)
         {
             Crops = new List <_CustomCropInputsModel>();
         }
         var crop = Crops.FirstOrDefault(x => x.Id == datasetid);
         if (crop == null)
         {
             if (isLAI)
             {
                 crop = new HowLeakyInputs_LAIVeg(datasetid, dataname);
             }
             else
             {
                 crop = new HowLeakyInputs_CoverVeg(datasetid, dataname);
             }
             Crops.Add(crop);
         }
         if (TryLoadParameter(crop, paramName, value) == false)
         {
             return(paramName);
         }
     }
     catch (Exception ex)
     {
         throw ErrorLogger.CreateException(ex);
     }
     return(null);
 }
Пример #2
0
        /// <summary>
        /// Registers a new crop
        /// </summary>
        /// <param name="crop">Information of crop to register</param>
        public static void RegisterCrop <T>(CropInformation crop)
        {
            if (Game1.cropSpriteSheet == null)
            {
                throw new Exception("objectInformation is null! This likely occurs if you try to register a crop before AfterContentLoaded");
            }

            crop.Id = Farmhand.API.Content.ContentManager.Load <Dictionary <int, string> >("Data\\Crops").Count() + 1;

            Crops.Add(crop.Seed, crop);
            TextureUtility.AddSpriteToSpritesheet(ref Game1.cropSpriteSheet, crop.Texture, crop.Id, 128, 32);
            RegisteredTypeInformation[typeof(T)] = crop;
        }
Пример #3
0
        /// <summary>
        /// Initializes the crops added when planting this seed
        /// </summary>
        public void InitializeCrops()
        {
            Random rnd = new Random((int)DateTime.Now.Ticks.GetHashCode());

            //TODO: this will be used when extracting seeds from the finished crop
            //int extraCropChance = 0;
            //extraCropChance += (int)SeedQuality;
            //if (rnd.Next(extraCropChance, 100) == extraCropChance)
            //  _cropRate++;

            int cropsToGrow = _cropRate;

            cropsToGrow += rnd.Next(-2, 2);

            for (int i = 0; i < cropsToGrow; i++)
            {
                double num       = rnd.Next(-10, 10);
                double newWeight = ((double)((num / 100) * -(int)SeedQuality) * ParentCrop.EndWeight) + ParentCrop.EndWeight;
                Crops.Add(new Crop(Name, newWeight, this));
            }
        }
Пример #4
0
        public override void CreateDefaultConfiguration()
        {
            SimpleMachines = new List <MachineInformation>
            {
                GetMill(),
                GetVinegarJug(),
                GetDryingRack(),
            };

            Tank      = GetTank();
            Mixer     = GetMixer();
            Fermenter = GetFermenter();
            Churn     = GetChurn();
            Separator = GetSeparator();

            ItemOverrides = new List <ItemInformation>
            {
                new ItemInformation
                {
                    ID          = ItemID.WheatFlour,
                    Name        = "Flour",
                    Description = "A common cooking ingredient made from crushed seeds.",
                }
            };

            Items = new List <ItemInformation>
            {
                GetMead(),
                GetVodka(),
                GetColorJuice(),
                GetColorWine(),
                GetCactusSeed(),
                GetColorJelly(),
                GetColorPickles(),
                GetExperementalLiquid(),
                GetPreservedMushrooms(),
                GetBlackRaisins(),
                GetDriedFruits(),
                GetBlackRisinsMaffin(),
                GetSake(),
                GetSourCream(),
                GetButter(),
            };
            Totems = GetWarpTotems();

            MachineOverrides = new List <OverridedMachineInformation>
            {
                GetKegOverride(),
                GetPreserveJarOverride(),
                GetCharcoalKilnOverride(),
                GetLoomOverride(),
                GetOilMakerOverride(),
                GetRecyclingMachineOverride(),
            };

            LocalizationStrings = new Dictionary <LocalizationString, string>
            {
                { LocalizationString.TankRequiresWater, "Fill with water first" },
            };

            Crops.Add(GetCactusCrop());
            GiftPreferences.AddRange(GetGiftPreferences());
            Bundles = GetBundleInformation();

            CookingRecipes.Add(new CookingRecipeInformation(GetBlackRisinsMaffin(),
                                                            new IngredientInfo(BlackRaisinsID, 1),
                                                            new IngredientInfo(ItemID.Sugar, 1),
                                                            new IngredientInfo(ItemID.WheatFlour, 1)));
        }