Exemplo n.º 1
0
        public static TillSoilJob FindTillSoilJobForSeed(FarmManager farmManager, Character character)
        {
            TillSoilJob tillSoilJob = farmManager.FindTillSoilJob(character);

            if (tillSoilJob == null)
            {
                return(null);
            }
            Vector3     position    = tillSoilJob.Position;
            Map         map         = GnomanEmpire.Instance.Map;
            MapCell     cell        = map.GetCell(position);
            Designation designation = cell.Designation;
            Farm        farm        = designation as Farm;

            if (farm != null)
            {
                int          seedMaterial = farm.SeedMaterial;
                StockManager stockManager = GnomanEmpire.Instance.Fortress.StockManager;
                if (stockManager.FindClosestItem(position, ItemID.Seed, seedMaterial) != null)
                {
                    return(tillSoilJob);
                }
            }
            tillSoilJob.Cancel();
            return(null);
        }
Exemplo n.º 2
0
        public static bool ImprovedFarming(Character character, out bool returnValue)
        {
            if (character.Mind.IsSkillAllowed(CharacterSkillType.Farming))
            {
                FarmManager farmManager = GnomanEmpire.Instance.Fortress.FarmManager;

                Job job = farmManager.FindPlantSeedJob(character);
                if (job != null)
                {
                    JobField.SetValue(character, job);
                    job.Claim(character);
                    returnValue = true;
                    return(true);
                }

                job = FindTillSoilJobForSeed(farmManager, character);
                if (job != null)
                {
                    JobField.SetValue(character, job);
                    job.Claim(character);
                    returnValue = true;
                    return(true);
                }

                job = farmManager.FindHarvestJob(character);
                if (job != null)
                {
                    JobField.SetValue(character, job);
                    job.Claim(character);
                    returnValue = true;
                    return(true);
                }

                job = farmManager.FindTillSoilJob(character);
                if (job != null)
                {
                    JobField.SetValue(character, job);
                    job.Claim(character);
                    returnValue = true;
                    return(true);
                }
            }
            returnValue = false;
            return(true);
        }
Exemplo n.º 3
0
 public static TillSoilJob FindTillSoilJobForSeed(FarmManager farmManager, Character character)
 {
     TillSoilJob tillSoilJob = farmManager.FindTillSoilJob(character);
     if (tillSoilJob == null)
     {
         return null;
     }
     Vector3 position = tillSoilJob.Position;
     Map map = GnomanEmpire.Instance.Map;
     MapCell cell = map.GetCell(position);
     Designation designation = cell.Designation;
     Farm farm = designation as Farm;
     if (farm != null)
     {
         int seedMaterial = farm.SeedMaterial;
         StockManager stockManager = GnomanEmpire.Instance.Fortress.StockManager;
         if (stockManager.FindClosestItem(position, ItemID.Seed, seedMaterial) != null)
         {
             return tillSoilJob;
         }
     }
     tillSoilJob.Cancel();
     return null;
 }