Пример #1
0
        public static Boat Sim_GetBoatForGetInBoatRouteAction(Sim ths, Lot lot)
        {
            bool disallowedOnlyTemporary = false;

            if (ths.GetObjectInRightHand() == null && ths.InteractionQueue != null)
            {
                LeaderGoHereWith leaderGoHereWith = ths.InteractionQueue.RunningInteraction as LeaderGoHereWith;
                List <Sim>       followers        = null;

                if (leaderGoHereWith != null)
                {
                    GoHereWithSituation situation = leaderGoHereWith.Situation;
                    if (situation != null)
                    {
                        followers = situation.Followers;
                    }
                }

                var ttt = ths.GetOwnedAndUsableBoat(lot, true, followers, ref disallowedOnlyTemporary);
                if (ttt != null)
                {
                    return(ttt);
                }
            }
            return(Vehicle.CreateTaxiBoat());
        }
Пример #2
0
        private static InteractionInstance CreateGoHereWithInteractionInstance(SimRoutingComponent ths, Route r, List <Sim> followers, InteractionPriority priority, bool cancellableByPlayer, out InteractionInstance ownerInteraction, GoHereWithSituation.OnFailBehavior failureBehavior, Vector3 teleportLocation)
        {
            Sim properLeader = ths.GetProperLeader(ths.OwnerSim, followers);
            InteractionInstanceParameters parameters = new InteractionInstanceParameters(new InteractionObjectPair(LeaderGoHereWith.Singleton, Terrain.Singleton), properLeader, priority, false, cancellableByPlayer);
            LeaderGoHereWith with = LeaderGoHereWith.Singleton.CreateInstanceFromParameters(ref parameters) as LeaderGoHereWith;

            with.SetOwner(ths.OwnerSim);

            with.OnFailBehavior = failureBehavior;
            if (teleportLocation != Vector3.Invalid)
            {
                with.TeleportDestination = teleportLocation;
            }
            else if (failureBehavior == GoHereWithSituation.OnFailBehavior.Teleport)
            {
                with.TeleportDestination = r.GetDestPoint();
            }

            if (properLeader != ths.OwnerSim)
            {
                followers = new List <Sim>(followers);
                followers.Remove(properLeader);
                Route route = r.ShallowCopy();
                route.ExitReasonsInterrupt = r.ExitReasonsInterrupt;
                ths.UpdateRoutingOptionsFromLeader(properLeader, route);
                route.Follower = properLeader.Proxy;
                route.Replan();
                with.SetRouteToFollow(route);
            }
            else
            {
                with.SetRouteToFollow(r);
            }

            with.SetFollowers(followers);
            GoHereWithSituationEx.CreateSituation(with);
            if (properLeader != ths.OwnerSim)
            {
                ownerInteraction = new SlaveLeaderGoHereWith.Definition(with.Situation).CreateInstance(Terrain.Singleton, ths.OwnerSim, priority, false, cancellableByPlayer);
            }
            else
            {
                ownerInteraction = null;
            }

            return(with);
        }
Пример #3
0
 public static void CreateSituation(LeaderGoHereWith ths)
 {
     ths.mSituation = new GoHereWithSituationEx(ths.mOwner, ths.Actor, ths.mFollowers, ths.mRouteToFollow, ths.mMeetupPointCallback, ths.mOnFailBehavior, ths.mTeleportDestination);
     ths.mSituation.LeaderInteraction = ths;
 }