コード例 #1
0
            protected static void ReplaceComponent(Door door)
            {
                if (door.GetComponent <DoorPortalComponentEx>() != null)
                {
                    return;
                }

                if (door.GetComponent <Turnstile.TurnstileDoorPortalComponent>() != null)
                {
                    return;
                }
                if (door.GetComponent <MysteriousDeviceDoor.MysteriousDoorPortalComponent>() != null)
                {
                    return;
                }

                Door.DoorPortalComponent oldComponent = door.PortalComponent as Door.DoorPortalComponent;

                door.RemoveComponent <Door.DoorPortalComponent>();

                ObjectComponents.AddComponent <DoorPortalComponentEx>(door, new object[0]);

                if (oldComponent != null)
                {
                    Door.DoorPortalComponent newComponent = door.PortalComponent as Door.DoorPortalComponent;
                    if (newComponent != null)
                    {
                        newComponent.OwnerDoor = oldComponent.OwnerDoor;
                    }
                }
            }
コード例 #2
0
ファイル: ObjectInfo.cs プロジェクト: yakoder/NRaas
        protected static Common.StringBuilder ComponentToString(ObjectComponent component)
        {
            Common.StringBuilder msg = new Common.StringBuilder();

            if (component is Door.DoorPortalComponent)
            {
                Door.DoorPortalComponent doorPortalComponent = component as Door.DoorPortalComponent;

                msg += Common.NewLine + " OwnerDoor: " + (doorPortalComponent.OwnerDoor != null);
                msg += Common.NewLine + " mAddPortalsCallback: " + (doorPortalComponent.mAddPortalsCallback != null);

                if (doorPortalComponent.mLockedLaneIndices != null)
                {
                    foreach (KeyValuePair <Sim, Door.DoorPortalComponent.LaneInfo> pair in doorPortalComponent.mLockedLaneIndices)
                    {
                        msg += Common.NewLine + " Key: " + pair.Key.FullName;

                        msg += Common.NewLine + " mLaneIndex: " + pair.Value.mLaneIndex;
                        msg += Common.NewLine + " mLaneFlags: " + pair.Value.mLaneFlags;

                        if (pair.Value.mLaneSlots != null)
                        {
                            msg += Common.NewLine + " mLaneSlots: " + pair.Value.mLaneSlots.Length;
                            foreach (Slot slot in pair.Value.mLaneSlots)
                            {
                                msg += Common.NewLine + "  " + slot;
                            }
                        }
                        else
                        {
                            msg += Common.NewLine + " mLaneSlots: <null>";
                        }
                    }
                }
                else
                {
                    msg += Common.NewLine + " mLockedLaneIndices: <null>";
                }
            }

            return(msg);
        }
コード例 #3
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{
            }
        }