Relay car door angles (HingeStates); test

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-09-27 15:13:13 +02:00
co-authored by Claude Opus 5.5
parent 3b17baf739
commit eac0ac046b
3 changed files with 5 additions and 2 deletions
+1 -1
View File
@@ -288,7 +288,7 @@ public sealed class GameServer
t is MsgType.Player or MsgType.ObjStates or MsgType.ObjOwn or MsgType.ObjRelease or MsgType.FsmEvent
or MsgType.VehicleFx or MsgType.WorldTime or MsgType.MoneyDelta or MsgType.DoorState or MsgType.Chat or MsgType.VarSync
or MsgType.SpawnItem or MsgType.ItemAppeared or MsgType.ObjDestroy or MsgType.VehicleDamage
or MsgType.TrafficStates or MsgType.WorldVars;
or MsgType.TrafficStates or MsgType.WorldVars or MsgType.HingeStates;
/// <summary>Uhrzeit/Wetter gibt der Spieler mit der kleinsten ID vor (so rechnen es auch die Clients).</summary>
int WorldAuthorityId => clients.Values.Where(c => c.State == ClientState.Joined).Select(c => c.Id).DefaultIfEmpty(-1).Min();
+2 -1
View File
@@ -45,7 +45,8 @@ public enum MsgType : byte
ObjDestroy = 38, // Item verbraucht/zerstört (gegessen, getrunken ...): int Objekt-ID
VehicleDamage = 39, // Unfallschaden (verformte Karosserie): int Mesh-Schlüssel, int Eckpunkte, int n, je [int Index, 3 float]
TrafficStates = 40, // Verkehr, nur von der Welt-Autorität: int n, je [int Schlüssel, 3 float Pos, 4 float Rot, 3 float Geschw.]
WorldVars = 41 // Jobs/Laden: int n, je [int Schlüssel, byte Typ, Wert]
WorldVars = 41, // Jobs/Laden: int n, je [int Schlüssel, byte Typ, Wert]
HingeStates = 42 // Autotüren/Haube/Kofferraum: int n, je [int Schlüssel, 3 float Pos, 4 float Rot relativ zum Auto]
}
public readonly record struct Message(MsgType Type, byte[] Payload)
+2
View File
@@ -126,6 +126,8 @@ try
Check(await bob.WaitFor(MsgType.VehicleDamage) != null, "Crash damage is relayed");
alice.Send(MsgType.WorldVars, Wire.Build(w => { w.Write(1); w.Write(5); w.Write((byte)3); w.Write(true); }));
Check(await bob.WaitFor(MsgType.WorldVars) != null, "Job/shop values are relayed");
alice.Send(MsgType.HingeStates, Wire.Build(w => { w.Write(0); }));
Check(await bob.WaitFor(MsgType.HingeStates) != null, "Car door angles are relayed");
byte[] trafficPayload = Wire.Build(w => { w.Write(0); });
bob.Send(MsgType.TrafficStates, trafficPayload);
Check(await alice.WaitFor(MsgType.TrafficStates, 800) == null, "Traffic from a player who is not the world authority is ignored");