예제 #1
0
파일: ResetCheck.cs 프로젝트: yakoder/NRaas
        protected static bool TestAging(SimDescription sim, StuckSimData data)
        {
            if (!ValidAger(sim))
            {
                data.mAgingSituation = false;
                data.mWasNegative    = false;
                return(false);
            }

            Sim createdSim = sim.CreatedSim;

            if ((createdSim != null) && (createdSim.GetSituationOfType <AgeUpNpcSituation>() != null))
            {
                if (data.mAgingSituation)
                {
                    return(true);
                }

                data.mAgingSituation = true;
            }
            else
            {
                data.mAgingSituation = false;
            }

            int daysToTransition = (int)AgingManager.Singleton.AgingYearsToSimDays(AgingManager.GetMaximumAgingStageLength(sim));

            daysToTransition -= (int)AgingManager.Singleton.AgingYearsToSimDays(sim.AgingYearsSinceLastAgeTransition);

            if (daysToTransition < -1)
            {
                if (data.mWasNegative)
                {
                    return(true);
                }

                data.mWasNegative = true;
            }
            else
            {
                data.mWasNegative = false;
            }

            return(false);
        }
예제 #2
0
        protected static bool TestAging(SimDescription sim, StuckSimData data)
        {
            if (!ValidAger(sim))
            {
                data.mAgingSituation = false;
                data.mWasNegative = false;
                return false;
            }

            Sim createdSim = sim.CreatedSim;
            if ((createdSim != null) && (createdSim.GetSituationOfType<AgeUpNpcSituation>() != null))
            {
                if (data.mAgingSituation)
                {
                    return true;
                }

                data.mAgingSituation = true;
            }
            else
            {
                data.mAgingSituation = false;
            }

            int daysToTransition = (int)AgingManager.Singleton.AgingYearsToSimDays(AgingManager.GetMaximumAgingStageLength(sim));
            daysToTransition -= (int)AgingManager.Singleton.AgingYearsToSimDays(sim.AgingYearsSinceLastAgeTransition);

            if (daysToTransition < -1)
            {
                if (data.mWasNegative)
                {
                    return true;
                }

                data.mWasNegative = true;
            }
            else
            {
                data.mWasNegative = false;
            }

            return false;
        }
예제 #3
0
 public static void RecoverMissingSim(SimDescription sim, bool ignorePlaceholders)
 {
     try{
         if (!SimIsMissing(sim, ignorePlaceholders))
         {
             return;
         }
         if (sim.CreatedSim == null)
         {
             return;
         }
         StuckSimData stuckSim;
         if (!StuckSims.TryGetValue(sim.SimDescriptionId, out stuckSim))
         {
             stuckSim = new StuckSimData();
             StuckSims.Add(sim.SimDescriptionId, stuckSim);
         }
         if (!stuckSim.Resetting)
         {
             stuckSim.Detections++;
             Vector3 destination = Vector3.Invalid;
             if (sim.CreatedSim.RoutingComponent != null)
             {
                 sim.CreatedSim.RoutingComponent.GetDestination(out destination);
             }
             if (stuckSim.resetTask == null)
             {
                 stuckSim.resetTask = new ResetStuckSimTask(sim.CreatedSim, destination, "Missing");
             }
             else
             {
                 stuckSim.resetTask.Renew();
             }
         }
     }catch (Exception exception) {
         Alive.WriteLog(exception.Message + "\n\n" +
                        exception.StackTrace + "\n\n" +
                        exception.Source + "\n\n" +
                        "RecoverMissingSim");
     }finally{
     }
 }
예제 #4
0
파일: StuckCheck.cs 프로젝트: yakoder/NRaas
        protected static void OnPostPlan(Route r, string routeType, string result)
        {
            Sim sim = null;

            try
            {
                if (!Overwatch.Settings.mStuckCheckV2)
                {
                    return;
                }

                if ((r != null) && (r.Follower != null))
                {
                    sim = r.Follower.Target as Sim;
                    if ((sim != null) && (sim.SimDescription != null))
                    {
                        StuckSimData other;
                        if (!sRouteData.TryGetValue(sim.SimDescription.SimDescriptionId, out other))
                        {
                            other = new StuckSimData();

                            sRouteData.Add(sim.SimDescription.SimDescriptionId, other);
                        }

                        if (other.mInReset)
                        {
                            return;
                        }

                        if (other.mLastPosition != sim.Position)
                        {
                            other.mLastPosition = sim.Position;
                            other.mChecks       = 0;
                        }
                        else if (!r.PlanResult.Succeeded())
                        {
                            if (other.mChecks == 0)
                            {
                                other.mLastPositionTicks = SimClock.CurrentTicks;
                            }

                            other.mChecks++;

                            if (other.mChecks > Overwatch.Settings.mMinimumRouteFail)
                            {
                                if ((SimClock.CurrentTicks - other.mLastPositionTicks) > (SimClock.kSimulatorTicksPerSimMinute * Overwatch.Settings.mRouteFailTestMinutesV2))
                                {
                                    sTracer.Perform();

                                    if (!sTracer.mIgnore)
                                    {
                                        if (Common.kDebugging)
                                        {
                                            Common.DebugStackLog("OnPostPlan" + Common.NewLine + sim.FullName + Common.NewLine + r.PlanResult + Common.NewLine + other.mChecks);
                                            Common.DebugNotify("OnPostPlan" + Common.NewLine + sim.FullName + Common.NewLine + r.PlanResult + Common.NewLine + other.mChecks, sim);
                                        }
                                    }

                                    other.mChecks = 0;

                                    if (!sTracer.mIgnore)
                                    {
                                        other.mInReset = true;

                                        ResetTask.Perform(sim, r.GetDestPoint(), "Unroutable");
                                    }
                                }
                            }
                        }
                    }
                }
            }
            catch (Exception e)
            {
                Common.Exception(sim, null, "OnPostPlan", e);
            }
        }
