All mod messages go to the MSCO console (F7) instead of the MSCLoader console; still written to output_log.txt

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-09-27 09:53:40 +02:00
co-authored by Claude Opus 5.5
parent 1dc65ac553
commit 0c15459302
17 changed files with 98 additions and 50 deletions
+15 -15
View File
@@ -498,7 +498,7 @@ namespace MSCO
{
// Meldungen des Discord-Threads (verbunden, Fehler ...) in die Konsole
string discordLog;
while ((discordLog = discord.TakeLog()) != null) ModConsole.Print("[MSCO] " + discordLog);
while ((discordLog = discord.TakeLog()) != null) MscoLog.Info("[MSCO] " + discordLog);
if (Time.realtimeSinceStartup < nextPresenceUpdate) return;
nextPresenceUpdate = Time.realtimeSinceStartup + 2f;
@@ -652,22 +652,22 @@ namespace MSCO
{
if (!MenuHelper.InGame)
{
ModConsole.Print("[MSCO] You can only save while in the game.");
MscoLog.Info("[MSCO] You can only save while in the game.");
return;
}
if (session != null && dedicated)
{
ModConsole.Print("[MSCO] The server saves the world automatically.");
MscoLog.Info("[MSCO] The server saves the world automatically.");
return;
}
if (session != null && !session.IsHost)
{
ModConsole.Print("[MSCO] Only the host can save the game.");
MscoLog.Info("[MSCO] Only the host can save the game.");
return;
}
savingMessageUntil = Time.realtimeSinceStartup + 2.5f; // "SAVING GAME..." in der Bildschirmmitte
PlayMakerFSM.BroadcastEvent("SAVEGAME");
ModConsole.Print("[MSCO] Game saved.");
MscoLog.Info("[MSCO] Game saved.");
}
// ---------------------------------------------------------------- Update
@@ -679,6 +679,7 @@ namespace MSCO
// erst nach MINIMIZE wieder. Über der eingeklappten Leiste ebenfalls nicht (sonst öffnet sich z.B. der Changelog).
MenuInputBlocker.SetBlocked(MenuHelper.InMenu && (lobby.IsOpen || lobby.ContainsMouse() || overlays.AnyOpen));
UpdateOverlayKeys();
MscoLog.Drain(overlays.Log); // alle Mod-Meldungen in die MSCO-Konsole (F7)
UpdatePresence();
steam.Tick();
@@ -1156,7 +1157,7 @@ namespace MSCO
foreach (byte[] msg in fileMessages) session.SendTo(p.Id, MsgType.SaveFile, msg);
session.SendTo(p.Id, MsgType.StartGame, NetSession.Build(w => w.Write(lateJoin)));
}
ModConsole.Print("[MSCO] Sent save (" + files.Count + " files) to " + targets.Count + " player(s)");
MscoLog.Info("[MSCO] Sent save (" + files.Count + " files) to " + targets.Count + " player(s)");
}
void OnLevelWasLoaded(int level)
@@ -1205,7 +1206,7 @@ namespace MSCO
void TryRestoreBackup()
{
try { SaveSync.RestoreBackup(); }
catch (System.Exception e) { ModConsole.Error("[MSCO] Could not restore own save: " + e.Message); }
catch (System.Exception e) { MscoLog.Error("[MSCO] Could not restore own save: " + e.Message); }
}
// ---------------------------------------------------------------- Im Spiel
@@ -1221,7 +1222,7 @@ namespace MSCO
localPlayer = player.transform;
playerCamera = FindPlayerCamera(player);
objects.Head = playerCamera != null ? playerCamera.transform : null;
ModConsole.Print("[MSCO] Player camera: " + (playerCamera != null ? playerCamera.name : "none"));
MscoLog.Info("[MSCO] Player camera: " + (playerCamera != null ? playerCamera.name : "none"));
}
if (teleportToHost) TryTeleportToHost();
@@ -1326,8 +1327,8 @@ namespace MSCO
float now = Time.realtimeSinceStartup, last;
if (lastErrorReport.TryGetValue(what, out last) && now - last < 30f) return;
lastErrorReport[what] = now;
ModConsole.Error("[MSCO] " + what + " failed: " + e);
overlays.Log("Error in " + what + ": " + e.Message);
MscoLog.Error(what + " failed: " + e.Message);
Debug.Log("[MSCO] " + what + " failed: " + e); // voller Stacktrace nur in output_log.txt
}
void FixedUpdate()
@@ -1382,7 +1383,7 @@ namespace MSCO
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"));
MscoLog.Info("[MSCO] Back at your last position " + spawn.ToString("F0"));
}
}
@@ -1426,7 +1427,7 @@ namespace MSCO
// Fahrzeugzustand (Tank, Öl, Schrauben ...)
if (r.BaseStream.Length - r.BaseStream.Position >= 4) vehicleState.ApplySnapshot(r);
ModConsole.Print("[MSCO] World synced: " + applied + "/" + objectCount + " objects, " + eventCount + " part/bolt actions");
MscoLog.Info("[MSCO] World synced: " + applied + "/" + objectCount + " objects, " + eventCount + " part/bolt actions");
SetStatus("Connected");
}
@@ -1500,7 +1501,7 @@ namespace MSCO
{
// Platzhalter-Figur: Kapsel mit Kopf und Hand
p.Avatar = RemotePlayer.Create("MSCO_Player_" + from, PlayerColor(from), state, from);
ModConsole.Print("[MSCO] " + p.Name + " is in the game");
MscoLog.Info("[MSCO] " + p.Name + " is in the game");
}
p.Avatar.SetTarget(state);
}
@@ -1617,8 +1618,7 @@ namespace MSCO
void SetStatus(string text)
{
status = text;
ModConsole.Print("[MSCO] " + text);
if (!string.IsNullOrEmpty(text)) overlays.Log(text);
if (!string.IsNullOrEmpty(text)) MscoLog.Info(text);
}
}
}