From 51402612a1df43597c976d616e6be972716d62f7 Mon Sep 17 00:00:00 2001 From: JohnCorby Date: Thu, 11 Nov 2021 02:16:14 -0800 Subject: [PATCH] disable collision from triggering impact code on clients --- QSB/MeteorSync/Patches/MeteorClientPatches.cs | 8 +++++++- QSB/MeteorSync/WorldObjects/QSBMeteor.cs | 3 +-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/QSB/MeteorSync/Patches/MeteorClientPatches.cs b/QSB/MeteorSync/Patches/MeteorClientPatches.cs index ca8359cb..93825f0f 100644 --- a/QSB/MeteorSync/Patches/MeteorClientPatches.cs +++ b/QSB/MeteorSync/Patches/MeteorClientPatches.cs @@ -1,6 +1,5 @@ using System; using HarmonyLib; -using OWML.Common; using QSB.MeteorSync.WorldObjects; using QSB.Patches; using QSB.Utility; @@ -105,6 +104,13 @@ namespace QSB.MeteorSync.Patches } + [HarmonyPrefix] + [HarmonyPatch(typeof(MeteorController), nameof(MeteorController.OnCollisionEnter))] + public static bool OnCollisionEnter(MeteorController __instance, + Collision collision) + => false; + + [HarmonyPrefix] [HarmonyPatch(typeof(MeteorController), nameof(MeteorController.Impact))] public static bool Impact(MeteorController __instance, diff --git a/QSB/MeteorSync/WorldObjects/QSBMeteor.cs b/QSB/MeteorSync/WorldObjects/QSBMeteor.cs index 7c732486..7d8e7df7 100644 --- a/QSB/MeteorSync/WorldObjects/QSBMeteor.cs +++ b/QSB/MeteorSync/WorldObjects/QSBMeteor.cs @@ -43,8 +43,6 @@ namespace QSB.MeteorSync.WorldObjects impactPoint = Locator._brittleHollow.transform.TransformPoint(impactPoint); Damage = damage; - AttachedObject.transform.position = impactPoint; - var hits = Physics.OverlapSphere(impactPoint, 1, OWLayerMask.physicalMask, QueryTriggerInteraction.Ignore); var obj = hits .Select(x => x.gameObject) @@ -56,6 +54,7 @@ namespace QSB.MeteorSync.WorldObjects return; } + AttachedObject.owRigidbody.MoveToPosition(impactPoint); var impactVel = AttachedObject.owRigidbody.GetVelocity() - obj.GetAttachedOWRigidbody().GetVelocity(); AttachedObject.Impact(obj, impactPoint, impactVel);