Door/hood sync via hinge spring instead of teleport (fixes NaN crash and parts falling off); join/leave toasts
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
+10
-3
@@ -65,6 +65,10 @@ namespace MSCO
|
||||
readonly TrafficSync traffic = new TrafficSync();
|
||||
readonly HingeSync hinges = new HingeSync();
|
||||
readonly ControlSync controls = new ControlSync();
|
||||
readonly Toasts toasts = new Toasts();
|
||||
|
||||
void ToastJoined(string name) { toasts.Add(name, "joined the game", UiTheme.Online); }
|
||||
void ToastLeft(string name) { toasts.Add(name, "left the game", UiTheme.Muted); }
|
||||
readonly Overlays overlays = new Overlays();
|
||||
bool isAdmin; // Server hat uns als Admin gemeldet
|
||||
readonly HashSet<string> bannedNames = new HashSet<string>(); // P2P-Host: für diese Sitzung gebannt
|
||||
@@ -928,6 +932,7 @@ namespace MSCO
|
||||
RemovePlayer(peerId);
|
||||
session.SendToAll(MsgType.PlayerLeft, NetSession.Build(w => w.Write(peerId)));
|
||||
SetStatus(p.Name + " left (" + reason + ")");
|
||||
ToastLeft(p.Name);
|
||||
}
|
||||
|
||||
string serverReason; // Grund, den der Server/Host beim Trennen mitgeschickt hat
|
||||
@@ -1144,6 +1149,7 @@ namespace MSCO
|
||||
foreach (PlayerInfo p in list) { w.Write(p.Id); w.Write(p.Name); }
|
||||
}));
|
||||
session.SendToAll(MsgType.PlayerJoined, NetSession.Build(w => { w.Write(peerId); w.Write(name); }), peerId);
|
||||
ToastJoined(name);
|
||||
|
||||
if (MenuHelper.InGame)
|
||||
{
|
||||
@@ -1216,6 +1222,7 @@ namespace MSCO
|
||||
string name = r.ReadString();
|
||||
AddPlayer(id, name, false);
|
||||
SetStatus(name + " joined");
|
||||
ToastJoined(name);
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -1223,7 +1230,7 @@ namespace MSCO
|
||||
{
|
||||
int id = r.ReadInt32();
|
||||
PlayerInfo p;
|
||||
if (players.TryGetValue(id, out p)) SetStatus(p.Name + " left");
|
||||
if (players.TryGetValue(id, out p)) { SetStatus(p.Name + " left"); ToastLeft(p.Name); }
|
||||
RemovePlayer(id);
|
||||
break;
|
||||
}
|
||||
@@ -1960,7 +1967,7 @@ namespace MSCO
|
||||
if (MenuHelper.InMenu)
|
||||
{
|
||||
lobby.Draw(this);
|
||||
DrawPing();
|
||||
DrawPing(); toasts.Draw();
|
||||
overlays.Draw(this, false);
|
||||
return;
|
||||
}
|
||||
@@ -1977,7 +1984,7 @@ namespace MSCO
|
||||
}
|
||||
|
||||
if (session != null) DrawHud();
|
||||
DrawPing();
|
||||
DrawPing(); toasts.Draw();
|
||||
overlays.Draw(this, session != null);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user