コード例 #1
0
        public static Lot GetLot(GameObject target, GameObjectHit hit)
        {
            Lot lot = target as Lot;

            if (lot != null)
            {
                if (lot.IsBaseCampLotType)
                {
                    return(null);
                }

                return(lot);
            }

            if (target is Sims3.Gameplay.Objects.Electronics.Computer)
            {
                return(null);
            }

            if (target is RabbitHole)
            {
                return(null);
            }

            if (target != null)
            {
                if (target.LotCurrent != null)
                {
                    return(target.LotCurrent);
                }
            }

            return(LotManager.GetLotAtPoint(hit.mPoint));
        }
コード例 #2
0
        public Lot GetLot(GameObject target, GameObjectHit hit)
        {
            Lot lot = target as Lot;

            if (lot != null)
            {
                return(lot);
            }

            if (target != null && target.LotCurrent != null)
            {
                return(target.LotCurrent);
            }

            return(hit != null?LotManager.GetLotAtPoint(hit.mPoint) : null);
        }
コード例 #3
0
            protected override bool OnPerform()
            {
                if (Decensor.Settings.mDisable)
                {
                    return(true);
                }

                List <Lot> lots = new List <Lot>();

                Lot choice = LotManager.ActiveLot;

                if (choice != null)
                {
                    lots.Add(choice);
                }

                choice = LotManager.GetLotAtPoint(CameraController.GetLODInterestPosition());
                if ((choice != null) && (!lots.Contains(choice)))
                {
                    lots.Add(choice);
                }

                if (Household.ActiveHousehold != null)
                {
                    foreach (Sim sim in Households.AllSims(Household.ActiveHousehold))
                    {
                        VerifyCensor(sim);
                    }
                }

                foreach (Lot lot in lots)
                {
                    if (lot.IsWorldLot)
                    {
                        continue;
                    }

                    foreach (Sim sim in lot.GetAllActors())
                    {
                        VerifyCensor(sim);
                    }
                }

                return(true);
            }
コード例 #4
0
ファイル: PortraitPanel.cs プロジェクト: yakoder/NRaas
            protected override bool OnPerform()
            {
                if ((SkewerEx.Instance != null) && (sSettings != null))
                {
                    if (Settings.InUse(SkewerEx.VisibilityType.ViewedLot))
                    {
                        Lot viewedLot = LotManager.GetLotAtPoint(CameraController.GetLODInterestPosition());

                        if (mViewedLot != viewedLot)
                        {
                            mViewedLot = viewedLot;

                            Common.FunctionTask.Perform(SkewerEx.Instance.PopulateSkewers);
                        }
                    }
                }

                return(true);
            }
コード例 #5
0
            protected override bool InitialPrep(CastFireBlastTerrainEx ths, bool twoPerson, IMagicalDefinition definition, MagicControl control, bool spellCastingSucceeded, bool spellCastingEpiclyFailed)
            {
                Vector3         targetPosition = ths.GetTargetPosition();
                Route           r      = ths.Actor.CreateRoute();
                RoutePlanResult result = r.PlanToPointRadius(targetPosition, kRoutingDistance, RouteOrientationPreference.TowardsObject, LotManager.GetLotAtPoint(targetPosition).LotId, new int[] { World.GetRoomId(targetPosition) });

                if (!result.Succeeded() || World.IsInPool(result.mDestination))
                {
                    ths.Actor.PlayRouteFailure();
                    return(false);
                }

                if (!ths.Actor.DoRoute(r))
                {
                    return(false);
                }

                return(true);
            }
