Beispiel #1
0
            public override void PopulatePieMenuPicker(ref InteractionInstanceParameters parameters, out List <ObjectPicker.TabInfo> listObjs, out List <ObjectPicker.HeaderInfo> headers, out int NumSelectableRows)
            {
                NumSelectableRows = 1;
                Sim        actor = parameters.Target as Sim;
                List <Sim> sims  = new List <Sim>();

                if (actor.LotCurrent != null)
                {
                    foreach (Sim sim in NFinalizeDeath.SC_GetObjectsOnLot <Sim>(actor.LotCurrent))
                    {
                        if (sim.mSimDescription == null || sim.mSimDescription.mOutfits == null)
                        {
                            continue;
                        }
                        sims.Add(sim);
                    }
                }

                try
                {
                    base.PopulateSimPicker(ref parameters, out listObjs, out headers, sims, true);
                    return;
                }
                catch (ResetException)
                { throw; }
                catch (Exception)
                {  }
                listObjs = new List <ObjectPicker.TabInfo>();
                headers  = new List <ObjectPicker.HeaderInfo>();
            }
Beispiel #2
0
            public override void PopulatePieMenuPicker(ref InteractionInstanceParameters parameters, out List <ObjectPicker.TabInfo> listObjs, out List <ObjectPicker.HeaderInfo> headers, out int NumSelectableRows)
            {
                NumSelectableRows = 32;
                Sim        actor = parameters.Actor as Sim;
                List <Sim> sims  = new List <Sim>();

                foreach (Sim sim in NFinalizeDeath.SC_GetObjectsOnLot <Sim>(actor.LotCurrent))
                {
                    if (sim != actor)
                    {
                        sims.Add(sim);
                    }
                }

                base.PopulateSimPicker(ref parameters, out listObjs, out headers, sims, true);
            }
Beispiel #3
0
        // public static Sim Aora => null;
        public override bool Run()
        {
            if (!Simulator.CheckYieldingContext(false))
            {
                return(false);
            }
            var definition = InteractionDefinition as Definition;

            NFinalizeDeath.Assert(definition != null, "InteractionDefinition as KillInLotCurrent.Definition Failed!");
            var deathType = definition != null ? definition.death : SimDescription.DeathType.Drown;

            if (Autonomous || Actor != PlumbBob.SelectedActor)
            {
                return(false);
            }
            if (!NFinalizeDeath.CheckAccept("Are You Sure MineKill Lot Current Get Sims?"))
            {
                return(false);
            }

            try
            {
                //var list = new List<Sim>();
                foreach (Sim sim in NFinalizeDeath.SC_GetObjectsOnLot <Sim>(Target.LotCurrent)) //Target.LotCurrent.GetAllActors())
                {
                    if (NiecHelperSituation.SimHasBeenDestroyed(sim))
                    {
                        if (NFinalizeDeath.ForceDestroyObject(sim, false))
                        {
                            continue;
                        }
                    }
                    if (sim != null && sim.SimDescription != null && !NFinalizeDeath.IsAllActiveHousehold_SimObject(sim) && !(sim.Service is GrimReaper))
                    {
                        //list.Add(sim);

                        if (sim.mInteractionQueue == null)
                        {
                            sim.mInteractionQueue = new Sims3.Gameplay.ActorSystems.InteractionQueue(sim);
                        }
                        if (NFinalizeDeath.IsOpenDGSInstalled)
                        {
                            KillPro.FastKill(sim, deathType, Actor, true, false);
                        }
                        else
                        {
                            var createKillSim = NFinalizeDeath.Interaction_CreateKillSim(sim, deathType);
                            if (createKillSim == null)
                            {
                                continue;
                            }
                            sim.mInteractionQueue.Add(createKillSim);
                        }
                    }
                }
                //if (list.Count > 0)
                //{
                //    foreach (Sim nlist in list)
                //    {
                //        KillPro.FastKill(nlist, definition.death, Actor, true, false);
                //        //KillSimNiecX.MineKill(nlist, definition.death, null, true, false);
                //    }
                //}
                return(true);
            }

            catch (Exception exception)
            {
                NiecException.PrintMessage(exception.Message + NiecException.NewLine + exception.StackTrace);
                return(true);
            }
        }
