protected void OnPregnancyEvent(StateMachineClient sender, IEvent evt) { IWooHooDefinition definition = InteractionDefinition as IWooHooDefinition; switch (definition.GetStyle(this)) { case CommonWoohoo.WoohooStyle.Safe: CommonSurrogate.DonateDNA(Actor, Target); return; case CommonWoohoo.WoohooStyle.Risky: case CommonWoohoo.WoohooStyle.TryForBaby: CommonSurrogatePregnancy.GetDNASamples(Actor, Target, ref dnaMale, ref dnaFemale); break; } if (CommonSurrogatePregnancy.IsSuccess(Actor, Target, Autonomous, definition.GetStyle(this))) { Pregnancy pregnancy = CommonSurrogatePregnancy.Impregnate(Actor, Target, dnaFemale, dnaMale, Autonomous, definition.GetStyle(this)); if (pregnancy != null) { if (Actor.Posture.Container is HeartShapedBed) { pregnancy.SetForcedBabyTrait(TraitNames.Excitable); } else if (Actor.Posture.Container is Igloo) { pregnancy.SetForcedBabyTrait(TraitNames.LovesTheCold); } } } }
public override bool Test(Sim actor, Sim target, bool isAutonomous, ref GreyedOutTooltipCallback callback) { try { if (!base.Test(actor, target, isAutonomous, ref callback)) { return(false); } return(CommonSurrogate.SatisfiesDonate(actor, target, "BedDonate", isAutonomous, true, true, ref callback)); } catch (ResetException) { throw; } catch (Exception e) { Common.Exception(actor, target, e); } return(false); }
public override bool Run() { try { Actor.GreetSimOnMyLotIfPossible(Target); if (StartBedCuddleA.GetCuddleType(Actor, Target) == StartBedCuddleA.CuddleType.CuddleTargetOnDifferentBed) { ChildUtils.SetPosturePrecondition(this, CommodityKind.Relaxing, new CommodityKind[] { CommodityKind.NextToTarget }); Actor.InteractionQueue.PushAsContinuation(this, true); return(true); } BedMultiPart container = null; try { if (Actor.Posture == null) { return(false); } if (!Actor.Posture.Satisfies(CommodityKind.Relaxing, null)) { return(false); } if (!SafeToSync()) { return(false); } container = Actor.Posture.Container as BedMultiPart; if (container == null) { return(false); } if (IsMaster && ReturnInstance == null) { EnterStateMachine("BedSocials", "FromRelax", "x", "y"); AddPersistentScriptEventHandler(0x0, EventCallbackChangeVisibility); SetActor("bed", container); container.PartComp.GetPartSimIsIn(Actor).SetPartParameters(mCurrentStateMachine); WooHoo interaction = InteractionDefinition.CreateInstance(Actor, Target, GetPriority(), false, CancellableByPlayer) as WooHoo; interaction.IsMaster = false; interaction.LinkedInteractionInstance = this; ChildUtils.SetPosturePrecondition(interaction, CommodityKind.Relaxing, new CommodityKind[] { CommodityKind.NextToTarget }); Target.InteractionQueue.AddNext(interaction); if (Target.Posture.Container != Actor.Posture.Container) { Actor.LookAtManager.SetInteractionLookAt(Target, 0xc8, LookAtJointFilter.TorsoBones); Actor.Posture.CurrentStateMachine.RequestState("x", "callOver"); } Actor.SynchronizationLevel = Sim.SyncLevel.Started; Actor.SynchronizationTarget = Target; Actor.SynchronizationRole = Sim.SyncRole.Initiator; if (!StartSync(IsMaster)) { return(false); } if (!Actor.WaitForSynchronizationLevelWithSim(Target, Sim.SyncLevel.Routed, 30f)) { return(false); } Actor.SocialComponent.StartSocializingWith(Target); } else if (!StartSync(IsMaster)) { return(false); } } catch (ResetException) { throw; } catch (Exception e) { Common.DebugException(Actor, Target, e); return(false); } StandardEntry(false); BeginCommodityUpdates(); bool succeeded = false; try { if (IsMaster) { if (CommonWoohoo.NeedPrivacy(container.InherentlyProvidesPrivacy, Actor, Target)) { mSituation = new WooHooPrivacySituation(this); if (!mSituation.Start()) { FinishLinkedInteraction(); PostLoop(); if (ReturnInstance == null) { InteractionInstance instance = BedRelax.Singleton.CreateInstance(Actor.Posture.Container, Actor, GetPriority(), true, true); Actor.InteractionQueue.PushAsContinuation(instance, true); } else { DoResume(); } WooHoo linkedInteractionInstance = LinkedInteractionInstance as WooHoo; if (linkedInteractionInstance != null) { if (ReturnInstance == null) { InteractionInstance instance2 = BedRelax.Singleton.CreateInstance(Target.Posture.Container, Target, GetPriority(), true, true); Target.InteractionQueue.PushAsContinuation(instance2, true); } else { linkedInteractionInstance.DoResume(); } linkedInteractionInstance.Failed = true; } WaitForSyncComplete(); return(false); } } IWooHooDefinition definition = InteractionDefinition as IWooHooDefinition; Actor.LookAtManager.ClearInteractionLookAt(); Target.LookAtManager.ClearInteractionLookAt(); if (ReturnInstance != null) { ReturnInstance.EnsureMaster(); mCurrentStateMachine = ReturnInstance.mCurrentStateMachine; } StartSocial(CommonSurrogate.GetSocialName(definition.GetStyle(this))); InitiateSocialUI(Actor, Target); WooHoo linked = LinkedInteractionInstance as WooHoo; if (linked != null) { linked.Rejected = Rejected; } if (Rejected) { if (Actor.Posture.Container == Target.Posture.Container) { ThoughtBalloonManager.BalloonData bd = new ThoughtBalloonManager.DoubleBalloonData("balloon_woohoo", "balloon_question"); bd.BalloonType = ThoughtBalloonTypes.kSpeechBalloon; Actor.ThoughtBalloonManager.ShowBalloon(bd); AddOneShotScriptEventHandler(0x194, ShowRejectBalloonAndEnqueueRouteAway); mCurrentStateMachine.RequestState(false, "x", "WooHooReject"); mCurrentStateMachine.RequestState(true, "y", "WooHooReject"); mCurrentStateMachine.RequestState(true, null, "ToRelax"); } } else { mCurrentStateMachine.AddOneShotScriptEventHandler(0x6e, OnPregnancyEvent); mCurrentStateMachine.AddOneShotScriptEventHandler(0x6e, EventCallbackChangeClothes); string wooHooEffectName = container.TuningBed.WooHooEffectName; if (!string.IsNullOrEmpty(wooHooEffectName)) { mWooHooEffect = VisualEffect.Create(wooHooEffectName); mWooHooEffect.ParentTo(container, Slots.Hash("_FX_0")); AddOneShotScriptEventHandler(0xc8, EventCallbackWooHoo); AddOneShotScriptEventHandler(0xc9, EventCallbackWooHoo); } if (container is BedDreamPod) { AddOneShotScriptEventHandler(0xc8, EventCallbackDreamPodWooHoo); AddOneShotScriptEventHandler(0xc9, EventCallbackDreamPodWooHoo); } Sim.ClothesChangeReason reason = Sim.ClothesChangeReason.GoingToBed; if ((Woohooer.Settings.mNakedOutfitBed) && (!container.IsOutside)) { reason = Sim.ClothesChangeReason.GoingToBathe; Woohooer.Settings.AddChange(Actor); Woohooer.Settings.AddChange(Target); } mHelperX = new Sim.SwitchOutfitHelper(Actor, reason); mHelperY = new Sim.SwitchOutfitHelper(Target, reason); mHelperX.Start(); mHelperY.Start(); mJealousyAlarm = AlarmManager.Global.AddAlarm(kJealousyBroadcasterDelay, TimeUnit.Minutes, StartJealousyBroadcaster, "StartJealousyBroadcaster", AlarmType.DeleteOnReset, container); container.PreWooHooBehavior(Actor, Target, this); mCurrentStateMachine.RequestState(false, "x", "WooHoo"); mCurrentStateMachine.RequestState(true, "y", "WooHoo"); container.PostWooHooBehavior(Actor, Target, this); Relationship.Get(Actor, Target, true).STC.Update(Actor, Target, CommodityTypes.Amorous, kSTCIncreaseAfterWoohoo); if (CanSleep(Actor, container)) { SleepAfter = true; } else { SleepAfter = false; container.PartComp.GetPartSimIsIn(Actor).BedMade = true; } if (CanSleep(Target, container)) { (LinkedInteractionInstance as WooHoo).SleepAfter = true; } else { (LinkedInteractionInstance as WooHoo).SleepAfter = false; container.PartComp.GetPartSimIsIn(Target).BedMade = true; } /* * if (SleepAfter) * { * mCurrentStateMachine.RequestState(null, "ToSleep"); * } * else*/ { mCurrentStateMachine.RequestState(null, "ToRelax"); } CommonWoohoo.RunPostWoohoo(Actor, Target, container, definition.GetStyle(this), definition.GetLocation(container), true); if (container is BedDoubleHover) { Actor.BuffManager.AddElement(BuffNames.MeterHighClub, Origin.FromWooHooOnHoverBed); Target.BuffManager.AddElement(BuffNames.MeterHighClub, Origin.FromWooHooOnHoverBed); } if (container is BedDreamPod) { Actor.BuffManager.AddElement(BuffNames.DoubleDreaming, Origin.FromWooHooInDreamPod); Target.BuffManager.AddElement(BuffNames.DoubleDreaming, Origin.FromWooHooInDreamPod); } } FinishSocial(CommonSurrogate.GetSocialName(definition.GetStyle(this)), true); CleanupSituation(); Actor.AddExitReason(ExitReason.Finished); } else { container = Target.Posture.Container as BedMultiPart; if (container == null) { return(false); } PartComponent <BedData> partComp = container.PartComp; if (partComp.GetSimInOtherPart(Target) == null) { int num; BedData otherPart = partComp.GetOtherPart(partComp.GetPartSimIsIn(Target)); if (!Actor.RouteToSlotListAndCheckInUse(container, otherPart.RoutingSlot, out num)) { Actor.AddExitReason(ExitReason.RouteFailed); return(false); } Actor.SynchronizationLevel = Sim.SyncLevel.Routed; if (Rejected) { Actor.PlaySoloAnimation("a2a_bed_relax_cuddle_reject_standing_y", true); Actor.RouteAway(kMinDistanceToMoveAwayWhenRejected, kMaxDistanceToMoveAwayWhenRejected, true, new InteractionPriority(InteractionPriorityLevel.Zero), false, true, true, RouteDistancePreference.NoPreference); return(true); } if (!otherPart.RelaxOnBed(Actor, "Enter_BedRelax_" + otherPart.StateNameSuffix)) { return(false); } } else { Actor.SynchronizationLevel = Sim.SyncLevel.Routed; } DoLoop(~(ExitReason.Replan | ExitReason.MidRoutePushRequested | ExitReason.ObjectStateChanged | ExitReason.PlayIdle | ExitReason.MaxSkillPointsReached)); if (!Actor.HasExitReason(ExitReason.Finished)) { PostLoop(); WaitForMasterInteractionToFinish(); } } PostLoop(); WaitForSyncComplete(); succeeded = !Failed && !Rejected; } finally { EndCommodityUpdates(succeeded); StandardExit(false, false); } if (succeeded) { VisitSituation situation = VisitSituation.FindVisitSituationInvolvingGuest(Actor); VisitSituation situation2 = VisitSituation.FindVisitSituationInvolvingGuest(Target); if (situation != null && situation2 != null) { situation.GuestStartingInappropriateAction(Actor, 3.5f); situation2.GuestStartingInappropriateAction(Target, 3.5f); } } if (succeeded && SleepAfter) { if (!Actor.InteractionQueue.HasInteractionOfType(BedSleep.Singleton)) { InteractionInstance instance = BedSleep.Singleton.CreateInstance(container, Actor, GetPriority(), Autonomous, CancellableByPlayer); Actor.InteractionQueue.PushAsContinuation(instance, true); } if (VisitSituation.FindVisitSituationInvolvingGuest(Target) != null && Actor.IsAtHome) { SocialCallback.OnStayOver(Actor, Target, false); } else if (VisitSituation.FindVisitSituationInvolvingGuest(Actor) != null && Target.IsAtHome) { SocialCallback.OnStayOver(Target, Actor, false); } } else if (!IsOwner(Actor, container)) { InteractionInstance instance = Actor.Posture.GetStandingTransition(); if (instance != null) { Actor.InteractionQueue.Add(instance); } } return(succeeded); } catch (ResetException) { throw; } catch (Exception e) { Woohooer.Settings.AddChange(Actor); Woohooer.Settings.AddChange(Target); Common.Exception(Actor, Target, e); return(false); } }