disable collision from triggering impact code on clients

This commit is contained in:
JohnCorby 2021-11-11 02:16:14 -08:00
parent 5f5e04e29f
commit 8b0d621201
3 changed files with 8 additions and 4 deletions

View File

@ -2,7 +2,6 @@
using QSB.MeteorSync.WorldObjects;
using QSB.Utility;
using QSB.WorldSync;
using QSB.WorldSync.Events;
using EventType = QSB.Events.EventType;
namespace QSB.MeteorSync.Events

View File

@ -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,

View File

@ -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);