Per-player needs, jumping figure, round belt/shoulders/boots, reset-point UI

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-09-27 17:48:16 +02:00
co-authored by Claude Opus 5.5
parent 09c85e3d96
commit 8dae3ac13d
7 changed files with 128 additions and 20 deletions
+19
View File
@@ -66,6 +66,8 @@ namespace MSCO
readonly HingeSync hinges = new HingeSync();
readonly ControlSync controls = new ControlSync();
readonly Toasts toasts = new Toasts();
float nextNeedsSend;
const float NeedsInterval = 10f;
void ToastJoined(string name) { toasts.Add(name, "joined the game", UiTheme.Online); }
void ToastLeft(string name) { toasts.Add(name, "left the game", UiTheme.Muted); }
@@ -1685,6 +1687,17 @@ namespace MSCO
try { SendGame(MsgType.Player, BuildLocalState().Serialize()); }
catch (System.Exception e) { ReportError("player state", e); }
}
// Eigene Bedürfnisse (Hunger, Durst ...) pro Spieler auf dem Server sichern
if (dedicated && worldSynced && Time.realtimeSinceStartup >= nextNeedsSend)
{
nextNeedsSend = Time.realtimeSinceStartup + NeedsInterval;
try
{
byte[] needs = PlayerNeeds.Build();
if (needs != null) session.SendTo(NetSession.HostId, MsgType.PlayerNeeds, needs);
}
catch (System.Exception e) { ReportError("player needs", e); }
}
try { objects.Update(localPlayer, Time.deltaTime); }
catch (System.Exception e) { ReportError("object sync", e); }
try { vehicleFx.Update(objects, SendGame, Time.deltaTime, IsWorldAuthority); }
@@ -1888,6 +1901,12 @@ namespace MSCO
int destroyed = r.ReadInt32();
for (int i = 0; i < destroyed; i++) destroyedIds.Add(r.ReadInt32());
}
// Eigene Bedürfnisse (Hunger, Durst ...) - statt der Werte aus dem gemeinsamen Spielstand
if (r.BaseStream.Length - r.BaseStream.Position >= 1 && r.ReadBoolean())
{
int needs = PlayerNeeds.Apply(r);
if (needs > 0) MscoLog.Info("[MSCO] Your own hunger/thirst/... restored (" + needs + " values)");
}
// Abgebaute Teile und gespawnte Items sind jetzt eigene Objekte: erfassen, dann alle Positionen setzen
yield return null;