private static bool Prefix(ref ZNetScene __instance) { if (ZNetScene.instance.InLoadingScreen()) { return true; } if (objectScanThread == null) { VFPSModPlugin.VFPSModLogger.LogInfo($"Starting ObjectScanThread."); objectScanThread = new ObjectScanThread(); // Force run scan once. objectScanThread.RunScan(); // Then start thread. Thread scanThread = new Thread(objectScanThread.ThreadEx); scanThread.Start(); } __instance.m_tempCurrentObjects.Clear(); __instance.m_tempCurrentDistantObjects.Clear(); __instance.m_tempCurrentObjects = new List<ZDO>(ObjectScanThread.CurrentObjects); __instance.m_tempCurrentDistantObjects = new List<ZDO>(ObjectScanThread.CurrentDistantObjects); __instance.CreateObjects(__instance.m_tempCurrentObjects, __instance.m_tempCurrentDistantObjects); __instance.RemoveObjects(__instance.m_tempCurrentObjects, __instance.m_tempCurrentDistantObjects); // Skip original code. return false; }
private static void Postfix(ref Player __instance) { if (!__instance.m_nview.IsValid() || !__instance.m_nview.IsOwner()) { return; } ObjectScanThread.CheckForInput(); }