diff --git a/GameServer.cs b/GameServer.cs index 18a6f14..7eeee28 100644 --- a/GameServer.cs +++ b/GameServer.cs @@ -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; /// Uhrzeit/Wetter gibt der Spieler mit der kleinsten ID vor (so rechnen es auch die Clients). int WorldAuthorityId => clients.Values.Where(c => c.State == ClientState.Joined).Select(c => c.Id).DefaultIfEmpty(-1).Min(); diff --git a/Protocol.cs b/Protocol.cs index d0e88e6..8e588a6 100644 --- a/Protocol.cs +++ b/Protocol.cs @@ -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) diff --git a/Tests/Program.cs b/Tests/Program.cs index b94f1cd..c316e57 100644 --- a/Tests/Program.cs +++ b/Tests/Program.cs @@ -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");