コード例 #6
0
        public ActionResult NM_PerformAction()
        {
            if (dontCall)
            {
                return(ActionResult.Continue);
            }

            Boat boat = null;

            try
            {
                mRoutingSim.SimRoutingComponent.DisallowBeingPushed = true;

                if (mRoutingSim.HasExitReason((ExitReason)mOriginalRoute.ExitReasonsInterrupt))
                {
                    AddFailureExplanation(FailureExplanation.CancelledByScript);
                    return(ActionResult.Terminate);
                }

                Lot lot = (mOriginalRoute == null) ? mRoutingSim.LotCurrent : LotManager.GetLotAtPoint(mOriginalRoute.GetOriginalStartPoint());
                boat = Sim_GetBoatForGetInBoatRouteAction(mRoutingSim, lot);
                if (boat == null)
                {
                    AddFailureExplanation(FailureExplanation.VehicleSequenceFailure);
                    return(ActionResult.Terminate);
                }

                mLastFoundBoatId = boat.ObjectId;
                Vector3 pt;
                mOriginalRoute.GetSegmentStartPoint(0u, out pt);
                Vector3 dir;
                mOriginalRoute.GetSegmentStartDirection(0u, out dir);

                mBoatAppearingPt = pt;

                mnReplanFrequency = RandomUtil.GetInt(SimRoutingComponent.AvoidanceReplanCheckFrequencyMin, SimRoutingComponent.AvoidanceReplanCheckFrequencyMax);
                mnReplanOffset    = RandomUtil.GetInt(SimRoutingComponent.AvoidanceReplanCheckOffsetMin, SimRoutingComponent.AvoidanceReplanCheckOffsetMax);

                StandAndWaitController standAndWaitController = new StandAndWaitController();
                standAndWaitController.AllowZeroCycle = true;
                standAndWaitController.Duration       = SimRoutingComponent.DefaultStandAndWaitDuration;
                standAndWaitController.OnCycle        = base.StandAndWaitCycleHandler;
                standAndWaitController.Run(mRoutingSim);

                if (mStandAndWaitResult == ActionResult.Terminate)
                {
                    if (mLastFoundObstruction.IsValid && mOriginalRoute.DoRouteFail)
                    {
                        mRoutingSim.SimRoutingComponent.PlayRouteFailureIfAppropriate(mLastFoundObstruction.ObjectFromId <GameObject>());
                    }
                    return(mStandAndWaitResult);
                }

                if (mStandAndWaitResult == ActionResult.ContinueAndFollowPath)
                {
                    return(mStandAndWaitResult);
                }

                ItemComponent itemComp = boat.ItemComp;
                if (itemComp != null && itemComp.InventoryParent != null)
                {
                    itemComp.InventoryParent.RemoveByForce(boat);
                }

                MooringPost mooringPost = boat.Parent as MooringPost;
                if (mooringPost != null)
                {
                    mooringPost.UnReserveSpot(boat);
                }

                boat.PlaceAt(pt, dir, mRoutingSim);

                BoatRoutingComponent boatRoutingComponent = boat.RoutingComponent as BoatRoutingComponent;
                if (boatRoutingComponent != null)
                {
                    boatRoutingComponent.ForceUpdateDynamicFootprint();
                    boatRoutingComponent.EnableDynamicFootprint();
                }

                mRoutingSim.FadeOut(true, 0.5f, null);

                if (!boat.HaveSimWaitBeforeGettingIn(mRoutingSim))
                {
                    mRoutingSim.FadeIn(false, 0f);
                    return(ActionResult.Terminate);
                }

                boat.SimIsGettingIn = true;

                if (boat.Driver == null)
                {
                    boat.PutInDriver(mRoutingSim);
                }
                else
                {
                    boat.PutInPassenger(mRoutingSim);
                }

                boat.SimIsGettingIn = false;

                if (!(boat is BoatTaxi))
                {
                    mRoutingSim.FadeIn(true, 0.5f);
                }

                GameObject objectInRightHand = mRoutingSim.GetObjectInRightHand();
                if (objectInRightHand != null && !(objectInRightHand is Sim))
                {
                    objectInRightHand.SetHiddenFlags(HiddenFlags.Model);
                }

                mRoutingSim.SimRoutingComponent.ClearPush();

                mOriginalRoute.FollowerAgeGenderSpecies = (uint)boat.GetBoatSpecies();
                mOriginalRoute.Follower = boat.Proxy;
                mOriginalRoute.SetOption2(Route.RouteOption2.BeginAsBoat, true);
                mOriginalRoute.SetOption2(Route.RouteOption2.UseFollowerStartOrientation, boat.UsesTurnHelperFootprint());
                mOriginalRoute.SetOption(Route.RouteOption.RouteAsGhost, false);

                return(ActionResult.ContinueAndPopPathAndReplan);
            }
            catch
            {
                if (boat != null && boat.DestroyOnRelease)
                {
                    boat.Destroy();
                }
                throw;
            }
            finally
            {
                mRoutingSim.SimRoutingComponent.DisallowBeingPushed = false;
            }
        }
