Example #1
0
            public override bool Run()
            {
                try
                {
                    if (!Target.SetCoffinActive(isActive: false))
                    {
                        return(false);
                    }

                    StandardEntry();

                    AcquireStateMachine("BonehildaAwaken");
                    SetActor("x", Actor);
                    SetActor("coffin", Target);

                    EnterState("x", "Enter");

                    BeginCommodityUpdates();
                    AnimateSim("Exit_Dismiss");

                    bool ok = ___ReturnBonehildaToCoffin(Target); // custom

                    Actor.LoopIdle();
                    for (int i = 0; i < 25; i++)
                    {
                        Simulator.Sleep(0);
                    }

                    EndCommodityUpdates(succeeded: ok);
                    StandardExit();
                    return(ok);
                }
                catch (ResetException) { throw; }
                catch (Exception)
                {
                    if (Target != null && Target.mBonehildaSim != null)
                    {
                        NFinalizeDeath.ForceDestroyObject(Target.mBonehildaSim);
                        Target.mBonehildaSim = null;
                        //throw new ArgumentException("None", ex);
                    }
                    return(true);
                }
                finally
                {
                    if (Target != null && Target.mBonehildaSim != null && Target.mBonehildaSim.InteractionQueue != null && !Target.mBonehildaSim.InteractionQueue.HasInteractionOfType(BonehildaCoffin.BonehildaReturnToCoffin.Singleton))
                    {
                        NFinalizeDeath.ForceDestroyObject(Target.mBonehildaSim);
                        Target.mBonehildaSim = null;
                    }
                }
            }
Example #2
0
            public bool ___ReturnBonehildaToCoffin(BonehildaCoffin target)
            {
                if (target == null || target.mBonehildaSim == null)  // custom
                {
                    return(false);
                }
                InteractionQueue tInteractionQueue = target.mBonehildaSim.InteractionQueue;

                if (tInteractionQueue != null && !tInteractionQueue.HasInteractionOfType(BonehildaCoffin.BonehildaReturnToCoffin.Singleton))
                {
                    Sim targetsim = target.mBonehildaSim;

                    try
                    {
                        tInteractionQueue.CancelAllInteractions();
                    }
                    catch (Exception)
                    {
                        NFinalizeDeath.ForceCancelAllInteractionsWithoutCleanup(targetsim);
                        NFinalizeDeath.ForceDestroyObject(targetsim);

                        target.mBonehildaSim = null;

                        return(true);
                    }

                    targetsim = target.mBonehildaSim;

                    if (targetsim == null || targetsim.SimDescription == null || targetsim.HasBeenDestroyed)
                    {
                        target.mBonehildaSim = null;
                        return(true);
                    }

                    var entry =
                        BonehildaCoffin.BonehildaReturnToCoffin
                        .Singleton.CreateInstance(target, targetsim,
                                                  new InteractionPriority(InteractionPriorityLevel.RequiredNPCBehavior),
                                                  isAutonomous: false,
                                                  cancellableByPlayer: true)
                        as BonehildaCoffin.BonehildaReturnToCoffin;

                    tInteractionQueue.AddNext(entry);
                }
                if (tInteractionQueue == null)
                {
                    target.mBonehildaSim = null;
                }
                return(true);
            }
Example #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);
            }
        }
