Beispiel #1
0
            public override bool Test(IActor a, GameObject target, bool isAutonomous, ref GreyedOutTooltipCallback greyedOutTooltipCallback)
            {
                if (!base.Test(a, target, isAutonomous, ref greyedOutTooltipCallback))
                {
                    return(false);
                }

                IHarvestable plant = target as IHarvestable;

                if (plant == null)
                {
                    return(false);
                }

                if (!plant.IsSeed)
                {
                    return(false);
                }

                PlantableComponent component = target.GetComponent <PlantableComponent>();

                if (component == null)
                {
                    return(false);
                }

                return(component.PlayerKnowledgeOfPlantableType == PlayerDisclosure.Concealed);
            }
Beispiel #2
0
        public void Planted(Plant plant)
        {
            mNumberPlanted++;
            PlantableComponent plantable = plant.Seed.Plantable;
            string             plantName = plantable.PlantDef.PlantName;

            if (mPlantsPlanted == null)
            {
                mPlantsPlanted = new List <string>();
            }
            if (!mPlantsPlanted.Contains(plantName))
            {
                mPlantsPlanted.Add(plantName);
            }
            if (plantable.PlayerKnowledgeOfPlantableType == PlayerDisclosure.Concealed)
            {
                mUnknownSeedsPlanted++;
            }
            else
            {
                if (mHarvestCounts == null)
                {
                    mHarvestCounts = new Dictionary <string, PlantInfo>();
                }
                if (!mHarvestCounts.ContainsKey(plantName))
                {
                    mHarvestCounts.Add(plantName, new PlantInfo());
                }
            }
        }
Beispiel #3
0
            protected static bool BaseCommonPlantingTest(Sim a, GameObject target, Lot lotTryingToPlantingOn, ref GreyedOutTooltipCallback greyedOutTooltipCallback)
            {
                if (!PlantableComponent.PlantInteractionOpportunityTest(a, target))
                {
                    greyedOutTooltipCallback = Common.DebugTooltip("PlantInteractionOpportunityTest");
                    return(false);
                }

                if (CameraController.IsMapViewModeEnabled())
                {
                    greyedOutTooltipCallback = new GreyedOutTooltipCallback(PlantObject.MapViewGreyedTooltip);
                    return(false);
                }

                /*
                 * if (!PlantingLotTest(lotTryingToPlantingOn, a))
                 * {
                 *  greyedOutTooltipCallback = new GreyedOutTooltipCallback(PlantObject.CanOnlyPlantOnHomeLot);
                 *  return false;
                 * }
                 */
                if (!PlantableComponent.PlantInteractionGardeningSkillTest(a, target, ref greyedOutTooltipCallback))
                {
                    greyedOutTooltipCallback = Common.DebugTooltip("PlantInteractionGardeningSkillTest");
                    return(false);
                }
                return(true);
            }
            public override bool Test(Sim a, GameObject target, bool isAutonomous, ref GreyedOutTooltipCallback greyedOutTooltipCallback)
            {
                if (!a.SkillManager.HasElement(EWHerbLoreSkill.SkillNameID))
                {
                    return(false);
                }
                PlantableComponent plantable = target.Plantable;

                if (plantable == null)
                {
                    return(false);
                }
                if (plantable.PlantDef == null)
                {
                    return(false);
                }
                if (plantable.PlantDef.LimitedAvailability)
                {
                    return(false);
                }
                ITreasureSpawnableObject treasureSpawnableObject = target as ITreasureSpawnableObject;

                if (treasureSpawnableObject != null && treasureSpawnableObject.IsOnSpawner)
                {
                    return(false);
                }
                return(!target.InUse && CarrySystem.CouldPickUp(target as ICarryable));
            }
Beispiel #5
0
        public override bool Run()
        {
            try
            {
                PlantableComponent component = Target.GetComponent <PlantableComponent>();
                if (component == null)
                {
                    return(false);
                }

                component.PlayerKnowledgeOfPlantableType = PlayerDisclosure.Exposed;
            }
            catch (Exception e)
            {
                Common.Exception(Actor, Target, e);
            }
            return(true);
        }
Beispiel #6
0
		public static bool CommonPlantingTest(Sim a, GameObject target, Lot lotTryingToPlantingOn, ref GreyedOutTooltipCallback greyedOutTooltipCallback)
		{
			if (!PlantableComponent.PlantInteractionOpportunityTest(a, target))
			{
				return false;
			}
			if (CameraController.IsMapViewModeEnabled())
			{
				greyedOutTooltipCallback = new GreyedOutTooltipCallback(MapViewGreyedTooltip);
				return false;
			}
			if (!PlantingLotTest(lotTryingToPlantingOn, a))
			{
				greyedOutTooltipCallback = new GreyedOutTooltipCallback(CanOnlyPlantOnHomeLot);
				return false;
			}
			if (!a.IsCat)  // TODO: Skill test
			{
				return false;
			}
			return true;
		}
Beispiel #7
0
            public override bool Test(Sim a, GameObject target, bool isAutonomous, ref GreyedOutTooltipCallback greyedOutTooltipCallback)
            {
                if (target.InUse)
                {
                    greyedOutTooltipCallback = Common.DebugTooltip("InUse");
                    return(false);
                }

                PlantableComponent plantable = target.Plantable;

                if ((plantable == null) || plantable.InSeedSpawner)
                {
                    greyedOutTooltipCallback = Common.DebugTooltip("InSeedSpawner");
                    return(false);
                }

                /*
                 * TerrainType type = (TerrainType)World.GetTerrainType(target.Position.x, target.Position.z, 0x0);
                 * if ((type != TerrainType.LotTerrain) && (type != TerrainType.WorldTerrain))
                 * {
                 *  return false;
                 * }
                 */
                if (target.Parent != null)
                {
                    greyedOutTooltipCallback = Common.DebugTooltip("Parent");
                    return(false);
                }

                /*
                 * else if (!target.IsOutside)
                 * {
                 *  return false;
                 * }
                 */
                else if (!BaseCommonPlantingTest(a, target, target.LotCurrent, ref greyedOutTooltipCallback))
                {
                    return(false);
                }

                bool flag = true;

                /*
                 * Soil soilToPlace = GlobalFunctions.CreateObjectOutOfWorld("GardenSoil") as Soil;
                 * if (soilToPlace == null)
                 * {
                 *  greyedOutTooltipCallback = Common.DebugTooltip("GardenSoil");
                 *  return false;
                 * }
                 *
                 * soilToPlace.AddToWorld();
                 * soilToPlace.Ghost();
                 * flag = PlantObjectHere.CanPlaceSoil(a, target, soilToPlace);
                 * soilToPlace.Destroy();
                 *
                 * if (!flag)
                 * {
                 *  greyedOutTooltipCallback = Common.DebugTooltip("CanPlaceSoil");
                 * }
                 */
                return(flag);
            }