Example #1
0
            public override void Init(AlienAbductionSituationEx parent)
            {
                CarUFO ufo = parent.Alien.Inventory.Find <CarUFO>();

                if (ufo == null)
                {
                    parent.CleanupAbduction();
                    return;
                }

                CarUFO.AbductSimA abductSim = ForceSituationSpecificInteraction(ufo, parent.Alien,
                                                                                CarUFO.AbductSimA.Singleton, null, new Callback(OnCompletion), new Callback(OnFailure),
                                                                                new InteractionPriority(InteractionPriorityLevel.CriticalNPCBehavior)) as CarUFO.AbductSimA;
                abductSim.SimToAbduct = parent.Abductee;
            }
Example #2
0
        public static bool Run(CarUFO.AbductSimA ths)
        {
            if (ths.Target.InUse)
            {
                return(false);
            }

            ths.mNPCAbductor = (ths.SimToAbduct != null);

            if (!ths.mNPCAbductor)
            {
                ths.SimToAbduct = ths.GetSelectedObject() as Sim;
            }

            if (ths.SimToAbduct == null)
            {
                return(false);
            }

            ths.StandardEntry();

            if (!ths.SetupAbductee())
            {
                ths.StandardExit();
                return(false);
            }

            Animation.ForceAnimation(ths.Actor.ObjectId, true);
            Animation.ForceAnimation(ths.Target.ObjectId, true);
            ths.Target.mTakeOffPos = ths.Actor.Position;

            if (!ths.Target.RouteToUFOAndTakeOff(ths.Actor))
            {
                ths.StandardExit();
                return(false);
            }

            Camera.FocusOnGivenPosition(ths.mJig.Position, CarUFO.kAbductLerpParams, true);
            ths.BeginCommodityUpdates();
            bool flag = ths.AbductSim();

            ths.EndCommodityUpdates(true);
            Sim[] sims;

            if (flag)
            {
                EventTracker.SendEvent(EventTypeId.kAbductSimUFO, ths.Actor, ths.SimToAbduct);
                sims = new Sim[] { ths.Actor, ths.SimToAbduct };

                if (ths.mNPCAbductor)
                {
                    ths.DoTimedLoop(AlienUtils.kAbductionLength, ExitReason.None);
                }
            }
            else
            {
                sims = new Sim[] { ths.Actor };
            }

            DateAndTime previous   = SimClock.CurrentTime();
            Vector3     landRefPos = ths.GetLandingRefPos(ths.mNPCAbductor);

            while (!ths.Target.TryLandUFOAndExitSims(sims, landRefPos, true))
            {
                Simulator.Sleep(30u);

                if (SimClock.ElapsedTime(TimeUnit.Minutes, previous) > 30f)
                {
                    ths.Target.ForceExitUFODueToLandingFailure(sims);
                    break;
                }
            }

            ths.mFromInventory = (ths.mFromInventory || ths.mNPCAbductor);

            if (ths.mFromInventory)
            {
                ths.mFromInventory = ths.Actor.Inventory.TryToAdd(ths.Target);
            }

            if (!ths.mFromInventory)
            {
                ths.Target.ParkUFO(ths.Actor.LotHome, ths.Actor);
            }

            if (flag)
            {
                if (ths.mNPCAbductor)
                {
                    if (AlienUtilsEx.IsImpregnationSuccessful(ths.SimToAbduct, ths.Actor))
                    {
                        ths.SimToAbduct.SimDescription.Pregnancy = new Pregnancy(ths.SimToAbduct, ths.Actor.SimDescription);
                        ths.SimToAbduct.TraitManager.AddHiddenElement(AlienUtilsEx.sAlienPregnancy);
                    }

                    ths.SimToAbduct.BuffManager.AddElement(BuffNames.Abducted, Origin.FromAbduction);
                    ThoughtBalloonManager.BalloonData data = new ThoughtBalloonManager.BalloonData(ths.Actor.GetThumbnailKey());
                    data.BalloonType = ThoughtBalloonTypes.kThoughtBalloon;
                    data.LowAxis     = ThoughtBalloonAxis.kDislike;
                    data.Duration    = ThoughtBalloonDuration.Medium;
                    data.mPriority   = ThoughtBalloonPriority.High;
                    ths.SimToAbduct.ThoughtBalloonManager.ShowBalloon(data);
                    ths.SimToAbduct.PlayReaction(AlienUtils.kAbductionReactions[RandomUtil.GetInt(0, AlienUtils.kAbductionReactions.Length - 1)], ReactionSpeed.NowOrLater);
                    ths.SimToAbduct.ShowTNSIfSelectable(CarUFO.LocalizeString(ths.SimToAbduct.IsFemale, "NPCAbductionTNS", new object[] { ths.SimToAbduct.ObjectId }),
                                                        StyledNotification.NotificationStyle.kGameMessagePositive, ObjectGuid.InvalidObjectGuid, ths.SimToAbduct.ObjectId);
                }
                else
                {
                    Sim.ForceSocial(ths.Actor, ths.SimToAbduct, "Reveal Prank", InteractionPriorityLevel.High, true);
                }

                ths.FinishLinkedInteraction(true);
            }

            ths.StandardExit();

            if (flag)
            {
                ths.WaitForSyncComplete();
            }

            return(flag);
        }