コード例 #1
0
        // Methods
        public override bool Run()
        {
            Debugger debugger = HomeBartender.debugger;

            debugger.Debug(base.Actor, "Trying to activate role");
            try
            {
                Role assignedRole = base.Actor.SimDescription.AssignedRole;
                if ((assignedRole != null) && assignedRole.IsActive)
                {
                    debugger.Debug(base.Actor, "Role is active");
                    Lot        target           = null;
                    GameObject roleGivingObject = assignedRole.RoleGivingObject as GameObject;
                    if (roleGivingObject != null)
                    {
                        target = roleGivingObject.LotCurrent;
                    }

                    if (target != null)
                    {
                        debugger.Debug(base.Actor, "Lot is found");
                        InteractionInstance instance = null;
                        if (target.IsCommunityLot)
                        {
                            instance = VisitCommunityLot.Singleton
                                       .CreateInstance(target, base.Actor, base.GetPriority(), false, false);
                            debugger.Debug(base.Actor, "going to community");
                        }
                        else
                        {
                            instance = GoToLot.Singleton
                                       .CreateInstance(target, base.Actor, base.GetPriority(), false, false);
                            // Greet to get inside, visitsituation to really do something inside
                            debugger.Debug(base.Actor, "going to residential");
                            if (VisitSituation.FindVisitSituationInvolvingGuest(base.Actor) == null)
                            {
                                VisitSituation.Create(base.Actor, target);
                            }
                            base.Actor.GreetSimOnLot(target);
                        }
                        debugger.Debug(base.Actor, "instance created");
                        if (base.TryPushAsContinuation(instance))
                        {
                            assignedRole.UpdateFulfillingLot(target.LotId);
                            debugger.Debug(base.Actor, "Sim is coming! " + Actor.FullName);
                            return(true);
                        }
                    }
                    assignedRole.UpdateFulfillingLot(0L);
                }
            }
            catch (Exception ex)
            {
                debugger.DebugError(base.Actor, "Cannot take role sims to role lot", ex);
            }
            return(false);
        }
コード例 #2
0
        // Methods
        public override bool Run()
        {
            try
            {
                Role assignedRole = base.Actor.SimDescription.AssignedRole;
                if ((assignedRole != null) && assignedRole.IsActive)
                {
                    Lot             target = null;
                    DrunkardsBottle bottle = assignedRole.RoleGivingObject as DrunkardsBottle;
                    if (bottle != null)
                    {
                        target = bottle.GetTargetLot();
                    }

                    if (target != null)
                    {
                        InteractionInstance instance = null;
                        if (target.IsCommunityLot)
                        {
                            instance = VisitCommunityLot.Singleton
                                       .CreateInstance(target, base.Actor, base.GetPriority(), false, false);
                        }
                        else
                        {
                            instance = GoToLot.Singleton
                                       .CreateInstance(target, base.Actor, base.GetPriority(), false, false);
                            // Greet to get inside, visitsituation to really do something inside

                            if (VisitSituation.FindVisitSituationInvolvingGuest(base.Actor) == null)
                            {
                                VisitSituation.Create(base.Actor, target);
                            }
                            base.Actor.GreetSimOnLot(target);
                        }

                        if (base.TryPushAsContinuation(instance))
                        {
                            assignedRole.UpdateFulfillingLot(target.LotId);
                            return(true);
                        }
                    }
                    assignedRole.UpdateFulfillingLot(0L);
                }
            }
            catch (Exception ex)
            {
                Message.Sender.ShowError(base.Actor, "Cannot take role sims to role lot", false, ex);
            }
            return(false);
        }
コード例 #3
0
        // Methods
        public override bool Run()
        {
            try
            {
                Role assignedRole = base.Actor.SimDescription.AssignedRole;
                if ((assignedRole != null) && assignedRole.IsActive)
                {
                    Lot        target           = null;
                    GameObject roleGivingObject = assignedRole.RoleGivingObject as GameObject;
                    if (roleGivingObject != null)
                    {
                        target = roleGivingObject.LotCurrent;
                    }

                    if (target != null)
                    {
                        InteractionInstance instance = null;
                        if (target.IsCommunityLot)
                        {
                            instance = VisitCommunityLot.Singleton
                                       .CreateInstance(target, base.Actor, base.GetPriority(), false, false);
                        }
                        else
                        {
                            instance = GoToLot.Singleton
                                       .CreateInstance(target, base.Actor, base.GetPriority(), false, false);
                            // Greet to get inside, visitsituation to really do something inside

                            if (VisitSituation.FindVisitSituationInvolvingGuest(base.Actor) == null)
                            {
                                VisitSituation.Create(base.Actor, target);
                            }
                            base.Actor.GreetSimOnLot(target);
                        }
                        if (base.TryPushAsContinuation(instance))
                        {
                            assignedRole.UpdateFulfillingLot(target.LotId);
                            return(true);
                        }
                    }
                    assignedRole.UpdateFulfillingLot(0L);
                }
            }
            catch (Exception ex)
            {
            }
            return(false);
        }