예제 #5
0
파일: StuckCheck.cs 프로젝트: yakoder/NRaas
        protected override void PrivatePerformAction(bool prompt)
        {
            Overwatch.Log(Name);

            foreach (Sim createdSim in new List <Sim> (LotManager.Actors))
            {
                StuckSimData other;
                if (!sData.TryGetValue(createdSim.SimDescription.SimDescriptionId, out other))
                {
                    other = new StuckSimData();

                    sData.Add(createdSim.SimDescription.SimDescriptionId, other);
                }

                try
                {
                    bool wasReset = false;

                    if ((createdSim != null) && (createdSim.InWorld) && (createdSim.Proxy != null) && (!SimTypes.IsSelectable(createdSim)))
                    {
                        bool check = true;

                        if (createdSim.Parent is IBed)
                        {
                            check = false;
                        }

                        if (createdSim.OccultManager != null)
                        {
                            OccultRobot bot = createdSim.OccultManager.GetOccultType(Sims3.UI.Hud.OccultTypes.Robot) as OccultRobot;

                            if (bot != null && bot.IsShutdown)
                            {
                                check = false;
                            }
                        }

                        if (check)
                        {
                            InteractionInstance interaction = createdSim.CurrentInteraction;

                            bool sameInteraction = (object.ReferenceEquals(other.mLastInteraction, interaction));

                            other.mLastInteraction = interaction;

                            if (createdSim.LotCurrent.IsRoomHidden(createdSim.RoomId))
                            {
                                ResetTask.Perform(createdSim, Vector3.Invalid, "Unroutable");
                                wasReset = true;
                            }

                            if ((!wasReset) && (other.mLastPosition != Vector3.Invalid) && (other.mLastPosition == createdSim.Position))
                            {
                                if ((interaction == null) || (sameInteraction))
                                {
                                    bool success = false;

                                    try
                                    {
                                        success = SimEx.IsPointInLotSafelyRoutable(createdSim, createdSim.LotCurrent, createdSim.PositionOnFloor);
                                    }
                                    catch (Exception e)
                                    {
                                        Common.DebugException(createdSim, e);
                                        success = false;
                                    }

                                    if (!success)
                                    {
                                        ResetTask.Perform(createdSim, Vector3.Invalid, "Unroutable");
                                        wasReset = true;
                                    }
                                }
                            }

                            if (other.mLastPosition != createdSim.Position)
                            {
                                other.mLastPosition      = createdSim.Position;
                                other.mLastPositionTicks = SimClock.CurrentTicks;
                            }
                            else if ((prompt) || ((other.mLastPositionTicks + SimClock.kSimulatorTicksPerSimDay) < SimClock.CurrentTicks))
                            {
                                if (!wasReset)
                                {
                                    bool reset = false;
                                    if (sameInteraction)
                                    {
                                        reset = true;
                                    }

                                    if (reset)
                                    {
                                        ResetTask.Perform(createdSim, Vector3.Invalid, "Stationary");
                                        wasReset = true;
                                    }
                                }
                            }
                        }
                    }
                    else
                    {
                        wasReset = true;
                    }

                    if (wasReset)
                    {
                        sData.Remove(createdSim.SimDescription.SimDescriptionId);
                    }
                }
                catch (Exception e)
                {
                    Common.Exception(createdSim, e);
                }
            }
        }
예제 #6
0
        protected override void PrivatePerformAction(bool prompt)
        {
            Overwatch.Log(Name);

            foreach (Sim createdSim in new List<Sim> (LotManager.Actors))
            {
                if (createdSim.SimDescription == null) continue;

                StuckSimData other;
                if (!sData.TryGetValue(createdSim.SimDescription.SimDescriptionId, out other))
                {
                    other = new StuckSimData();

                    sData.Add(createdSim.SimDescription.SimDescriptionId, other);
                }

                try
                {
                    bool reset = false;

                    SimDescription sim = createdSim.SimDescription;

                    if (TestAging(sim, other))
                    {
                        reset = true;
                    }

                    if (reset)
                    {
                        string notice = Common.Localize(GetTitlePrefix() + ":" + other.Reason + "Two", sim.IsFemale, new object[] { sim });

                        if (other.mAgingSituation)
                        {
                            ResetSimTask.Perform(createdSim, true);
                            sData.Remove(sim.SimDescriptionId);                            
                        }
                        else
                        {
                            AgeTransitionTask.Perform(createdSim);
                        }

                        Overwatch.AlarmNotify(notice);

                        Overwatch.Log(notice);
                    }
                    else if (other.Valid)
                    {
                        if (Overwatch.Settings.mReportFirstResetCheck)
                        {
                            string notice = Common.Localize(GetTitlePrefix() + ":" + other.Reason + "One", sim.IsFemale, new object[] { sim });

                            Overwatch.Notify(createdSim, notice);

                            Overwatch.Log(notice);
                            Overwatch.Log(" Was Negative: " + other.mWasNegative);
                            Overwatch.Log(" Aging Situation: " + other.mAgingSituation);
                        }

                        if (other.mWasNegative)
                        {
                            AgeTransitionTask.Perform(createdSim);
                        }
                    }
                }
                catch (Exception e)
                {
                    Common.Exception(createdSim, e);
                }
            }
        }
