Admin: install parts, set time and weather; join without prompt

- VEHICLE: INSTALL for parts that are not installed - runs the game's own
  assembly (trigger "Assembly" like on load), so the part sits exactly on its
  pivot; synced to other players via FsmSync (MSCO_INSTALL)
- WORLD: time buttons (2-hour steps via the sun FSM's load path) and
  CLEAR / RAIN / THUNDERSTORM (weather front moved above the admin);
  sent to everyone as mod message "msco.world" (no server update needed)
- JOIN from the server browser/website connects right away in the main menu;
  server mods still ask before downloading

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-10-03 13:04:27 +02:00
co-authored by Claude Opus 5.5
parent 06df8fecc5
commit 4be6b68f25
7 changed files with 384 additions and 4 deletions
+19 -1
View File
@@ -575,6 +575,19 @@ namespace MSCO
if (CanCheat) AnnounceCheat(what);
}
/// <summary>Admin: Uhrzeit (kind 1, Stunde) oder Wetter (kind 2: 0 klar, 1 Regen, 2 Gewitter) für alle umstellen.</summary>
public void WorldCheat(byte kind, int value)
{
if (!CanCheat) return;
Vector3 pos = localPlayer != null ? localPlayer.position : Vector3.zero;
string error = WorldAdmin.Apply(kind, value, pos);
if (error != null) { overlays.Log(error); return; }
SendModMessage(WorldAdmin.MessageId, WorldAdmin.Build(kind, value, pos));
AnnounceCheat(kind == WorldAdmin.KindHour
? "set the time to " + value.ToString("00") + ":00"
: "set the weather to " + WorldAdmin.WeatherNames[value]);
}
void AnnounceCheat(string what)
{
string text = OwnName() + " " + what + " (admin)";
@@ -642,7 +655,7 @@ namespace MSCO
PendingJoinHost = host;
PendingJoinPort = port;
if (IsInSession || !MenuHelper.InMenu)
toasts.Add("Join link: " + host + ":" + port, "leave this game - then confirm JOIN in the main menu", UiTheme.Accent);
toasts.Add("Join link: " + host + ":" + port, "leave this game - you join automatically in the main menu", UiTheme.Accent);
}
public void CancelPendingJoin()
@@ -1010,6 +1023,10 @@ namespace MSCO
{
CheckHitch();
CheckJoinRequest();
// JOIN im Server-Browser (Launcher/Website): ohne Rückfrage verbinden, sobald das Hauptmenü steht.
// Server-Mods fragen weiterhin extra nach (das sind Programme).
if (PendingJoinHost != null && !IsInSession && !checkingServer && MenuHelper.InMenu && Time.timeSinceLevelLoad > 1f)
ConfirmPendingJoin();
MeasureFps();
// Menü-Buttons des Spiels nicht durch unser Fenster hindurch auslösen (z.B. Changelog)
// Solange das Multiplayer-Fenster offen ist, reagiert das Spielmenü (CONTINUE, QUIT ...) gar nicht;
@@ -1714,6 +1731,7 @@ namespace MSCO
string modId = r.ReadString();
int len = r.ReadInt32();
if (len < 0 || len > MaxModMessageBytes) return;
if (modId == WorldAdmin.MessageId) { WorldAdmin.Receive(r.ReadBytes(len)); return; } // Admin: Uhrzeit/Wetter
ModLoader.Message(modId, from, r.ReadBytes(len));
return;
}