Example #4
0
            public override void ConfigureInteraction()
            {
                Sims3.Gameplay.CAS.SimDescription.DeathType deathtyp = base.simDeathType;
                try
                {
                    bool isplayer = Actor.IsSelectable;

                    if (isplayer)
                    {
                        mMustRun            = false;
                        mHidden             = false;
                        CancellableByPlayer = true;
                    }

                    var killSim =
                        ExtKillSimNiec.Singleton.CreateInstance(Target, Actor, KillSimNiecX.DGSAndNonDGSPriority(), Autonomous, isplayer) as ExtKillSimNiec;

                    killSim.simDeathType       = base.simDeathType;
                    killSim.PlayDeathAnimation = base.PlayDeathAnimation;
                    killSim.mMustRun           = true;

                    base.mPriority = KillSimNiecX.DGSAndNonDGSPriority();

                    runI = killSim;
                    runI.ConfigureInteraction();
                }
                catch (ResetException) { throw; }
                catch { }
                if (!_IsOpenDGSInstalled && !Actor.IsInActiveHousehold)
                {
                    SimDescription ActorDesc = Actor.SimDescription;
                    Sim            Actior    = Actor;


                    if (ATask == ObjectGuid.InvalidObjectGuid)
                    {
                        InteractionPriority MaxDeathP = KillSimNiecX.DGSAndNonDGSPriority();

                        ATask = NiecTask.Perform(delegate
                        {
                            for (int i = 0; i < 190; i++)
                            {
                                Simulator.Sleep(10);
                            }
                            try
                            {
                                while (Actior != null && Actior.mSimDescription != null && !Actior.HasBeenDestroyed && Actior.InteractionQueue != null && Actior.InteractionQueue.HasInteractionOfType(typeof(NiecKillSim)))
                                {
                                    Simulator.Sleep(0);
                                    base.mPriority = MaxDeathP;
                                    base.mMustRun  = true;
                                }
                            }
                            catch (ResetException)
                            {
                                throw;
                            }
                            catch { }
                        });
                    }
                    if (AutoKillSimTask == ObjectGuid.InvalidObjectGuid)
                    {
                        AutoKillSimTask = NiecTask.Perform(delegate
                        {
                            /*
                             * ActorDesc.IsGhost = true;
                             * ActorDesc.mDeathStyle = base.simDeathType;
                             *
                             *
                             *
                             *
                             * if (NFinalizeDeath.GetKillNPCSimToGhost(Actor, deathtyp)) return;
                             * else SafeNRaas.NRUrnstones_CreateGrave(ActorDesc, deathtyp, false, false);*/


                            for (int i = 0; i < 190; i++)
                            {
                                Simulator.Sleep(10);
                            }

                            try
                            {
                                try
                                {
                                    while (Actior != null && Actior.mSimDescription != null && !Actior.HasBeenDestroyed && Actior.InteractionQueue != null && Actior.InteractionQueue.HasInteractionOfType(typeof(NiecKillSim)))
                                    {
                                        Simulator.Sleep(170);
                                    }
                                }
                                catch (ResetException)
                                {
                                    throw;
                                }
                                catch { }

                                Sim CreatedSim = ActorDesc.CreatedSim;

                                try
                                {
                                    if (NFinalizeDeath.IsHasInteractionNHSTargetSim(Actior))
                                    {
                                        return;
                                    }
                                    if (CreatedSim != null && CreatedSim.mSimDescription == ActorDesc)
                                    {
                                        if (NFinalizeDeath.IsHasInteractionNHSTargetSim(CreatedSim))
                                        {
                                            return;
                                        }
                                    }
                                }
                                catch (ResetException)
                                {
                                    throw;
                                }
                                catch
                                { }

                                try
                                {
                                    if (ActorDesc.AssignedRole != null)
                                    {
                                        ActorDesc.AssignedRole.RemoveSimFromRole();
                                    }
                                    ActorDesc.AssignedRole = null;
                                }
                                catch (ResetException)
                                {
                                    throw;
                                }
                                catch
                                { }

                                try
                                {
                                    ActorDesc.IsGhost     = true;
                                    ActorDesc.mDeathStyle = deathtyp;
                                    NiecHelperSituation.FinalizeSimDeathPro(
                                        ActorDesc, ActorDesc.Household, AssemblyCheckByNiec.IsInstalled(NiecMod.Instantiator.DGSModsAssembly)
                                        );
                                }
                                catch (ResetException)
                                {
                                    throw;
                                }
                                catch
                                { }

                                try
                                {
                                    if (Actior.Inventory != null)
                                    {
                                        //Actior.MoveInventoryItemsToSim(NFinalizeDeath.ActiveActor ?? PlumbBob.SelectedActor);
                                        NFinalizeDeath._MoveInventoryItemsToAFamilyMember
                                            (Target, NFinalizeDeath.HouseholdMembersToSim(Household.ActiveHousehold, true, false) ?? NFinalizeDeath.ActiveActor ?? PlumbBob.SelectedActor);
                                    }
                                }
                                catch (ResetException)
                                {
                                    throw;
                                }
                                catch
                                { }


                                Urnstone RIPObject;

                                RIPObject = HelperNra.TFindGhostsGrave(ActorDesc);

                                if (RIPObject == null)
                                {
                                    NFinalizeDeath.GetKillNPCSimToGhost(Actior, deathtyp, Vector3.OutOfWorld, out RIPObject);
                                }
                                if (RIPObject == null)
                                {
                                    RIPObject = Urnstone.CreateGrave(ActorDesc, false, true);
                                }

                                NiecHelperSituation.safePosRIPObject(Actior, Actior, RIPObject);

                                NFinalizeDeath.ForceDestroyObject(Actior);
                                NFinalizeDeath.ForceDestroyObject(CreatedSim);

                                if (ActorDesc.DeathStyle == SimDescription.DeathType.None)
                                {
                                    ActorDesc.mDeathStyle = SimDescription.DeathType.Drown;
                                }
                                ActorDesc.IsGhost = true;


                                RIPObject = HelperNra.TFindGhostsGrave(ActorDesc);

                                if (RIPObject == null)
                                {
                                    NFinalizeDeath.GetKillNPCSimToGhost(Actior, deathtyp, Vector3.OutOfWorld, out RIPObject);
                                }

                                NiecHelperSituation.safePosRIPObject(Actior, Actior, RIPObject);

                                RIPObject.AddToWorld();
                                RIPObject.FadeIn();

                                RIPObject.SetHiddenFlags(HiddenFlags.Nothing);
                                RIPObject.SetOpacity(1f, 0f);
                                RIPObject.AddToWorld();
                                RIPObject.FadeIn();

                                if (ActorDesc.DeathStyle == SimDescription.DeathType.None)
                                {
                                    ActorDesc.mDeathStyle = SimDescription.DeathType.Drown;
                                }
                                ActorDesc.IsGhost = true;
                            }
                            catch (ResetException)
                            {
                                throw;
                            }
                            catch { }
                        });
                    }
                }
            }