예제 #7
0
        public static void   FixInvisibleSim(SimDescription sim, bool force = false, bool reset = false)
        {
            try{
                OutfitCategories[] categoriesArray = null;
                switch (sim.Species)
                {
                case CASAgeGenderFlags.Human:
                    categoriesArray = new OutfitCategories[] { OutfitCategories.Everyday,
                                                               OutfitCategories.Naked,
                                                               OutfitCategories.Athletic,
                                                               OutfitCategories.Formalwear,
                                                               OutfitCategories.Sleepwear,
                                                               OutfitCategories.Swimwear };
                    break;

                case CASAgeGenderFlags.Horse:
                    categoriesArray = new OutfitCategories[] { OutfitCategories.Everyday,
                                                               OutfitCategories.Naked,
                                                               OutfitCategories.Racing,
                                                               OutfitCategories.Bridle,
                                                               OutfitCategories.Jumping };
                    break;

                default:
                    categoriesArray = new OutfitCategories[] { OutfitCategories.Everyday,
                                                               OutfitCategories.Naked };
                    break;
                }
                bool necessary = force;
                if (!necessary)
                {
                    foreach (OutfitCategories category in categoriesArray)
                    {
                        if (sim.IsHuman)
                        {
                            if (category == OutfitCategories.Naked)
                            {
                                continue;
                            }
                        }
                        SimOutfit outfit2 = sim.GetOutfit(category, 0);
                        if ((outfit2 == null) || (!outfit2.IsValid))
                        {
                            necessary = true;
                        }
                    }
                }
                if (!necessary)
                {
                    return;
                }
                SimOutfit sourceOutfit = null;
                for (int i = 0; i < 2; i++)
                {
                    OutfitCategoryMap map = null;
                    if (i == 0)
                    {
                        map = sim.mOutfits;
                    }
                    else
                    {
                        map = sim.mMaternityOutfits;
                    }
                    if (map == null)
                    {
                        continue;
                    }
                    foreach (OutfitCategories category in Enum.GetValues(typeof(OutfitCategories)))
                    {
                        if (category == OutfitCategories.Supernatural)
                        {
                            continue;
                        }
                        ArrayList outfits = map[category] as ArrayList;
                        if (outfits == null)
                        {
                            continue;
                        }
                        foreach (SimOutfit anyOutfit in outfits)
                        {
                            if ((anyOutfit != null) && (anyOutfit.IsValid))
                            {
                                sourceOutfit = anyOutfit;
                                break;
                            }
                        }
                    }
                }
                SimBuilder builder = new SimBuilder();
                builder.UseCompression = true;
                var simTone = sim.SkinToneKey;
                List <ResourceKey> choiceTones = new List <ResourceKey>();
                KeySearch          tones       = new KeySearch(0x0354796a);
                foreach (ResourceKey tone in tones)
                {
                    choiceTones.Add(tone);
                }
                tones.Reset();
                if ((simTone.InstanceId == 0) || (!choiceTones.Contains(simTone)))
                {
                    simTone = RandomUtil.GetRandomObjectFromList(choiceTones);
                }
                ResourceKey newTone = simTone;

                builder.Age           = sim.Age;
                builder.Gender        = sim.Gender;
                builder.Species       = sim.Species;
                builder.SkinTone      = newTone;
                builder.SkinToneIndex = sim.SkinToneIndex;
                builder.MorphFat      = sim.mCurrentShape.Fat;
                builder.MorphFit      = sim.mCurrentShape.Fit;
                builder.MorphThin     = sim.mCurrentShape.Thin;
                GeneticsPet.SpeciesSpecificData speciesData = OutfitUtils.GetSpeciesSpecificData(sim);
                try{
                    if (sourceOutfit != null)
                    {
                        foreach (SimOutfit.BlendInfo blend in sourceOutfit.Blends)
                        {
                            builder.SetFacialBlend(blend.key, blend.amount);
                        }
                        CASParts.OutfitBuilder.CopyGeneticParts(builder, sourceOutfit);
                    }
                    else
                    {
                        if (sim.Genealogy != null)
                        {
                            List <SimDescription> parents      = new List <SimDescription>();
                            List <SimDescription> grandParents = new List <SimDescription>();
                            if (sim.Genealogy.Parents != null)
                            {
                                foreach (Genealogy gene in sim.Genealogy.Parents)
                                {
                                    SimDescription relative = gene.SimDescription;
                                    if (relative == null)
                                    {
                                        continue;
                                    }
                                    parents.Add(relative);
                                    if (relative.Genealogy != null)
                                    {
                                        if (relative.Genealogy.Parents != null)
                                        {
                                            foreach (Genealogy grandGene in relative.Genealogy.Parents)
                                            {
                                                var grandRelative = grandGene.SimDescription;
                                                if (grandRelative == null)
                                                {
                                                    continue;
                                                }
                                                grandParents.Add(grandRelative);
                                            }
                                        }
                                    }
                                }
                            }
                            if (parents.Count > 0)
                            {
                                if (sim.IsHuman)
                                {
                                    Genetics.InheritFacialBlends(builder, parents.ToArray(), new Random());
                                }
                                else
                                {
                                    GeneticsPet.InheritBodyShape(builder, parents, grandParents, new Random());
                                    GeneticsPet.InheritBasePeltLayer(builder, parents, grandParents, new Random());
                                    GeneticsPet.InheritPeltLayers(builder, parents, grandParents, new Random());
                                }
                            }
                        }
                    }
                }catch (Exception exception) {
                    Alive.WriteLog(exception.Message + "\n\n" +
                                   exception.StackTrace + "\n\n" +
                                   exception.Source);
                }
                if (sim.IsRobot)
                {
                    OutfitUtils.AddMissingPartsBots(builder, (OutfitCategories)0x200002, true, sim);
                    Sleep();
                    OutfitUtils.AddMissingPartsBots(builder, OutfitCategories.Everyday, true, sim);
                    Sleep();
                }
                else
                if (sim.IsHuman)
                {
                    OutfitUtils.AddMissingParts(builder, (OutfitCategories)0x200002, true, sim, sim.IsAlien);
                    Sleep();
                    OutfitUtils.AddMissingParts(builder, OutfitCategories.Everyday, true, sim, sim.IsAlien);
                    Sleep();
                }
                else
                {
                    OutfitUtils.AddMissingPartsPet(builder, OutfitCategories.Everyday | (OutfitCategories)0x200000, true, sim, speciesData);
                    Sleep();
                    OutfitUtils.AddMissingPartsPet(builder, OutfitCategories.Everyday, true, sim, speciesData);
                    Sleep();
                }
                ResourceKey uniformKey = new ResourceKey();
                if (sim.IsHuman)
                {
                    if (LocaleConstraints.GetUniform(ref uniformKey, sim.HomeWorld, builder.Age, builder.Gender, OutfitCategories.Everyday))
                    {
                        OutfitUtils.SetOutfit(builder, new SimOutfit(uniformKey), sim);
                    }
                }
                OutfitUtils.SetAutomaticModifiers(builder);
                sim.ClearOutfits(OutfitCategories.Career, false);
                sim.ClearOutfits(OutfitCategories.MartialArts, false);
                sim.ClearOutfits(OutfitCategories.Special, false);
                foreach (OutfitCategories category in categoriesArray)
                {
                    ArrayList outfits = null;
                    if (!force)
                    {
                        outfits = sim.Outfits[category] as ArrayList;
                        if (outfits != null)
                        {
                            int index = 0;
                            while (index < outfits.Count)
                            {
                                SimOutfit anyOutfit = outfits[index] as SimOutfit;
                                if (anyOutfit == null)
                                {
                                    outfits.RemoveAt(index);
                                }
                                else
                                if (!anyOutfit.IsValid)
                                {
                                    outfits.RemoveAt(index);
                                }
                                else
                                {
                                    index++;
                                }
                            }
                        }
                    }

                    if ((outfits == null) || (outfits.Count == 0))
                    {
                        OutfitUtils.MakeCategoryAppropriate(builder, category, sim);
                        if (sim.IsHuman)
                        {
                            if (LocaleConstraints.GetUniform(ref uniformKey, sim.HomeWorld, builder.Age, builder.Gender, category))
                            {
                                OutfitUtils.SetOutfit(builder, new SimOutfit(uniformKey), sim);
                            }
                        }
                        sim.RemoveOutfits(category, false);
                        CASParts.AddOutfit(sim, category, builder, true);
                    }
                    if (sim.IsUsingMaternityOutfits)
                    {
                        sim.BuildPregnantOutfit(category);
                    }
                }
                if (sim.IsMummy)
                {
                    OccultMummy
                    .OnMerge(sim);
                }
                else
                if (sim.IsFrankenstein)
                {
                    OccultFrankenstein
                    .OnMerge(sim, sim.OccultManager.mIsLifetimeReward);
                }
                else
                if (sim.IsGenie)
                {
                    OccultGenie
                    .OverlayUniform(sim, OccultGenie.CreateUniformName(sim.Age, sim.Gender), ProductVersion.EP6, OutfitCategories.Everyday, CASSkinTones.BlueSkinTone, 0.68f);
                }
                else
                if (sim.IsImaginaryFriend)
                {
                    OccultImaginaryFriend friend = sim.OccultManager.GetOccultType(Sims3.UI.Hud.OccultTypes.ImaginaryFriend) as OccultImaginaryFriend;
                    OccultBaseClass
                    .OverlayUniform(sim, OccultImaginaryFriend.CreateUniformName(sim.Age, friend.Pattern), ProductVersion.EP4, OutfitCategories.Special, CASSkinTones.NoSkinTone, 0f);
                }
                if (sim.IsMermaid)
                {
                    OccultMermaid
                    .AddOutfits(sim, null);
                }
                if (sim.IsWerewolf)
                {
                    if (sim.ChildOrAbove)
                    {
                        SimOutfit newWerewolfOutfit =
                            OccultWerewolf
                            .GetNewWerewolfOutfit(sim.Age, sim.Gender);
                        if (newWerewolfOutfit != null)
                        {
                            sim.AddOutfit(newWerewolfOutfit, OutfitCategories.Supernatural, 0x0);
                        }
                    }
                }
                SimOutfit currentOutfit = null;
                if (sim.CreatedSim != null)
                {
                    if (reset)
                    {
                        StuckSimData stuckSim;
                        if (!StuckSims.TryGetValue(sim.SimDescriptionId, out stuckSim))
                        {
                            stuckSim = new StuckSimData();
                            StuckSims.Add(sim.SimDescriptionId, stuckSim);
                        }
                        if (!stuckSim.Resetting)
                        {
                            stuckSim.Detections++;
                            Vector3 destination = Vector3.Invalid;
                            if (sim.CreatedSim.RoutingComponent != null)
                            {
                                sim.CreatedSim.RoutingComponent.GetDestination(out destination);
                            }
                            if (stuckSim.resetTask == null)
                            {
                                stuckSim.resetTask = new ResetStuckSimTask(sim.CreatedSim, destination, "Invisible");
                            }
                            else
                            {
                                stuckSim.resetTask.Renew();
                            }
                        }
                    }
                    try{
                        sim.CreatedSim.SwitchToOutfitWithoutSpin(Sim.ClothesChangeReason.GoingOutside, OutfitCategories.Everyday, true);
                    }catch (Exception exception) {
                        Alive.WriteLog(exception.Message + "\n\n" +
                                       exception.StackTrace + "\n\n" +
                                       exception.Source);
                    }
                    currentOutfit = sim.CreatedSim.CurrentOutfit;
                }
                else
                {
                    currentOutfit = sim.GetOutfit(OutfitCategories.Everyday, 0);
                }
                if (currentOutfit != null)
                {
                    ThumbnailManager.GenerateHouseholdSimThumbnail(currentOutfit.Key, currentOutfit.Key.InstanceId, 0x0, ThumbnailSizeMask.Large | ThumbnailSizeMask.ExtraLarge | ThumbnailSizeMask.Medium | ThumbnailSizeMask.Small, ThumbnailTechnique.Default, true, false, sim.AgeGenderSpecies);
                }
            }catch (Exception exception) {
                Alive.WriteLog(exception.Message + "\n\n" +
                               exception.StackTrace + "\n\n" +
                               exception.Source + "\n\n" +
                               "FixInvisibleSim");
            }finally{
            }
        }