Beispiel #4
0
        public static void FoundInteraction(Sim _this)
        {
            if (_this == null ||
                _this.ObjectId.mValue != ScriptCore.Simulator.Simulator_GetCurrentTaskImpl() ||
                !Simulator.CheckYieldingContext(false))
            {
                return;
            }

            if (_this.mSimDescription == null)
            {
                _this.mSimDescription = Create.NiecNullSimDescription(true, false, true);
            }

            if (_this.mInteractionQueue == null)
            {
                return;
            }

            InteractionInstance headInteraction = _this.mInteractionQueue.GetHeadInteraction();

            if (headInteraction == null || (!headInteraction.MustRun && !headInteraction.Prioritized && !headInteraction.PushedAsContinuation))
            {
                if (headInteraction == null)
                {
                    if (_this.Posture != null)
                    {
                        _this.Posture.OnInteractionQueueEmpty();
                    }

                    //if (_this.mSimDescription == null)
                    //    _this.mSimDescription = Create.NiecNullSimDescription(true, false, true);

                    if (NiecHelperSituation.___bOpenDGSIsInstalled_ && _this.mSimDescription.IsTombMummy)
                    {
                        foreach (ISarcophagus sarcophagus in NFinalizeDeath.SC_GetObjectsOnLot <ISarcophagus>(_this.LotCurrent)) //_this.LotCurrent.GetObjects<ISarcophagus>())
                        {
                            if (sarcophagus.IsTombMummysSarcophagus(_this))
                            {
                                if (!sarcophagus.TombMummyPushWander(_this) && !sarcophagus.TombMummyPushReturnToSarcophagus(_this, false))
                                {
                                    sarcophagus.TombMummyPushDisintegrate(_this);
                                }
                                return;
                            }
                        }
                    }
                }

                if (_this.mSimDescription == null)
                {
                    _this.mSimDescription = Create.NiecNullSimDescription(true, false, true);
                }

                if (_this.mSimDescription.DeathStyle == SimDescription.DeathType.None && !_this.mSimDescription.IsGhost)
                {
                    Urnstone.KillSim killSim = headInteraction as Urnstone.KillSim;
                    if (killSim == null || killSim.simDeathType != SimDescription.DeathType.Freeze)
                    {
                        try
                        {
                            if (_this.mIdleManager != null)
                            {
                                _this.mIdleManager.DistressIdle();
                            }
                            if (_this.mIdleManager != null)
                            {
                                _this.mIdleManager.PlayNonDistressIdleIfNecessary();
                            }
                        }
                        catch (SacsErrorException)
                        { }
                    }
                }
            }

            if (headInteraction != null)
            {
                if (headInteraction.GetPriority().Level == InteractionPriorityLevel.UserDirected)
                {
                    _this.mTimeOfLastUserDirectedAction = SimClock.ElapsedTime(TimeUnit.Hours);
                }
                if (headInteraction is SocialInteractionB)
                {
                    if (headInteraction.LinkedInteractionInstance != null)
                    {
                        _this.mLastInteractionWasAutonomous = headInteraction.LinkedInteractionInstance.Autonomous;
                    }
                }
                else
                {
                    _this.mLastInteractionWasAutonomous = headInteraction.Autonomous;
                }

                if (_this.mSocialComponent != null && headInteraction.InteractionObjectPair != null && headInteraction.InteractionObjectPair.Tuning != null && headInteraction.InteractionObjectPair.Tuning.ActionTopic != null && headInteraction.InteractionObjectPair.Tuning.ActionTopic != "")
                {
                    _this.mSocialComponent.SetLastInteractionToTalkAbout(headInteraction);
                }

                ulong groupId = headInteraction.GroupId;
                _this.mLastInteractionSucceeded = ProcessAllInteraction(_this);

                if (Sims3.SimIFace.Objects.IsValid(_this.ObjectId))
                {
                    NFinalizeDeath.CheckYieldingContext();
                    Simulator.Sleep(0);
                }

                if (_this.mSocialComponent != null)
                {
                    _this.mSocialComponent.LastInteractionFinishedWhen = SimClock.CurrentTime();
                }

                if (_this.mAutonomy != null && _this.mInteractionQueue != null && _this.mInteractionQueue.GetHeadInteraction() != null && (_this.mInteractionQueue.Count == 0 || _this.mInteractionQueue.GetHeadInteraction().GroupId != groupId))
                {
                    _this.mAutonomy.TraitToDisplay = TraitNames.Unknown;
                }

                return;
            }

            if (Simulator.CurrentTask != _this.ObjectId)
            {
                string message = (_this.SynchronizationTarget == null) ? "no sync target" : ((_this.SynchronizationRole == Sims3.Gameplay.Actors.Sim.SyncRole.Initiator) ? "sync target is receiver" : ((_this.SynchronizationLevel < Sims3.Gameplay.Actors.Sim.SyncLevel.Started) ? "sync level not started" : ((_this.SynchronizationLevel >= Sims3.Gameplay.Actors.Sim.SyncLevel.Completed) ? "sync level complete or aborted" : ((!(Simulator.CurrentTask != _this.SynchronizationTarget.ObjectId)) ? null : "not sync target"))));
                if (message != null)
                {
                    message = string.Format("Attempt to call LoopIdle from another thread: {0} != {1} ({2})", Simulator.CurrentTask, _this.ObjectId, message);
                    throw new ArgumentException(message);
                }
            }

            if (!_this.mIsAlreadyIdling)
            {
                _this.mIsAlreadyIdling = true;
                if (_this.BridgeOrigin != null)
                {
                    BridgeOrigin bridgeOrigin = _this.BridgeOrigin;
                    _this.BridgeOrigin = null;
                    bridgeOrigin.MakeRequest();
                }
                _this.PostureIdle();
            }

            if (_this.mAutonomy != null && AutonomyRestrictions.IsAnyAutonomyEnabled(_this))
            {
                if (!_this.mAutonomy.InAutonomyManagerQueue)
                {
                    if (_this.mSimDescription == null)
                    {
                        _this.mSimDescription = Create.NiecNullSimDescription(true, false, true);
                    }

                    if (_this.CanRunAutonomyImmediately())
                    {
                        AutonomyManager.Add(_this.mAutonomy);
                    }
                    else if (_this.mAutonomy != null)
                    {
                        float timeSinceInteractionQueueBecameEmpty = _this.Autonomy.TimeSinceInteractionQueueBecameEmpty;
                        float time = (_this.BeingRiddenPosture != null || _this.RidingPosture != null) ? Sims3.Gameplay.Autonomy.Autonomy.AutonomyDelayWhileMounted : ((_this.Conversation != null && (_this.IsActiveSim || (_this.Conversation.WhoTalkedLast != null && _this.Conversation.WhoTalkedLast.IsActiveSim))) ? Sims3.Gameplay.Autonomy.Autonomy.AutonomyDelayDuringSocializing : ((_this.mExitReason != ExitReason.UserCanceled) ? Sims3.Gameplay.Autonomy.Autonomy.AutonomyDelayNormal : Sims3.Gameplay.Autonomy.Autonomy.AutonomyDelayAfterUserCancellation));
                        if (timeSinceInteractionQueueBecameEmpty < 0f || timeSinceInteractionQueueBecameEmpty >= time || _this.Service != null || _this.SimDescription.HasActiveRole)
                        {
                            AutonomyManager.Add(_this.Autonomy);
                        }
                    }

                    NFinalizeDeath.CheckYieldingContext();
                    Simulator.Sleep(Sim.kSimLoopSleepTicksWhenNotInQueue);
                }
                else
                {
                    NFinalizeDeath.CheckYieldingContext();
                    Simulator.Sleep(Sim.kSimLoopSleepTicksWhenInAutonomyQueue);
                }
            }
            else
            {
                NFinalizeDeath.CheckYieldingContext();
                Simulator.Sleep(Sim.kSimLoopSleepTicksWhenAutonomyDisabled);
            }
        }