static bool useHook_patch(InteractableVehicle __instance) { List <HookInfo> hooked = get_priv_hooked(__instance); if (hooked.Count > 0) { __instance.clearHooked(); return(false); } float radius; if (!Plugin.TryGetCustomDataFor <float>(__instance.asset.GUID, FieldName, out radius)) { radius = 3f; } var hook = get_priv_hook(__instance); var grab = get_priv_grab(); int num = Physics.OverlapSphereNonAlloc(hook.position, radius, grab, 67108864); for (int i = 0; i < num; i++) { InteractableVehicle vehicle = DamageTool.getVehicle(grab[i].transform); if (!(vehicle == null) && !(vehicle == __instance) && vehicle.isEmpty && !vehicle.isHooked && vehicle.asset.engine != EEngine.TRAIN) { HookInfo hookInfo = new HookInfo { target = vehicle.transform, vehicle = vehicle, deltaPosition = hook.InverseTransformPoint(vehicle.transform.position), deltaRotation = Quaternion.FromToRotation(hook.forward, vehicle.transform.forward) }; hooked.Add(hookInfo); vehicle.isHooked = true; __instance.ignoreCollisionWith(vehicle.vehicleColliders, true); } } set_priv_hooked(hooked, __instance); return(false); }