Fix: vehicles were treated as held items (car tilted with the driver's head)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-09-26 22:53:53 +02:00
co-authored by Claude Opus 5.5
parent d32cdd5693
commit b33cd82e68
+4 -2
View File
@@ -306,7 +306,7 @@ namespace MSCO
public void ApplyAvatarHold(int playerId, int bodyId, Vector3 pos, Quaternion rot) public void ApplyAvatarHold(int playerId, int bodyId, Vector3 pos, Quaternion rot)
{ {
SyncedBody b; SyncedBody b;
if (!byId.TryGetValue(bodyId, out b) || b.Rb == null) return; if (!byId.TryGetValue(bodyId, out b) || b.Rb == null || b.IsVehicle) return; // ältere Mods melden evtl. ein Auto als "gehalten"
if (b.OwnerId != playerId) if (b.OwnerId != playerId)
{ {
if (!Wins(playerId, true, b.OwnerId, b.OwnerActive)) return; if (!Wins(playerId, true, b.OwnerId, b.OwnerActive)) return;
@@ -534,7 +534,9 @@ namespace MSCO
{ {
Rigidbody rb = t.GetComponent<Rigidbody>(); Rigidbody rb = t.GetComponent<Rigidbody>();
SyncedBody b; SyncedBody b;
if (rb != null && byRb.TryGetValue(rb, out b)) return IsReallyInHand(b) ? b : null; // Fahrzeuge hält man nie in der Hand: im Auto zeigt PickedObject z.B. aufs Lenkrad, dessen
// Physik-Körper ist das Auto selbst - das Auto würde sonst mit dem Kopf mitkippen
if (rb != null && byRb.TryGetValue(rb, out b)) return !b.IsVehicle && IsReallyInHand(b) ? b : null;
} }
return null; return null;
} }