public override bool Test(Sim a, Sim target, bool isAutonomous, ref GreyedOutTooltipCallback greyedOutTooltipCallback) { try { if (!NestedSocialInteraction <CuddleSeated> .Test(a, target)) { greyedOutTooltipCallback = Common.DebugTooltip("Not Cuddle Seated"); return(false); } SittingPosture posture = a.Posture as SittingPosture; if (posture != null) { if (!(posture.Container is SaunaClassic)) { greyedOutTooltipCallback = Common.DebugTooltip("Actor Not In Sauna"); return(false); } } posture = target.Posture as SittingPosture; if (posture != null) { if (!(posture.Container is SaunaClassic)) { greyedOutTooltipCallback = Common.DebugTooltip("Target Not In Sauna"); return(false); } } return(true); } catch (Exception exception) { Common.Exception(a, target, exception); } return(false); }
public static bool StateMachineEnterAndSit(MultiSeatObject ths, StateMachineClient smc, SittingPosture sitPosture, Slot routingSlot, object sitContext) { if (!SittableComponentEx.StateMachineEnterAndSit(ths.Sittable, smc, sitPosture, routingSlot, sitContext)) { return false; } SittableComponent.SitContext context = sitContext as SittableComponent.SitContext; if (((context != null) && (context.PreferredSeat != null)) && (context.PreferredSeat.ContainedSim == null)) { Scoot entry = (Scoot)Scoot.Singleton.CreateInstance(sitPosture.Container, sitPosture.Sim, sitPosture.Sim.InteractionQueue.GetHeadInteraction().GetPriority(), false, true); entry.TargetSeat = context.PreferredSeat as Seat; if (entry.TargetSeat != null) { sitPosture.Sim.InteractionQueue.AddNext(entry); } } if ((ths.SculptureComponent != null) && (ths.SculptureComponent.Material == SculptureComponent.SculptureMaterial.Ice)) { sitPosture.Sim.BuffManager.AddElementPaused(BuffNames.Chilly, Origin.FromSittingOnIce); } return true; }
public static bool StateMachineEnterAndSit(SaunaClassic ths, bool forWoohoo, StateMachineClient smc, SittingPosture sitPosture, Slot routingSlot, object sitContext) { /* * if (sitPosture.Sim.SimDescription.IsVisuallyPregnant) * { * ThoughtBalloonManager.BalloonData bd = null; * bd = new ThoughtBalloonManager.BalloonData("balloon_moodlet_pregnant"); * if (bd != null) * { * sitPosture.Sim.ThoughtBalloonManager.ShowBalloon(bd); * } * return false; * } */ if ((sitPosture.Sim.CarryingChildPosture != null) || (sitPosture.Sim.CarryingPetPosture != null)) { return(false); } if (!sitPosture.Sim.HasTrait(TraitNames.NeverNude)) { bool change = false; if ((Woohooer.Settings.mNakedOutfitSaunaGeneral) || ((forWoohoo) && (Woohooer.Settings.mNakedOutfitSaunaWoohoo))) { if (sitPosture.Sim.SimDescription.Teen) { if (Woohooer.Settings.mAllowTeenWoohoo) { change = true; } } else if (sitPosture.Sim.SimDescription.YoungAdultOrAbove) { change = true; } } if (change) { sitPosture.Sim.SwitchToOutfitWithSpin(OutfitCategories.Naked, 0); Woohooer.Settings.AddChange(sitPosture.Sim); } else { sitPosture.Sim.SwitchToOutfitWithSpin(Sim.ClothesChangeReason.GoingToSwim); } } if (!MultiSeatObjectEx.StateMachineEnterAndSit(ths, smc, sitPosture, routingSlot, sitContext)) { return(false); } sitPosture.Interactions.Remove(new InteractionObjectPair(StartSeatedCuddleA.Singleton, sitPosture.Sim)); sitPosture.Sim.RemoveInteractionByType(StartSeatedCuddleA.Singleton); List <InteractionDefinition> list = sitPosture.mSocialInteractionDefinitions as List <InteractionDefinition>; if (list != null) { list.Remove(StartSeatedCuddleA.Singleton); } sitPosture.AddInteraction(SaunaClassic.CuddleSeatedWooHooSauna.Singleton, sitPosture.Sim); sitPosture.AddInteraction(SaunaClassic.CuddleSeatedWooHooSauna.TryForBoySingleton, sitPosture.Sim); sitPosture.AddInteraction(SaunaClassic.CuddleSeatedWooHooSauna.TryForGirlSingleton, sitPosture.Sim); sitPosture.AddInteraction(SaunaClassic.StartSaunaSeatedCuddleA.Singleton, sitPosture.Sim); sitPosture.AddSocialInteraction(SaunaClassic.StartSaunaSeatedCuddleA.Singleton); sitPosture.Sim.BuffManager.AddElementPaused((BuffNames)(0x9a7f5f1919df0018L), Origin.None); return(true); }
public override bool Run() { try { SitData data2; Slot slot2; object obj2; SittingPosture posture2; ISittable sittable = SittingHelpers.CastToSittable(Target); if (sittable == null) { Actor.AddExitReason(ExitReason.FailedToStart); return(false); } Slot containmentSlotClosestToHit = GetContainmentSlotClosestToHit(); if (Actor.Posture.Container == Target) { SittingPosture posture = Actor.Posture as SittingPosture; if (posture != null) { SitData target = posture.Part.Target; if (containmentSlotClosestToHit == target.ContainmentSlot) { return(true); } if (!Stand.Singleton.CreateInstance(Target, Actor, GetPriority(), Autonomous, CancellableByPlayer).RunInteraction()) { return(false); } } } SimQueue simLine = Target.SimLine; if ((simLine != null) && !simLine.WaitForTurn(this, SimQueue.WaitBehavior.DontPlayRouteFail | SimQueue.WaitBehavior.NeverWait, ~(ExitReason.Replan | ExitReason.MidRoutePushRequested | ExitReason.ObjectStateChanged | ExitReason.PlayIdle | ExitReason.MaxSkillPointsReached), 0f)) { Sim firstSim = simLine.FirstSim; if ((firstSim != null) && (firstSim.InteractionQueue.TransitionInteraction is Stand)) { Actor.RemoveExitReason(ExitReason.ObjectInUse); simLine.WaitForTurn(this, SimQueue.WaitBehavior.DontPlayRouteFail | SimQueue.WaitBehavior.OnlyWaitAtHeadOfLine, ~(ExitReason.Replan | ExitReason.MidRoutePushRequested | ExitReason.ObjectStateChanged | ExitReason.PlayIdle | ExitReason.MaxSkillPointsReached), kTimeToWait); } } if (!sittable.RouteToForSitting(Actor, containmentSlotClosestToHit, true, out data2, out slot2, out obj2)) { return(false); } sittable = SittingHelpers.CastToSittable(data2.Container); if (!SittingHelpers.ReserveSittable(this, Actor, sittable, data2)) { return(false); } StateMachineClient smc = sittable.StateMachineAcquireAndInit(Actor); if (smc == null) { Actor.AddExitReason(ExitReason.NullValueFound); SittingHelpers.UnreserveSittable(this, sittable, data2); return(false); } ISittingPostureCreator parent = data2.Container.Parent as ISittingPostureCreator; if (parent != null) { posture2 = parent.CreatePosture(data2.Container, Actor, smc, data2); } else { posture2 = new SittingPosture(data2.Container, Actor, smc, data2); } if (smc.HasActorDefinition("surface")) { smc.SetActor("surface", data2.Container); } BeginCommodityUpdates(); Actor.LookAtManager.DisableLookAts(); bool flag = (Actor.CarryStateMachine != null) && (Actor.GetObjectInRightHand() is IUseCarrySitTransitions); if (flag) { Actor.CarryStateMachine.RequestState(false, "x", "CarrySitting"); } Definition definition = InteractionDefinition as Definition; if (!SaunaClassicEx.StateMachineEnterAndSit(sittable as SaunaClassic, definition.mForWoohoo, smc, posture2, slot2, obj2)) { if (flag) { Actor.CarryStateMachine.RequestState(false, "x", "Carry"); } Actor.LookAtManager.EnableLookAts(); Actor.AddExitReason(ExitReason.NullValueFound); SittingHelpers.UnreserveSittable(this, sittable, data2); EndCommodityUpdates(false); return(false); } Actor.LookAtManager.EnableLookAts(); Actor.Posture = posture2; if (sittable.ComfyScore > 0x0) { Actor.BuffManager.AddElement(BuffNames.Comfy, sittable.ComfyScore, Origin.FromComfyObject); } EndCommodityUpdates(true); StandardExit(false, false); if (Actor.HasExitReason(ExitReason.UserCanceled)) { Actor.AddExitReason(ExitReason.CancelledByPosture); } if (mIsMaster) { SaunaSit linked = LinkedInteractionInstance as SaunaSit; if (linked != null) { Sim linkedActor = linked.Actor; while (!Cancelled) { if (!linkedActor.InteractionQueue.HasInteraction(linked)) { break; } if (linked.mCompleted) { break; } SpeedTrap.Sleep(10); } } } return(!Actor.HasExitReason()); } catch (ResetException) { throw; } catch (Exception e) { Common.Exception(Actor, Target, e); return(false); } }
public static bool StateMachineEnterAndSit(SittableComponent ths, StateMachineClient smc, SittingPosture sitPosture, Slot routingSlot, object sitContext) { if ((smc == null) || (sitPosture == null)) { return(false); } SitData target = sitPosture.Part.Target; bool paramValue = (ths.Owner.BoobyTrapComponent != null) ? ths.Owner.BoobyTrapComponent.CanTriggerTrap(sitPosture.Sim.SimDescription) : false; smc.SetParameter("isBoobyTrapped", paramValue); smc.SetParameter("sitTemplateSuffix", target.IKSuffix); smc.EnterState("x", ths.GetEnterStateName(routingSlot)); smc.RequestState("x", ths.GetSitStateName()); if (paramValue) { (ths.Owner as IBoobyTrap).TriggerTrap(sitPosture.Sim); smc.SetParameter("isBoobyTrapped", false); } ths.TurnOnFootDiscouragmentArea(target); return(true); }
public static EatingPosture GetPostureParam(Sim sim) { IEdible target = (IEdible)RandomUtil.GetRandomObjectFromList(Recipe.Recipes); if (sim.Posture.Satisfies(CommodityKind.Standing, target)) { return(EatingPosture.standing); } if (sim.Posture.Satisfies(CommodityKind.Sitting, target)) { SitData sitData = null; SittingPosture sittingPosture = sim.Posture as SittingPosture; if (sittingPosture != null) { sitData = sittingPosture.Part.Target; } else { ISittable sittable = SittingHelpers.CastToSittable(sim.Posture.Container as GameObject); if (sittable != null) { PartData partSimIsIn = sittable.PartComponent.GetPartSimIsIn(sim); sitData = (partSimIsIn as SitData); } } if (sitData != null) { switch (sitData.SitStyle) { case SitStyle.Dining: { if (target.Parent != sim) { return(EatingPosture.diningIn); } return(EatingPosture.diningOut); } case SitStyle.Living: { if (target is HotBeverageMachine.Cup) { return(EatingPosture.living); } if (target.Parent != sim) { return(EatingPosture.diningIn); } return(EatingPosture.diningOut); } case SitStyle.Stool: { if (target.Parent != sim) { return(EatingPosture.barstoolIn); } return(EatingPosture.barstoolOut); } } } return(EatingPosture.diningOut); } return(EatingPosture.standing); }
public static bool StateMachineEnterAndSit(SaunaClassic ths, bool forWoohoo, StateMachineClient smc, SittingPosture sitPosture, Slot routingSlot, object sitContext) { /* if (sitPosture.Sim.SimDescription.IsVisuallyPregnant) { ThoughtBalloonManager.BalloonData bd = null; bd = new ThoughtBalloonManager.BalloonData("balloon_moodlet_pregnant"); if (bd != null) { sitPosture.Sim.ThoughtBalloonManager.ShowBalloon(bd); } return false; } */ if ((sitPosture.Sim.CarryingChildPosture != null) || (sitPosture.Sim.CarryingPetPosture != null)) { return false; } if (!sitPosture.Sim.HasTrait(TraitNames.NeverNude)) { bool change = false; if ((Woohooer.Settings.mNakedOutfitSaunaGeneral) || ((forWoohoo) && (Woohooer.Settings.mNakedOutfitSaunaWoohoo))) { if (sitPosture.Sim.SimDescription.Teen) { if (Woohooer.Settings.mAllowTeenWoohoo) { change = true; } } else if (sitPosture.Sim.SimDescription.YoungAdultOrAbove) { change = true; } } if (change) { sitPosture.Sim.SwitchToOutfitWithSpin(OutfitCategories.Naked, 0); Woohooer.Settings.AddChange(sitPosture.Sim); } else { sitPosture.Sim.SwitchToOutfitWithSpin(Sim.ClothesChangeReason.GoingToSwim); } } if (!MultiSeatObjectEx.StateMachineEnterAndSit(ths, smc, sitPosture, routingSlot, sitContext)) { return false; } sitPosture.Interactions.Remove(new InteractionObjectPair(StartSeatedCuddleA.Singleton, sitPosture.Sim)); sitPosture.Sim.RemoveInteractionByType(StartSeatedCuddleA.Singleton); List<InteractionDefinition> list = sitPosture.mSocialInteractionDefinitions as List<InteractionDefinition>; if (list != null) { list.Remove(StartSeatedCuddleA.Singleton); } sitPosture.AddInteraction(SaunaClassic.CuddleSeatedWooHooSauna.Singleton, sitPosture.Sim); sitPosture.AddInteraction(SaunaClassic.CuddleSeatedWooHooSauna.TryForBoySingleton, sitPosture.Sim); sitPosture.AddInteraction(SaunaClassic.CuddleSeatedWooHooSauna.TryForGirlSingleton, sitPosture.Sim); sitPosture.AddInteraction(SaunaClassic.StartSaunaSeatedCuddleA.Singleton, sitPosture.Sim); sitPosture.AddSocialInteraction(SaunaClassic.StartSaunaSeatedCuddleA.Singleton); sitPosture.Sim.BuffManager.AddElementPaused((BuffNames)(0x9a7f5f1919df0018L), Origin.None); return true; }
public static bool StateMachineEnterAndSit(MultiSeatObject ths, StateMachineClient smc, SittingPosture sitPosture, Slot routingSlot, object sitContext) { if (!SittableComponentEx.StateMachineEnterAndSit(ths.Sittable, smc, sitPosture, routingSlot, sitContext)) { return(false); } SittableComponent.SitContext context = sitContext as SittableComponent.SitContext; if (((context != null) && (context.PreferredSeat != null)) && (context.PreferredSeat.ContainedSim == null)) { Scoot entry = (Scoot)Scoot.Singleton.CreateInstance(sitPosture.Container, sitPosture.Sim, sitPosture.Sim.InteractionQueue.GetHeadInteraction().GetPriority(), false, true); entry.TargetSeat = context.PreferredSeat as Seat; if (entry.TargetSeat != null) { sitPosture.Sim.InteractionQueue.AddNext(entry); } } if ((ths.SculptureComponent != null) && (ths.SculptureComponent.Material == SculptureComponent.SculptureMaterial.Ice)) { sitPosture.Sim.BuffManager.AddElementPaused(BuffNames.Chilly, Origin.FromSittingOnIce); } return(true); }
public override bool Run() { try { SitData data2; Slot slot2; object obj2; SittingPosture posture2; ISittable sittable = SittingHelpers.CastToSittable(Target); if (sittable == null) { Actor.AddExitReason(ExitReason.FailedToStart); return false; } Slot containmentSlotClosestToHit = GetContainmentSlotClosestToHit(); if (Actor.Posture.Container == Target) { SittingPosture posture = Actor.Posture as SittingPosture; if (posture != null) { SitData target = posture.Part.Target; if (containmentSlotClosestToHit == target.ContainmentSlot) { return true; } if (!Stand.Singleton.CreateInstance(Target, Actor, GetPriority(), Autonomous, CancellableByPlayer).RunInteraction()) { return false; } } } SimQueue simLine = Target.SimLine; if ((simLine != null) && !simLine.WaitForTurn(this, SimQueue.WaitBehavior.DontPlayRouteFail | SimQueue.WaitBehavior.NeverWait, ~(ExitReason.Replan | ExitReason.MidRoutePushRequested | ExitReason.ObjectStateChanged | ExitReason.PlayIdle | ExitReason.MaxSkillPointsReached), 0f)) { Sim firstSim = simLine.FirstSim; if ((firstSim != null) && (firstSim.InteractionQueue.TransitionInteraction is Stand)) { Actor.RemoveExitReason(ExitReason.ObjectInUse); simLine.WaitForTurn(this, SimQueue.WaitBehavior.DontPlayRouteFail | SimQueue.WaitBehavior.OnlyWaitAtHeadOfLine, ~(ExitReason.Replan | ExitReason.MidRoutePushRequested | ExitReason.ObjectStateChanged | ExitReason.PlayIdle | ExitReason.MaxSkillPointsReached), kTimeToWait); } } if (!sittable.RouteToForSitting(Actor, containmentSlotClosestToHit, true, out data2, out slot2, out obj2)) { return false; } sittable = SittingHelpers.CastToSittable(data2.Container); if (!SittingHelpers.ReserveSittable(this, Actor, sittable, data2)) { return false; } StateMachineClient smc = sittable.StateMachineAcquireAndInit(Actor); if (smc == null) { Actor.AddExitReason(ExitReason.NullValueFound); SittingHelpers.UnreserveSittable(this, sittable, data2); return false; } ISittingPostureCreator parent = data2.Container.Parent as ISittingPostureCreator; if (parent != null) { posture2 = parent.CreatePosture(data2.Container, Actor, smc, data2); } else { posture2 = new SittingPosture(data2.Container, Actor, smc, data2); } if (smc.HasActorDefinition("surface")) { smc.SetActor("surface", data2.Container); } BeginCommodityUpdates(); Actor.LookAtManager.DisableLookAts(); bool flag = (Actor.CarryStateMachine != null) && (Actor.GetObjectInRightHand() is IUseCarrySitTransitions); if (flag) { Actor.CarryStateMachine.RequestState(false, "x", "CarrySitting"); } Definition definition = InteractionDefinition as Definition; if (!SaunaClassicEx.StateMachineEnterAndSit(sittable as SaunaClassic, definition.mForWoohoo, smc, posture2, slot2, obj2)) { if (flag) { Actor.CarryStateMachine.RequestState(false, "x", "Carry"); } Actor.LookAtManager.EnableLookAts(); Actor.AddExitReason(ExitReason.NullValueFound); SittingHelpers.UnreserveSittable(this, sittable, data2); EndCommodityUpdates(false); return false; } Actor.LookAtManager.EnableLookAts(); Actor.Posture = posture2; if (sittable.ComfyScore > 0x0) { Actor.BuffManager.AddElement(BuffNames.Comfy, sittable.ComfyScore, Origin.FromComfyObject); } EndCommodityUpdates(true); StandardExit(false, false); if (Actor.HasExitReason(ExitReason.UserCanceled)) { Actor.AddExitReason(ExitReason.CancelledByPosture); } if (mIsMaster) { SaunaSit linked = LinkedInteractionInstance as SaunaSit; if (linked != null) { Sim linkedActor = linked.Actor; while (!Cancelled) { if (!linkedActor.InteractionQueue.HasInteraction(linked)) break; if (linked.mCompleted) break; SpeedTrap.Sleep(10); } } } return !Actor.HasExitReason(); } catch (ResetException) { throw; } catch (Exception e) { Common.Exception(Actor, Target, e); return false; } }