Пример #1
0
			public override bool Test(Sim a, ICatPrey target, bool isAutonomous,
				ref GreyedOutTooltipCallback greyedOutTooltipCallback)
			{
				if (a.SkillManager.GetSkillLevel(EWMedicineCatSkill.SkillNameID) < 1)
                {
					return false;
                }
				CatHuntingComponent catHuntingComponent = target.CatHuntingComponent;
				if (catHuntingComponent == null)
				{
					return false;
				}
				if(catHuntingComponent.mPreyData.mPreyType != PreyType.Rodent)
                {
					return false;
                }
				if (!catHuntingComponent.HasBeenCaught)
				{
					return false;
				}
				// TODO: Localize
				if (GetTreatableSims(a, target.InInventory ? a.LotCurrent : target.LotCurrent) == null)
				{
					greyedOutTooltipCallback = CreateTooltipCallback("Localize - No sims with fleas");
					return false;
				}
				if (catHuntingComponent.mHasBeenPresented)
				{
					greyedOutTooltipCallback = CreateTooltipCallback(LocalizeString(a.IsFemale, "AlreadyPresented"));
					return false;
				}
				return true;
			}
Пример #2
0
        private void DoExitWithPreyOutcomeEx()
        {
            ICatPrey   target = Target;
            IInsectJig jig    = Target as IInsectJig;

            if (jig != null)
            {
                DestroyPrey = true;
                target      = CatHuntingComponent.CreateTerrarium(jig.InsectType);
                if (target != null)
                {
                    target.SetPosition(Target.Position);
                    target.SetForward(Target.ForwardVector);
                    target.AddToWorld();
                    target.UpdateVisualState(CatHuntingComponent.CatHuntingModelState.Carried);
                    SetActor("prey", target);
                }
            }
            else
            {
                DestroyPrey = false;
            }
            if (target != null)
            {
                target.SetOpacity(1f, 0f);
                AnimateSim("Exit With Prey");
                if (target.CatHuntingComponent != null)
                {
                    target.CatHuntingComponent.SetCatcher(Actor);
                }

                Sim inventoryActor = Actor;

                if (!SimTypes.IsSelectable(Actor))
                {
                    SimDescription head = SimTypes.HeadOfFamily(Actor.Household);
                    if ((head != null) && (head.CreatedSim != null))
                    {
                        inventoryActor = head.CreatedSim;
                    }
                }

                // Custom
                if (inventoryActor.Inventory.TryToAdd(target, false))
                {
                    target.UpdateVisualState(CatHuntingComponent.CatHuntingModelState.InInventory);

                    // Custom
                    StoryProgression.Main.Skills.Notify("CatchPrey", Actor, CatHuntingComponent.LocalizeString(Actor.IsFemale, "CatchPreySuccess", new object[] { Actor, Target.GetLocalizedName() }));

                    foreach (Sim sim in Actor.Household.Sims)
                    {
                        EventTracker.SendEvent(new Event(EventTypeId.kArkBuilder, sim, Target));
                    }

                    if (SimTypes.IsSelectable(Actor))
                    {
                        TryPushPresentTo(target);
                    }
                }
                else
                {
                    if (jig != null)
                    {
                        target.Destroy();
                    }
                    DestroyPrey = true;
                }
            }
            else
            {
                DoPreyGoneOutcome();
            }
        }