Example #1
0
        public override bool Run()
        {
            try
            {
                List <Sim> followers = new List <Sim>();
                if (SelectedObjects != null)
                {
                    foreach (object obj2 in SelectedObjects)
                    {
                        followers.Add(obj2 as Sim);
                    }
                }

                if (Target.LotCurrent != Actor.LotCurrent)
                {
                    Route r = Actor.CreateRoute();
                    Target.LotCurrent.PlanToLot(r);
                    Actor.DoRouteWithFollowers(r, followers);
                    Lot.ValidateFollowers(followers);
                }

                Definition definition = InteractionDefinition as Definition;

                InteractionDefinition summon = new SummonWeatherEx.Definition(definition.mType);

                foreach (Sim sim in followers)
                {
                    if (sim.LotCurrent == Target.LotCurrent)
                    {
                        InteractionPriority priority = GetPriority();
                        if (!sim.IsSelectable)
                        {
                            priority = new InteractionPriority(InteractionPriorityLevel.NonCriticalNPCBehavior);
                        }
                        sim.InteractionQueue.AddNext(summon.CreateInstance(Target, sim, priority, Autonomous, CancellableByPlayer));
                    }
                }

                Actor.InteractionQueue.PushAsContinuation(summon, Target, true);
                return(true);
            }
            catch (ResetException)
            {
                throw;
            }
            catch (Exception e)
            {
                Common.Exception(Actor, Target, e);
                return(false);
            }
        }
Example #2
0
        public override bool Run()
        {
            try
            {
                List<Sim> followers = new List<Sim>();
                if (SelectedObjects != null)
                {
                    foreach (object obj2 in SelectedObjects)
                    {
                        followers.Add(obj2 as Sim);
                    }
                }

                if (Target.LotCurrent != Actor.LotCurrent)
                {
                    Route r = Actor.CreateRoute();
                    Target.LotCurrent.PlanToLot(r);
                    Actor.DoRouteWithFollowers(r, followers);
                    Lot.ValidateFollowers(followers);
                }

                Definition definition = InteractionDefinition as Definition;

                InteractionDefinition summon = new SummonWeatherEx.Definition(definition.mType);

                foreach (Sim sim in followers)
                {
                    if (sim.LotCurrent == Target.LotCurrent)
                    {
                        InteractionPriority priority = GetPriority();
                        if (!sim.IsSelectable)
                        {
                            priority = new InteractionPriority(InteractionPriorityLevel.NonCriticalNPCBehavior);
                        }
                        sim.InteractionQueue.AddNext(summon.CreateInstance(Target, sim, priority, Autonomous, CancellableByPlayer));
                    }
                }

                Actor.InteractionQueue.PushAsContinuation(summon, Target, true);
                return true;
            }
            catch (ResetException)
            {
                throw;
            }
            catch (Exception e)
            {
                Common.Exception(Actor, Target, e);
                return false;
            }
        }