public override bool Run() { try { try { mSwitchOutfitHelper = new Sim.SwitchOutfitHelper(Actor, Sim.ClothesChangeReason.GoingToBathe); } catch { return false; } mSwitchOutfitHelper.Start(); if (!Target.RouteToSink(this)) { return false; } if (Shooless.Settings.GetPrivacy(Target)) { mSituation = new Sink.SpongeBathPrivacySituation(this); if (!mSituation.Start()) { return false; } } Matrix44 transform = Actor.Transform; if (!Actor.RouteToMatrix(ref transform)) { if (mSituation != null) { mSituation.Exit(); } return false; } StandardEntry(); mSwitchOutfitHelper.Wait(true); bool flag = Actor.GetCurrentOutfitCategoryFromOutfitInGameObject() == OutfitCategories.Singed; Target.mSimUsingSink = Actor; mCurrentStateMachine = Target.GetStateMachine(Actor, "Enter"); if (mSituation != null) { mSituation.StateMachine = mCurrentStateMachine; } SetParameter("SimShouldClothesChange", !flag && !Actor.OccultManager.DisallowClothesChange()); mSwitchOutfitHelper.AddScriptEventHandler(this); AddOneShotScriptEventHandler(0x3e9, new SacsEventHandler(EventCallbackStartWaterSound)); bool paramValue = (Target.BoobyTrapComponent != null) ? Target.BoobyTrapComponent.CanTriggerTrap(Actor.SimDescription) : false; mCurrentStateMachine.SetParameter("isBoobyTrapped", paramValue); AnimateSim("Loop SpongeBath"); StartStages(); Target.StartDisgustEffect(); BeginCommodityUpdates(); bool succeeded = false; if (paramValue) { Target.TriggerTrap(Actor); } else { try { Sink.CheckToAddChillyBuff(Actor, Target); succeeded = DoLoop(~(ExitReason.Replan | ExitReason.MidRoutePushRequested | ExitReason.ObjectStateChanged | ExitReason.PlayIdle | ExitReason.MaxSkillPointsReached), LoopDel, null); Actor.BuffManager.UnpauseBuff(BuffNames.Chilly); } finally { EndCommodityUpdates(succeeded); } if (succeeded) { Actor.BuffManager.RemoveElement(BuffNames.Singed); Actor.BuffManager.RemoveElement(BuffNames.SingedElectricity); Actor.BuffManager.RemoveElement(BuffNames.GotFleasHuman); } if (!flag || (flag && succeeded)) { SetParameter("SimShouldClothesChange", !Actor.OccultManager.DisallowClothesChange()); mSwitchOutfitHelper.Dispose(); try { mSwitchOutfitHelper = new Sim.SwitchOutfitHelper(Actor, Sim.ClothesChangeReason.GettingOutOfBath); mSwitchOutfitHelper.Start(); mSwitchOutfitHelper.AddScriptEventHandler(this); mSwitchOutfitHelper.Wait(false); } catch { } } } AddOneShotScriptEventHandler(0x3ea, new SacsEventHandler(EventCallbackStopWaterSound)); Target.UpdateDirtyBreakAndPickExitState(mCurrentStateMachine, Actor); Target.StopDisgustEffect(); Target.mSimUsingSink = null; TraitFunctions.CheckForNeuroticAnxiety(Actor, TraitFunctions.NeuroticTraitAnxietyType.Sink); StandardExit(); return succeeded; } catch (ResetException) { throw; } catch (Exception e) { Common.Exception(Actor, Target, e); return false; } }
public override bool Run() { try { try { mSwitchOutfitHelper = new Sim.SwitchOutfitHelper(Actor, Sim.ClothesChangeReason.GoingToBathe); } catch { return(false); } mSwitchOutfitHelper.Start(); if (!Target.RouteToSink(this)) { return(false); } if (Shooless.Settings.GetPrivacy(Target)) { mSituation = new Sink.SpongeBathPrivacySituation(this); if (!mSituation.Start()) { return(false); } } Matrix44 transform = Actor.Transform; if (!Actor.RouteToMatrix(ref transform)) { if (mSituation != null) { mSituation.Exit(); } return(false); } StandardEntry(); mSwitchOutfitHelper.Wait(true); bool flag = Actor.GetCurrentOutfitCategoryFromOutfitInGameObject() == OutfitCategories.Singed; Target.mSimUsingSink = Actor; mCurrentStateMachine = Target.GetStateMachine(Actor, "Enter"); if (mSituation != null) { mSituation.StateMachine = mCurrentStateMachine; } SetParameter("SimShouldClothesChange", !flag && !Actor.OccultManager.DisallowClothesChange()); mSwitchOutfitHelper.AddScriptEventHandler(this); AddOneShotScriptEventHandler(0x3e9, new SacsEventHandler(EventCallbackStartWaterSound)); bool paramValue = (Target.BoobyTrapComponent != null) ? Target.BoobyTrapComponent.CanTriggerTrap(Actor.SimDescription) : false; mCurrentStateMachine.SetParameter("isBoobyTrapped", paramValue); AnimateSim("Loop SpongeBath"); StartStages(); Target.StartDisgustEffect(); BeginCommodityUpdates(); bool succeeded = false; if (paramValue) { Target.TriggerTrap(Actor); } else { try { Sink.CheckToAddChillyBuff(Actor, Target); succeeded = DoLoop(~(ExitReason.Replan | ExitReason.MidRoutePushRequested | ExitReason.ObjectStateChanged | ExitReason.PlayIdle | ExitReason.MaxSkillPointsReached), LoopDel, null); Actor.BuffManager.UnpauseBuff(BuffNames.Chilly); } finally { EndCommodityUpdates(succeeded); } if (succeeded) { Actor.BuffManager.RemoveElement(BuffNames.Singed); Actor.BuffManager.RemoveElement(BuffNames.SingedElectricity); Actor.BuffManager.RemoveElement(BuffNames.GotFleasHuman); } if (!flag || (flag && succeeded)) { SetParameter("SimShouldClothesChange", !Actor.OccultManager.DisallowClothesChange()); mSwitchOutfitHelper.Dispose(); try { mSwitchOutfitHelper = new Sim.SwitchOutfitHelper(Actor, Sim.ClothesChangeReason.GettingOutOfBath); mSwitchOutfitHelper.Start(); mSwitchOutfitHelper.AddScriptEventHandler(this); mSwitchOutfitHelper.Wait(false); } catch { } } } AddOneShotScriptEventHandler(0x3ea, new SacsEventHandler(EventCallbackStopWaterSound)); Target.UpdateDirtyBreakAndPickExitState(mCurrentStateMachine, Actor); Target.StopDisgustEffect(); Target.mSimUsingSink = null; TraitFunctions.CheckForNeuroticAnxiety(Actor, TraitFunctions.NeuroticTraitAnxietyType.Sink); StandardExit(); return(succeeded); } catch (ResetException) { throw; } catch (Exception e) { Common.Exception(Actor, Target, e); return(false); } }