예제 #8
0
        //==================================================================================================================
        static void ResetPortalsAndRouting()
        {
            try{
                Sim.kAutonomyThoughtBalloonPercentageChance = 100f;
                Sim.kDistanceForSocials    = 15f;
                Sim.kMaxDistanceForSocials = 75f;
                Sim.kBabyToddlerLikingThresholdToAllowInteractionsWithStrangers = -101;
                Sim.kMaxStandBackFromDoorDistance = 16f;
                Sim.kPortalIntersectRadius        = 2f;
                Sim.kPortalPushMinDistance        = 8f;
                Sim.kPortalPushMaxDistance        = 16f;
                Sim.kIdleTimeAmount = 10f;
                //------------------------------------------------------
                SimUpdate.kBonehildaFreakoutTraits = new TraitNames[] {
                    TraitNames.Coward,
                };
                //------------------------------------------------------
                ElevatorInterior.kElevatorToElevatorPortalCost = 20f;
                Ladder.kPortalCost = 22f;
                Door.kMinimumTimeBeforeClosingDoor = 30f;
                Door.kDefaultPortalCost            = 2f;
                //------------------------------------------------------
                SimRoutingComponent.kNPCSubwayUseChance = 0.5f;
                //------------------------------------------------------
                GameObject.kKleptoRespawnTimeDays = 1;
                //------------------------------------------------------
                GameObject.kAutonomyMultiplierForObjectSelectionWhenSomeSimIsRouting = 0.05f;
                //------------------------------------------------------
                Autonomy.kEnergyThresholdBelowWhichTheyWantToSleepWhenSleepyDuringTheirBedTime = 0;
                //------------------------------------------------------
                Autonomy.kHoursAfterWhichBubbledUpScoreIsMax = .25f;
                //------------------------------------------------------
                Autonomy.kRandomness = .027f;
                //------------------------------------------------------
                Autonomy.kPreferSeatedSocialsMultiplier         = 1.5f;
                Autonomy.kSocialThatWillCauseDismountMultiplier = .025f;
                //------------------------------------------------------
                Autonomy.kAllowEvenIfNotAllowedInRoomAutonomousMultiplier = 0.5f;
                Autonomy.kAutonomyDelayNormal                               = 0;
                Autonomy.kAutonomyDelayWhileMounted                         = 0;
                Autonomy.kAutonomyDelayDuringSocializing                    = 0;
                SimRoutingComponent.kDefaultStandAndWaitDuration            = 1f;
                SimRoutingComponent.kMinimumPostPushStandAndWaitDuration    = 0f;
                SimRoutingComponent.kMaximumPostPushStandAndWaitDuration    = 2f;
                SimRoutingComponent.kTotalSimMinutesToWaitForSimsToBePushed = 1f;
                //------------------------------------------------------
                SimRoutingComponent.kAvoidanceReplanCheckFrequencyMin = 6;
                SimRoutingComponent.kAvoidanceReplanCheckFrequencyMax = 9;
                SimRoutingComponent.kAvoidanceReplanCheckOffsetMin    = 1;
                SimRoutingComponent.kAvoidanceReplanCheckOffsetMax    = 3;
                //------------------------------------------------------
                SimRoutingComponent.kPushHorsesAwayDistanceMin            = 14.0f;
                SimRoutingComponent.kPushHorsesAwayDistanceMax            = 20.0f;
                SimRoutingComponent.kPushFoalsAwayDistanceMin             = 14.0f;
                SimRoutingComponent.kPushFoalsAwayDistanceMax             = 20.0f;
                SimRoutingComponent.kPushDogsAwayDistanceMin              = 6.0f;
                SimRoutingComponent.kPushDogsAwayDistanceMax              = 12.0f;
                SimRoutingComponent.kPushSimsAwayDistanceFromFootprintMin = 2.50f;
                SimRoutingComponent.kPushSimsAwayDistanceMin              = 2.4f;
                SimRoutingComponent.kPushSimsAwayDistanceMin              = 10.0f;
                //------------------------------------------------------
                InteractionQueue.kMaxMinutesRemainingNotToAutosolve = 30;
                SimQueue.kMinimumRadialDistanceFromDoor             = 2.0f;
                SimQueue.kMaximumRadialDistanceFromDoor             = 10.0f;
                SimQueue.kMinimumRadialDistanceFromSim    = 4.0f;
                SimQueue.kMaximumRadialDistanceFromSim    = 10.0f;
                SimQueue.kMinimumRadialDistanceFromObject = 4.8f;
                SimQueue.kMaximumRadialDistanceFromObject = 12.0f;
                SimQueue.kCheckPeriodInMinutes            = 0.5f;
                //------------------------------------------------------
                InteractionInstance.kNumMinToWaitOnPreSync   = 60;
                InteractionInstance.kNumMinToWaitOnSyncStart = 90;
                InteractionInstance.kNumMinToWaitOnSync      = 10;
                //------------------------------------------------------
                SocialInteraction.kSocialRouteRadiusMax = 6;
                SocialInteraction.kSocialRouteMinDist   = 10;
                //------------------------------------------------------
                SocialInteraction.kSocialTimeoutTime = 45;
                //------------------------------------------------------
                SocialInteraction.kSocialJigPlacementLimit = 30f;
                SocialInteraction.kSocialSyncGiveupTime    = 45;
                //------------------------------------------------------
                SocialInteraction.kSocialBumpDistMin = 0.175f;
                SocialInteraction.kSocialBumpDistMax = 1.0f;
                //------------------------------------------------------
                SocialInteraction.kApproachGreetDistance = 6.0f;
                //------------------------------------------------------
            }
            catch (Exception exception) {
                Alive.WriteLog(exception.Message + "\n\n" +
                               exception.StackTrace + "\n\n" +
                               exception.Source + "\n\n" +
                               "tunnings");
            }finally{
            }
            try{
                List <Sim>
                toRemove = new List <Sim>();
                foreach (var simPosData in stuckPositions)
                {
                    if (simPosData.Key == null ||
                        simPosData.Key.HasBeenDestroyed ||
                        !simPosData.Key.InWorld ||
                        simPosData.Key.Position != simPosData.Value)
                    {
                        toRemove.Add(simPosData.Key);
                    }
                }
                for (int i = 0; i < toRemove.Count; i++)
                {
                    stuckPositions.Remove(toRemove[i]);
                }
                toRemove.Clear();
                foreach (Sim sim in Sims3.Gameplay.Queries.GetObjects <Sim>())
                {
                    sim.PlayRouteFailFrequency = Sim.RouteFailFrequency.NeverPlayRouteFail;
                    if (!Objects.IsValid(sim.ObjectId) ||
                        Simulator.GetProxy(sim.ObjectId) == null ||
                        sim.SimDescription == null ||
                        sim.SimDescription.CreatedSim != sim)
                    {
                        new ResetClearSimTask(sim);
                    }
                }
            }catch (Exception exception) {
                Alive.WriteLog(exception.Message + "\n\n" +
                               exception.StackTrace + "\n\n" +
                               exception.Source + "\n\n" +
                               "stuckCheck_notMovingSims_simPosData_reset");
            }finally{
            }
            try{
                foreach (ElevatorDoors elevator in Sims3.Gameplay.Queries.GetObjects <ElevatorDoors>())
                {
                    ElevatorInterior.ElevatorPortalComponent
                                       portal =
                        elevator.InteriorObj.ElevatorPortal as
                        ElevatorInterior.ElevatorPortalComponent;
                    if (portal != null)
                    {
//  Medium reset sims: reset and put in the same lot
                        foreach (SimDescription sim in new List <SimDescription>(
                                     portal.mAssignedSims.Keys))
                        {
                            if (sim.CreatedSim != null)
                            {
                                StuckSimData stuckSim;
                                if (!StuckSims.TryGetValue(sim.SimDescriptionId, out stuckSim))
                                {
                                    stuckSim = new StuckSimData();
                                    StuckSims.Add(sim.SimDescriptionId, stuckSim);
                                }
                                if (!stuckSim.Resetting)
                                {
                                    stuckSim.Detections++;
                                    Vector3 destination = Vector3.Invalid;
                                    if (sim.CreatedSim.RoutingComponent != null)
                                    {
                                        sim.CreatedSim.RoutingComponent.GetDestination(out destination);
                                    }
                                    if (stuckSim.resetTask == null)
                                    {
                                        stuckSim.resetTask = new ResetStuckSimTask(sim.CreatedSim, destination, "Elevator");
                                    }
                                    else
                                    {
                                        stuckSim.resetTask.Renew();
                                    }
                                }
                            }
                        }
                        portal.FreeAllRoutingLanes();
                    }
                    //
                    if (elevator.ActorsUsingMe != null &&
                        elevator.ActorsUsingMe.Count > 0)
                    {
                        elevator.SetObjectToReset();
                    }
                }
                foreach (Door door in Sims3.Gameplay.Queries.GetObjects <Door>())
                {
                    Door.DoorPortalComponent
                              portal =
                        door.PortalComponent as
                        Door.DoorPortalComponent;
                    if (portal != null)
                    {
//  Soft reset sims: reset and don't change position
                        foreach (SimDescription sim in new List <SimDescription>(
                                     door.ActorsUsingMeAsSimDescriptions))
                        {
                            if (sim.CreatedSim != null)
                            {
                            }
                        }
                        if (door.ActorsUsingMe != null &&
                            door.ActorsUsingMe.Count > 0)
                        {
                            portal.FreeAllRoutingLanes();
                        }
                    }
                    //
                    if (door.ActorsUsingMe != null &&
                        door.ActorsUsingMe.Count > 0)
                    {
                        door.SetObjectToReset();
                    }
                }
                foreach (StaircaseSpiral staircaseSpiral in Sims3.Gameplay.Queries.GetObjects <StaircaseSpiral>())
                {
                    StaircaseSpiral.StaircaseSpiralPortalComponent
                                         portal =
                        staircaseSpiral.PortalComponent as
                        StaircaseSpiral.StaircaseSpiralPortalComponent;
                    if (portal != null)
                    {
//  Soft reset sims: reset and don't change position
                        foreach (SimDescription sim in new List <SimDescription>(
                                     staircaseSpiral.ActorsUsingMeAsSimDescriptions))
                        {
                            if (sim.CreatedSim != null)
                            {
                            }
                        }
                        portal.FreeAllRoutingLanes();
                    }
                    //
                    if (staircaseSpiral.ActorsUsingMe != null &&
                        staircaseSpiral.ActorsUsingMe.Count > 0)
                    {
                        staircaseSpiral.SetObjectToReset();
                    }
                }
                foreach (Ladder ladder in Sims3.Gameplay.Queries.GetObjects <Ladder>())
                {
                    Ladder.LadderPortalComponent
                                portal =
                        ladder.PortalComponent as
                        Ladder.LadderPortalComponent;
                    if (portal != null)
                    {
//  Soft reset sims: reset and don't change position
                        foreach (SimDescription sim in new List <SimDescription>(
                                     ladder.ActorsUsingMeAsSimDescriptions))
                        {
                            if (sim.CreatedSim != null)
                            {
                            }
                        }
                        portal.FreeAllRoutingLanes();
                    }
                    //
                    if (ladder.ActorsUsingMe != null &&
                        ladder.ActorsUsingMe.Count > 0)
                    {
                        ladder.SetObjectToReset();
                    }
                }
                foreach (Stairs stairs in Sims3.Gameplay.Queries.GetObjects <Stairs>())
                {
                    Stairs.StairsPortalComponent
                                portal =
                        stairs.PortalComponent as
                        Stairs.StairsPortalComponent;
                    if (portal != null)
                    {
//  Soft reset sims: reset and don't change position
                        foreach (SimDescription sim in new List <SimDescription>(
                                     stairs.ActorsUsingMeAsSimDescriptions))
                        {
                            if (sim.CreatedSim != null)
                            {
                            }
                        }
                        portal.FreeAllRoutingLanes();
                    }
                    //
                    if (stairs.ActorsUsingMe != null &&
                        stairs.ActorsUsingMe.Count > 0)
                    {
                        stairs.SetObjectToReset();
                    }
                }
            }catch (Exception exception) {
                Alive.WriteLog(exception.Message + "\n\n" +
                               exception.StackTrace + "\n\n" +
                               exception.Source + "\n\n" +
                               "resetAllPortals");
            }finally{
            }
        }
