diff --git a/extensions/sdkhooks/extension.cpp b/extensions/sdkhooks/extension.cpp index d9133696..98a10f62 100644 --- a/extensions/sdkhooks/extension.cpp +++ b/extensions/sdkhooks/extension.cpp @@ -499,6 +499,11 @@ FeatureStatus SDKHooks::GetFeatureStatus(FeatureType type, const char *name) static void PopulateCallbackList(const std::vector &source, std::vector &destination, int entity) { + // SourcePawn cannot be called from worker threads. This can happen on some + // engine variants, where the engine invokes ShouldCollide off-thread. + if (g_MainThreadId != std::this_thread::get_id()) + return; + destination.reserve(8); for (size_t iter = 0; iter < source.size(); ++iter) { @@ -1386,11 +1391,6 @@ void SDKHooks::Hook_SetTransmit(CCheckTransmitInfo *pInfo, bool bAlways) bool SDKHooks::Hook_ShouldCollide(int collisionGroup, int contentsMask) { - // SourcePawn cannot be called from worker threads. This can happen on some - // engine variants, where the engine invokes ShouldCollide off-thread. - if (g_MainThreadId != std::this_thread::get_id()) - RETURN_META_VALUE(MRES_IGNORED, false); - CBaseEntity *pEntity = META_IFACEPTR(CBaseEntity); CVTableHook vhook(pEntity);