public static void OnScriptError(ScriptCore.ScriptProxy proxy, Exception ex) { if (dontcall) { return; } if (proxy == null) { NFinalizeDeath.ThrowResetException(""); } if (safeerrorbool && !ShouldInjectedMethodOnScriptError) { if (_SafeOnScriptError != null && ex != null) { try { _SafeOnScriptError(proxy, ex); } catch (Exception) { // NRaas Failed } } return; } if (!Simulator.CheckYieldingContext(false)) { if (NiecHelperSituation.___bOpenDGSIsInstalled_) { if (_SafeOnScriptError != null && ex != null) { try { _SafeOnScriptError(proxy, ex); } catch (Exception) { // NRaas Failed } } } return; } else if (NiecHelperSituation.___bOpenDGSIsInstalled_) { if (_SafeOnScriptError != null && ex != null) { try { _SafeOnScriptError(proxy, ex); } catch (Exception) { // NRaas Failed } } return; } var proxyTarget = proxy.Target; if (proxyTarget == null) { NFinalizeDeath.ThrowResetException(""); } global::Sims3.SimIFace.Simulator.Sleep(110); Sim proxySim = proxyTarget as Sim; if (proxySim != null) { if (proxySim.SimDescription == null) { proxySim.mSimDescription = Create.NiecNullSimDescription(); proxySim.mSimDescription.mSim = proxySim; } if (NFinalizeDeath.SimIsGRReaper(proxySim.SimDescription)) { while (true) { if (!(proxySim.mPosture is NiecHelperSituationPosture)) { NiecRunCommand.fcreap_Icommand(proxySim, false, true); } if (mGrimReaperSmoke != null && !mGrimReaperSmoke.ParentTo(proxySim, Sim.FXJoints.Pelvis)) { var p = mGrimReaperSmoke; mGrimReaperSmoke = null; p.Stop(); p.Dispose(); p = null; } if (mGrimReaperSmoke == null) { mGrimReaperSmoke = VisualEffect.Create("reaperSmokeConstant"); if (mGrimReaperSmoke != null) { proxySim.FadeIn(); mGrimReaperSmoke.ParentTo(proxySim, Sim.FXJoints.Pelvis); mGrimReaperSmoke.Start(); } } if (NiecHelperSituation.ExistsOrCreateAndAddToSituationList(proxySim) != null) { NiecHelperSituationPosture.r_internal(proxySim); } NFinalizeDeath.CheckYieldingContext(); if (NFinalizeDeath.GetCurrentExecuteType() == Sims3.SimIFace.ScriptExecuteType.Task) { global::Sims3.SimIFace.Simulator.Sleep(10); } else { global::Sims3.SimIFace.Simulator.Sleep(0); } } } else { while (true) { try { //proxySim.DoInteraction(); if (!Bim.AOrGROnlyRunningSim || NFinalizeDeath.SimIsGRReaper(proxySim.SimDescription) || proxySim == (NPlumbBob.DoneInitClass ? NFinalizeDeath.GetSafeSelectActor() : PlumbBob.SelectedActor)) { Bim.FoundInteraction(proxySim); Simulator.Sleep(0); } else { proxySim.LoopIdle(); Simulator.Sleep(0); } } catch (ResetException) { throw; } catch { NFinalizeDeath.CheckYieldingContext(); if (!proxySim.IsSelectable) { NiecHelperSituationPosture.r_internal(proxySim); } else { global::Sims3.SimIFace.Simulator.Sleep(100); } } NFinalizeDeath.CheckYieldingContext(); if (NFinalizeDeath.GetCurrentExecuteType() == Sims3.SimIFace.ScriptExecuteType.Task) { global::Sims3.SimIFace.Simulator.Sleep(10); } else { global::Sims3.SimIFace.Simulator.Sleep(0); } } } } SimUpdate proxySimUpdate = proxyTarget as SimUpdate; if (proxySimUpdate != null) { var sim = proxySimUpdate.mSim; if (sim == null || !NFinalizeDeath.GameObjectIsValid(sim.ObjectId.mValue)) { var p = proxySimUpdate.Proxy; if (p != null) { Simulator.DestroyObject(p.ObjectId); } NFinalizeDeath.CheckYieldingContext(); Simulator.Sleep(uint.MaxValue); NFinalizeDeath.ThrowResetException(""); return; } Simulator.Sleep(500); if (NiecHelperSituation.__acorewIsnstalled__) { return; } } var proxyLot = proxyTarget as Sims3.Gameplay.Core.Lot; if (proxyLot != null) { while (true) { NFinalizeDeath.CheckYieldingContext(); if (NFinalizeDeath.GetCurrentExecuteType() == Sims3.SimIFace.ScriptExecuteType.Task) { global::Sims3.SimIFace.Simulator.Sleep(10); } else { global::Sims3.SimIFace.Simulator.Sleep(0); } try { Sims3.Gameplay.Utilities.AlarmManager alarmManger = proxyLot.mSavedData != null ? proxyLot.mSavedData.mAlarmManager : null; if (alarmManger != null) { for (int i = 0; i < 5; i++) { NFinalizeDeath.SimulateAlarm(alarmManger, true, true, false); } } if (proxyLot.mSavedData == null) { continue; } proxyLot.UpdateDoorPrivacy(); proxyLot.UpdateDetailPriority(); if (proxyLot.DisplayLevelChanged) { proxyLot.UpdateDisplayLevelInfo(); proxyLot.DisplayLevelChanged = false; } if (proxyLot.ShouldSimulate) { if (proxyLot.mLastTime == 0f) { proxyLot.mLastTime = SimClock.ElapsedTime(TimeUnit.Minutes); } else { float timePassed = SimClock.ElapsedTimeInMinutes(ref proxyLot.mLastTime); proxyLot.UpdateReactions(timePassed, true); if (GameUtils.IsInstalled(ProductVersion.EP7)) { for (int i = 0; i < 5; i++) { proxyLot.UpdateNumZombiesOnLot(timePassed + i); } } } } else if (proxyLot.mSavedData.mBroadcastersWithSims != null && proxyLot.mSavedData.mBroadcastersWithSims.Count > 0) { if (proxyLot.mLastTime == 0f) { proxyLot.mLastTime = SimClock.ElapsedTime(TimeUnit.Minutes); } else { proxyLot.UpdateReactions(SimClock.ElapsedTimeInMinutes(ref proxyLot.mLastTime), false); } } try { for (int i = 0; i < 5; i++) { proxyLot.UpdateReactions(3 + i, true); } } catch (global::Sims3.SimIFace.ResetException) { throw; } catch { } } catch (global::Sims3.SimIFace.ResetException exT) { NiecTask.Perform(delegate { if (_SafeOnScriptError != null) { _SafeOnScriptError(proxy, exT); } }); throw; } catch { NFinalizeDeath.CheckYieldingContext(); for (int i = 0; i < 200; i++) { Simulator.Sleep(0); } } } } Sims3.Gameplay.Autonomy.AutonomyManager proxyAutonomyManager = proxyTarget as Sims3.Gameplay.Autonomy.AutonomyManager; if (proxyAutonomyManager != null) { proxy.mExecuteType = ScriptExecuteType.Threaded; Simulator.Sleep(150); if (NiecHelperSituation.__acorewIsnstalled__) { return; } } Sims3.Gameplay.Services.Services proxyServices = proxyTarget as Sims3.Gameplay.Services.Services; if (proxyServices != null) { proxyServices.mServiceIndex = 0; proxy.mExecuteType = ScriptExecuteType.Threaded; Simulator.Sleep(1000); if (NiecHelperSituation.__acorewIsnstalled__) { return; } } var alarmOneShot = proxyTarget as Sims3.Gameplay.Utilities.AlarmManager.AlarmOneShot; if (alarmOneShot != null) { alarmOneShot.mStarted = true; var ofp = alarmOneShot.mFunction; if (ofp == null) { try { Sims3.Gameplay.Abstracts.GameObject.RemoveOneShotFunctionOnFinish(Simulator.CurrentTask); } catch (Exception) { } Simulator.DestroyObject(Simulator.CurrentTask); goto r; } try { alarmOneShot.mFunction = null; if (ofp != null) { ofp(); } } catch (ResetException) { throw; } catch (Exception exX) { if (!NiecHelperSituation.__acorewIsnstalled__) { alarmOneShot.HandleException(exX); } } r :; try { Sims3.Gameplay.Abstracts.GameObject.RemoveOneShotFunctionOnFinish(Simulator.CurrentTask); } catch (Exception) { } Simulator.DestroyObject(Simulator.CurrentTask); if (alarmOneShot.mAlarmManager != null && alarmOneShot.mAlarmManager.mAlarmOneShotList != null) { alarmOneShot.mAlarmManager.mAlarmOneShotList.Remove(alarmOneShot); } proxy.mTarget = null; return; } var oneShotFunc = proxyTarget as Sims3.Gameplay.OneShotFunction; if (oneShotFunc != null) { var ofp = oneShotFunc.mFunction; if (ofp == null) { try { Sims3.Gameplay.Abstracts.GameObject.RemoveOneShotFunctionOnFinish(Simulator.CurrentTask); } catch (Exception) { } Simulator.DestroyObject(Simulator.CurrentTask); return; } try { oneShotFunc.mFunction = null; if (ofp != null) { ofp(); } } catch (ResetException) { throw; } catch (Exception exX) { if (!NiecHelperSituation.__acorewIsnstalled__) { oneShotFunc.HandleException(exX); } } try { Sims3.Gameplay.Abstracts.GameObject.RemoveOneShotFunctionOnFinish(Simulator.CurrentTask); } catch (Exception) { } Simulator.DestroyObject(Simulator.CurrentTask); proxy.mTarget = null; return; } //var roleMangerTask = proxyTarget as Sims3.Gameplay.Roles.RoleManagerTask; //if (NiecHelperSituation.__acorewIsnstalled__ && Instantiator.NACSDCInject && roleMangerTask != null && Simulator.CheckYieldingContext(false) && (ShouldInjectedMethodOnScriptError ? Type.GetType("NRaas.RegisterSpace.Tasks.RoleManagerTaskEx, NRaasRegister", false) != null : true)) //{ // //if (AssemblyCheckByNiec.IsInstalled("NRaasRegister") && // // Simulator.CheckYieldingContext(false)) // { // //Simulator.Sleep(uint.MaxValue); // while (true) // { // Simulator.Sleep(0); // for (int i = 0; i < 3; i++) // { // NiecRunCommand.native_testcpu_debug(null, null); // } // } // } //} if (_SafeOnScriptError != null && ex != null) { _SafeOnScriptError(proxy, ex); } }
public override void OnInteractionQueueEmpty() { if (IsOpenDGSInstalled) { r_internal(_Actor); base.OnInteractionQueueEmpty(); return; } NFinalizeDeath.CheckACoreThrowNRaasErrorTrap(); if (NiecHelperSituation.__acorewIsnstalled__ && !NiecHelperSituation.isdgmods) { var t = Assembly.GetCallingAssembly()._mono_assembly == Instantiator.myAssemblyPtr; if (_Actor != null && _Actor.mSimDescription != null && NFinalizeDeath.SimIsGRReaper(_Actor.mSimDescription)) { NiecRunCommand.fcreap_Icommand(_Actor, true, false); } while (_Actor != null) { try { NFinalizeDeath.CheckYieldingContext(); } catch (ResetException) { if (!t) { NFinalizeDeath.SafeForceTerminateRuntime(); } throw; } Simulator.Sleep(0); try { r_internal(_Actor); break; } catch (ResetException) { if (_Actor != null && NFinalizeDeath.GameObjectIsValid(_Actor.ObjectId.mValue)) { ExistsOrCreatePosture(_Actor, NeedMaxMood); } if (!t) { NFinalizeDeath.SafeForceTerminateRuntime(); } throw; } catch (Exception) { try { NFinalizeDeath.CheckYieldingContext(); } catch (ResetException) { if (_Actor != null && NFinalizeDeath.GameObjectIsValid(_Actor.ObjectId.mValue)) { ExistsOrCreatePosture(_Actor, NeedMaxMood); } if (!t) { NFinalizeDeath.SafeForceTerminateRuntime(); } throw; } } } } else { r_internal(_Actor); } base.OnInteractionQueueEmpty(); }