예제 #9
0
        protected static void OnPostPlan(Route r, string routeType, string result)
        {
            Sim sim = null;

            try
            {
                if (!Overwatch.Settings.mStuckCheckV2) return;

                if ((r != null) && (r.Follower != null))
                {
                    sim = r.Follower.Target as Sim;
                    if ((sim != null) && (sim.SimDescription != null))
                    {
                        StuckSimData other;
                        if (!sRouteData.TryGetValue(sim.SimDescription.SimDescriptionId, out other))
                        {
                            other = new StuckSimData();

                            sRouteData.Add(sim.SimDescription.SimDescriptionId, other);
                        }

                        if (other.mInReset) return;

                        if (other.mLastPosition != sim.Position)
                        {
                            other.mLastPosition = sim.Position;
                            other.mChecks = 0;
                        }
                        else if (!r.PlanResult.Succeeded())
                        {
                            if (other.mChecks == 0)
                            {
                                other.mLastPositionTicks = SimClock.CurrentTicks;
                            }

                            other.mChecks++;

                            if (other.mChecks > Overwatch.Settings.mMinimumRouteFail)
                            {
                                if ((SimClock.CurrentTicks - other.mLastPositionTicks) > (SimClock.kSimulatorTicksPerSimMinute * Overwatch.Settings.mRouteFailTestMinutesV2))
                                {
                                    sTracer.Perform();

                                    if (!sTracer.mIgnore)
                                    {
                                        if (Common.kDebugging)
                                        {
                                            Common.DebugStackLog("OnPostPlan" + Common.NewLine + sim.FullName + Common.NewLine + r.PlanResult + Common.NewLine + other.mChecks);
                                            Common.DebugNotify("OnPostPlan" + Common.NewLine + sim.FullName + Common.NewLine + r.PlanResult + Common.NewLine + other.mChecks, sim);
                                        }
                                    }

                                    other.mChecks = 0;

                                    if (!sTracer.mIgnore)
                                    {
                                        other.mInReset = true;

                                        ResetTask.Perform(sim, r.GetDestPoint(), "Unroutable");
                                    }
                                }
                            }
                        }
                    }
                }
            }
            catch (Exception e)
            {
                Common.Exception(sim, null, "OnPostPlan", e);
            }
        }
