Passenger: player colliders off while riding (they pushed seats/parts out, physics crashed); last position: not overwritten by the save's start point, invalid positions ignored, saved when a player leaves
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
+10
-1
@@ -1373,8 +1373,17 @@ namespace MSCO
|
||||
|
||||
if (r.ReadBoolean())
|
||||
{
|
||||
// Letzte eigene Position auf dem Server - nur wenn sie plausibel ist, und über den Boden gehoben
|
||||
var spawn = new Vector3(r.ReadSingle(), r.ReadSingle(), r.ReadSingle());
|
||||
if (localPlayer != null) localPlayer.position = spawn + Vector3.up * 0.2f;
|
||||
bool valid = !float.IsNaN(spawn.x) && !float.IsInfinity(spawn.x) && !float.IsNaN(spawn.y) && !float.IsNaN(spawn.z)
|
||||
&& Mathf.Abs(spawn.x) < 6000f && Mathf.Abs(spawn.z) < 6000f && spawn.y > -200f && spawn.y < 3000f;
|
||||
if (localPlayer != null && valid)
|
||||
{
|
||||
RaycastHit hit;
|
||||
if (Physics.Raycast(spawn + Vector3.up * 2f, Vector3.down, out hit, 6f)) spawn.y = Mathf.Max(spawn.y, hit.point.y);
|
||||
localPlayer.position = spawn + Vector3.up * 0.2f;
|
||||
ModConsole.Print("[MSCO] Back at your last position " + spawn.ToString("F0"));
|
||||
}
|
||||
}
|
||||
|
||||
// Positionen erst merken: sie werden NACH den Montage-Aktionen gesetzt. Sonst steckt ein Teil, das eine
|
||||
|
||||
Reference in New Issue
Block a user