コード例 #7
0
        public ActionResult NM_PerformAction()
        {
            if (dontCall)
            {
                return(ActionResult.Continue);
            }

            Vehicle vehicle = null;

            try
            {
                var simRoutingComponentx = mRoutingSim.SimRoutingComponent;

                mRoutingSim.PopHoverboardPostureIfNecessary();

                simRoutingComponentx.DisallowBeingPushed = true;
                simRoutingComponentx.TriggerOnCarSequenceStartedEvent();

                if (mRoutingSim.HasExitReason((ExitReason)mOriginalRoute.ExitReasonsInterrupt))
                {
                    AddFailureExplanation(FailureExplanation.CancelledByScript);
                    return(ActionResult.Terminate);
                }

                Lot lot = (mOriginalRoute == null) ? mRoutingSim.LotCurrent : LotManager.GetLotAtPoint(mOriginalRoute.GetOriginalStartPoint());
                vehicle = Sim_GetVehicle(mRoutingSim, lot, GameUtils.IsInstalled(ProductVersion.EP8));
                if (vehicle == null || vehicle.HasBeenDestroyed)
                {
                    AddFailureExplanation(FailureExplanation.VehicleSequenceFailure);
                    return(ActionResult.Terminate);
                }


                mOriginalRoute.SetOption(Route.RouteOption.EnableUFOPlanning, vehicle is CarUFO);
                Household household = mRoutingSim.Household;
                if (household != null)
                {
                    CarOwnable carOwnable = vehicle as CarOwnable;
                    if (carOwnable != null && carOwnable.GeneratedOwnableForNpc)
                    {
                        Lot lotHome = household.LotHome;
                        if (lotHome != null)
                        {
                            int cost = carOwnable.Cost;
                            if (household.FamilyFunds >= cost)
                            {
                                household.ModifyFamilyFunds(-cost);
                            }
                            else
                            {
                                household.UnpaidBills += cost;
                            }
                            carOwnable.GeneratedOwnableForNpc = (lotHome == null);
                            carOwnable.DestroyOnRelease       = (lotHome == null);
                            carOwnable.LotHome = lotHome;
                        }
                    }
                }


                Vector3 pt;
                mOriginalRoute.GetSegmentStartPoint(0u, out pt);
                Vector3 dir;
                mOriginalRoute.GetSegmentStartDirection(0u, out dir);

                ItemComponent itemComp = vehicle.ItemComp;
                if (itemComp != null && itemComp.InventoryParent != null)
                {
                    itemComp.InventoryParent.RemoveByForce(vehicle);
                }

                vehicle.PlaceAt(pt, dir, mRoutingSim);

                if (vehicle is Bicycle && mRoutingSim.Posture.Satisfies(CommodityKind.CarryingObject, null))
                {
                    InteractionInstance standingTransition = mRoutingSim.Posture.GetStandingTransition();
                    if (standingTransition != null)
                    {
                        standingTransition.RunInteraction();
                    }
                }

                if (GameUtils.IsInstalled(ProductVersion.EP9))
                {
                    mRoutingSim.PopBackpackPostureIfNecessary();
                    if (mRoutingSim.SimDescription.IsPlantSim)
                    {
                        (mRoutingSim.RoutingComponent as SimRoutingComponent).StopPlantSimRoutingVFX();
                    }
                }

                mRoutingSim.PopJetpackPostureIfNecessary();
                mRoutingSim.FadeOut(true, 0.5f, null);

                if (vehicle.Driver == null)
                {
                    vehicle.PutInDriver(mRoutingSim);
                }
                else
                {
                    vehicle.PutInPassenger(mRoutingSim);
                }

                mRoutingSim.FadeIn(true, 0.5f);

                var objectInRightHand = mRoutingSim.GetObjectInRightHand();
                if (objectInRightHand != null && !(objectInRightHand is Sim))
                {
                    objectInRightHand.SetHiddenFlags(HiddenFlags.Model);
                }

                simRoutingComponentx.ClearPush();

                var followSubPathRouteAction = new VehicleFollowSubPathRouteAction(vehicle, mOriginalRoute);
                followSubPathRouteAction.AssociatedSim = mRoutingSim;

                mRoutingSim.RoutingComponent.InsertRouteActionAfter(this, followSubPathRouteAction);

                return(ActionResult.Continue);
            }
            catch
            {
                if (vehicle != null && vehicle.DestroyOnRelease)
                {
                    vehicle.Destroy();
                }
                throw;
            }
            finally
            {
                mRoutingSim.SimRoutingComponent.DisallowBeingPushed = false;
            }
        }
コード例 #8
0
        private static string IsOnActiveLot(Sim sim, bool testViewLot)
        {
            if (sim == null)
            {
                return(null);
            }

            if (sim.LotCurrent == null)
            {
                return(null);
            }

            if (Household.ActiveHousehold != null)
            {
                if (Occupation.DoesLotHaveAnyActiveJobs(sim.LotCurrent))
                {
                    return("ActiveJob");
                }

                if ((sim.LotCurrent != null) && (sim.LotCurrent.CanSimTreatAsHome(Sim.ActiveActor)))
                {
                    return("ActiveHouse");
                }

                foreach (Sim member in HouseholdsEx.AllSims(Household.ActiveHousehold))
                {
                    if (sim.LotCurrent == member.LotCurrent)
                    {
                        return("ActiveOnLot");
                    }
                }

                if (testViewLot)
                {
                    if ((!CameraController.IsMapViewModeEnabled()) && (sim.LotCurrent == LotManager.GetLotAtPoint(CameraController.GetLODInterestPosition())))
                    {
                        return("ViewLot");
                    }
                }
            }

            return(null);
        }