예제 #10
0
        protected override void PrivatePerformAction(bool prompt)
        {
            Overwatch.Log(Name);

            foreach (Sim createdSim in new List<Sim> (LotManager.Actors))
            {
                StuckSimData other;
                if (!sData.TryGetValue(createdSim.SimDescription.SimDescriptionId, out other))
                {
                    other = new StuckSimData();

                    sData.Add(createdSim.SimDescription.SimDescriptionId, other);
                }

                try
                {
                    bool wasReset = false;

                    if ((createdSim != null) && (createdSim.InWorld) && (createdSim.Proxy != null) && (!SimTypes.IsSelectable(createdSim)))
                    {
                        bool check = true;

                        if (createdSim.Parent is IBed)
                        {
                            check = false;
                        }

                        if (check)
                        {
                            InteractionInstance interaction = createdSim.CurrentInteraction;

                            bool sameInteraction = (object.ReferenceEquals(other.mLastInteraction, interaction));

                            other.mLastInteraction = interaction;

                            if (createdSim.LotCurrent.IsRoomHidden(createdSim.RoomId))
                            {
                                ResetTask.Perform(createdSim, Vector3.Invalid, "Unroutable");
                                wasReset = true;
                            }

                            if ((!wasReset) && (other.mLastPosition != Vector3.Invalid) && (other.mLastPosition == createdSim.Position))
                            {
                                if ((interaction == null) || (sameInteraction))
                                {
                                    bool success = false;

                                    try
                                    {
                                        success = SimEx.IsPointInLotSafelyRoutable(createdSim, createdSim.LotCurrent, createdSim.PositionOnFloor);
                                    }
                                    catch (Exception e)
                                    {
                                        Common.DebugException(createdSim, e);
                                        success = false;
                                    }

                                    if (!success)
                                    {
                                        ResetTask.Perform(createdSim, Vector3.Invalid, "Unroutable");
                                        wasReset = true;
                                    }
                                }
                            }

                            if (other.mLastPosition != createdSim.Position)
                            {
                                other.mLastPosition = createdSim.Position;
                                other.mLastPositionTicks = SimClock.CurrentTicks;
                            }
                            else if ((prompt) || ((other.mLastPositionTicks + SimClock.kSimulatorTicksPerSimDay) < SimClock.CurrentTicks))
                            {
                                if (!wasReset)
                                {
                                    bool reset = false;
                                    if (sameInteraction)
                                    {
                                        reset = true;
                                    }

                                    if (reset)
                                    {
                                        ResetTask.Perform(createdSim, Vector3.Invalid, "Stationary");
                                        wasReset = true;
                                    }
                                }
                            }
                        }
                    }
                    else
                    {
                        wasReset = true;
                    }

                    if (wasReset)
                    {
                        sData.Remove(createdSim.SimDescription.SimDescriptionId);
                    }
                }
                catch (Exception e)
                {
                    Common.Exception(createdSim, e);
                }
            }
        }
