Пример #1
0
        public override bool Run()
        {
            try
            {
                GoToVenue.Item choice = GoToVenue.GetChoices(Actor, Common.Localize("GoToVenueWith:MenuName", Actor.IsFemale));
                if (choice == null)
                {
                    return(false);
                }

                InteractionInstance interaction = null;
                if (choice.Value.IsCommunityLot)
                {
                    interaction = VisitCommunityLotWith.VisitWithSingleton.CreateInstance(choice.Value, Actor, GetPriority(), Autonomous, CancellableByPlayer);
                }
                else
                {
                    interaction = VisitLotWith.VisitWithSingleton.CreateInstance(choice.Value, Actor, GetPriority(), Autonomous, CancellableByPlayer);
                }

                if (Actor == Target)
                {
                    interaction.SelectedObjects = SelectedObjects;
                }
                else
                {
                    interaction.SelectedObjects = new List <object>();
                    interaction.SelectedObjects.Add(Target);
                }

                Actor.InteractionQueue.PushAsContinuation(interaction, true);
                return(true);
            }
            catch (ResetException)
            {
                throw;
            }
            catch (Exception e)
            {
                Common.Exception(Actor, Target, e);
                return(false);
            }
        }
Пример #2
0
        public override bool Run()
        {
            try
            {
                GoToVenue.Item choice = GoToVenue.GetChoices(Actor, Terrain.GoJogging.LocalizeString(Actor.IsFemale, "InteractionName", new object[0x0]));
                if (choice == null)
                {
                    return(false);
                }

                Actor.SwitchToOutfitWithSpin(Sim.ClothesChangeReason.GoingToWorkOut);

                Sim.WalkStyle simWalkStyle = Actor.SimWalkStyle;
                mAthleticSkill = Actor.SkillManager.GetSkill <Athletic>(SkillNames.Athletic);
                if (mAthleticSkill.SkillLevel >= Terrain.JogHere.AthleticSkillLevelToFastJog)
                {
                    RequestWalkStyle(Sim.WalkStyle.FastJog);
                }
                else
                {
                    RequestWalkStyle(Sim.WalkStyle.Jog);
                }

                Destination = Actor.Position;
                mLastTime   = SimClock.ElapsedTime(TimeUnit.Minutes);
                AlarmHandle handle  = Actor.AddAlarmRepeating(1f, TimeUnit.Minutes, JogLoop, 1f, TimeUnit.Minutes, "Jog Here: Check for Fatigued Buff", AlarmType.DeleteOnReset);
                AlarmHandle handle2 = Actor.AddAlarm(Terrain.JogHere.AthleticTuning.MinsToAddPumped, TimeUnit.Minutes, AddPumped, "AthleticGameObject: Pumped", AlarmType.DeleteOnReset);

                float num = 1f - (Terrain.JogHere.AthleticTuning.DelayFatiguePercentagePerAthleticSkillLevel * mAthleticSkill.SkillLevel);
                if (num <= 0f)
                {
                    num = 0f;
                }

                float multiplier = 1f;
                if (Actor.TraitManager.HasElement(TraitNames.Athletic))
                {
                    multiplier = Terrain.JogHere.AthleticTuning.AthleticTraitDestressMultiplier;
                }

                StandardEntry();
                BeginCommodityUpdate(CommodityKind.Fun, multiplier);
                if (mAthleticSkill.IsFitnessNut())
                {
                    num = 0f;
                }

                float athleticTraitSimFatigueMultiplier = 1f;
                if (Actor.TraitManager.HasElement(TraitNames.Athletic))
                {
                    athleticTraitSimFatigueMultiplier = TraitTuning.AthleticTraitSimFatigueMultiplier;
                }

                Lot currentLot = Actor.LotCurrent;

                bool succeeded = false;
                try
                {
                    BeginCommodityUpdate(CommodityKind.Fatigue, num * athleticTraitSimFatigueMultiplier);
                    BeginCommodityUpdates();

                    if (CurrentTone is Athletic.NoSweatTone)
                    {
                        DisableMotiveDelta(CommodityKind.Hygiene);
                    }

                    StartFitness(Actor);

                    Route r = Actor.CreateRoute();
                    r.SetOption(Route.RouteOption.EnablePlanningAsCar, false);
                    r.SetOption(Route.RouteOption.EnableSubwayPlanning, false);
                    r.SetOption(Route.RouteOption.DoNotEmitDegenerateRoutesForRadialRangeGoals, true);
                    r.SetOption(Route.RouteOption.DoLineOfSightCheckUserOverride, true);
                    r.SetOption(Route.RouteOption.CheckForFootprintsNearGoals, true);

                    choice.Value.PlanToLot(r);
                    succeeded = Actor.DoRoute(r);

                    r = Actor.CreateRoute();
                    r.SetOption(Route.RouteOption.EnablePlanningAsCar, false);
                    r.SetOption(Route.RouteOption.EnableSubwayPlanning, false);
                    r.SetOption(Route.RouteOption.DoNotEmitDegenerateRoutesForRadialRangeGoals, true);
                    r.SetOption(Route.RouteOption.DoLineOfSightCheckUserOverride, true);
                    r.SetOption(Route.RouteOption.CheckForFootprintsNearGoals, true);

                    currentLot.PlanToLot(r);
                    succeeded = succeeded && Actor.DoRoute(r);
                }
                finally
                {
                    StopFitness(Actor);

                    EndCommodityUpdates(succeeded);
                    StandardExit();
                }

                Actor.RemoveAlarm(handle);
                Actor.RemoveAlarm(handle2);

                Actor.BuffManager.UnpauseBuff(BuffNames.Pumped);
                return(succeeded);
            }
            catch (ResetException)
            {
                throw;
            }
            catch (Exception e)
            {
                Common.Exception(Actor, Target, e);
                return(false);
            }
        }