[CVRLuaToolsExtension] kinda fix

This commit is contained in:
NotAKidoS 2025-04-24 21:14:17 -05:00
parent e85c1e2f25
commit 0f6006db83

View file

@ -1,6 +1,7 @@
using ABI.CCK.Components; using ABI.CCK.Components;
using ABI.Scripting.CVRSTL.Client; using ABI.Scripting.CVRSTL.Client;
using System.Diagnostics; using System.Diagnostics;
using ABI_RC.Scripting.Persistence;
using MTJobSystem; using MTJobSystem;
using UnityEngine; using UnityEngine;
@ -108,8 +109,11 @@ public static class CVRLuaClientBehaviourExtensions
behaviour._startupMessageQueue.Clear(); // will be repopulated behaviour._startupMessageQueue.Clear(); // will be repopulated
behaviour.LogInfo("[CVRLuaToolsExtension] Resetting script...\n"); behaviour.LogInfo("[CVRLuaToolsExtension] Resetting script...\n");
// remove the script from the persistence manager, as the storage needs to be reinitialized
PersistenceManager.HandleUnsubscribe(behaviour.Storage, behaviour.script, behaviour.Context.ParentContent.ContentType, behaviour.Context.AssetID);
behaviour.script = null; behaviour.script = null;
behaviour.script = LuaScriptFactory.ForLuaBehaviour(behaviour, boundObjectEntries, behaviour.gameObject, behaviour.transform, PersistentDataPath); behaviour.script = LuaScriptFactory.ForLuaBehaviour(behaviour, boundObjectEntries, behaviour.gameObject, behaviour.transform);
behaviour.InitTimerIfNeeded(); // only null if crashed prior behaviour.InitTimerIfNeeded(); // only null if crashed prior
behaviour.script.AttachDebugger(behaviour.timer); // reattach the debugger behaviour.script.AttachDebugger(behaviour.timer); // reattach the debugger