예제 #11
0
파일: ResetCheck.cs 프로젝트: yakoder/NRaas
        protected override void PrivatePerformAction(bool prompt)
        {
            Overwatch.Log(Name);

            foreach (Sim createdSim in new List <Sim> (LotManager.Actors))
            {
                if (createdSim.SimDescription == null)
                {
                    continue;
                }

                StuckSimData other;
                if (!sData.TryGetValue(createdSim.SimDescription.SimDescriptionId, out other))
                {
                    other = new StuckSimData();

                    sData.Add(createdSim.SimDescription.SimDescriptionId, other);
                }

                try
                {
                    bool reset = false;

                    SimDescription sim = createdSim.SimDescription;

                    if (TestAging(sim, other))
                    {
                        reset = true;
                    }

                    if (reset)
                    {
                        string notice = Common.Localize(GetTitlePrefix() + ":" + other.Reason + "Two", sim.IsFemale, new object[] { sim });

                        if (other.mAgingSituation)
                        {
                            ResetSimTask.Perform(createdSim, true);
                            sData.Remove(sim.SimDescriptionId);
                        }
                        else
                        {
                            AgeTransitionTask.Perform(createdSim);
                        }

                        Overwatch.AlarmNotify(notice);

                        Overwatch.Log(notice);
                    }
                    else if (other.Valid)
                    {
                        if (Overwatch.Settings.mReportFirstResetCheck)
                        {
                            string notice = Common.Localize(GetTitlePrefix() + ":" + other.Reason + "One", sim.IsFemale, new object[] { sim });

                            Overwatch.Notify(createdSim, notice);

                            Overwatch.Log(notice);
                            Overwatch.Log(" Was Negative: " + other.mWasNegative);
                            Overwatch.Log(" Aging Situation: " + other.mAgingSituation);
                        }

                        if (other.mWasNegative)
                        {
                            AgeTransitionTask.Perform(createdSim);
                        }
                    }
                }
                catch (Exception e)
                {
                    Common.Exception(createdSim, e);
                }
            }
        }