diff --git a/src/Impostor.Server/Net/Inner/Objects/InnerShipStatus.cs b/src/Impostor.Server/Net/Inner/Objects/InnerShipStatus.cs index 575a64ac2..c571c5a31 100644 --- a/src/Impostor.Server/Net/Inner/Objects/InnerShipStatus.cs +++ b/src/Impostor.Server/Net/Inner/Objects/InnerShipStatus.cs @@ -56,31 +56,13 @@ public override async ValueTask DeserializeAsync(IClientPlayer sender, IClientPl return; } - if (initialState) + while (reader.Position < reader.Length) { - // TODO: (_systems[SystemTypes.Doors] as DoorsSystemType).SetDoors(); - foreach (var systemType in SystemTypeHelpers.AllTypes) + IMessageReader msgReader = reader.ReadMessage(); + SystemTypes type = (SystemTypes)msgReader.Tag; + if (_systems.TryGetValue(type, out var value)) { - if (_systems.TryGetValue(systemType, out var system)) - { - system.Deserialize(reader, true); - } - } - } - else - { - var count = reader.ReadPackedUInt32(); - - foreach (var systemType in SystemTypeHelpers.AllTypes) - { - // TODO: Not sure what is going on here, check. - if ((count & 1 << (int)(systemType & (SystemTypes.ShipTasks | SystemTypes.Doors))) != 0L) - { - if (_systems.TryGetValue(systemType, out var system)) - { - system.Deserialize(reader, false); - } - } + value.Deserialize(msgReader, initialState); } } } diff --git a/src/Impostor.Server/Net/Inner/Objects/Systems/ShipStatus/HeliSabotageSystemType.cs b/src/Impostor.Server/Net/Inner/Objects/Systems/ShipStatus/HeliSabotageSystemType.cs index f29c4b8df..22a2a22d5 100644 --- a/src/Impostor.Server/Net/Inner/Objects/Systems/ShipStatus/HeliSabotageSystemType.cs +++ b/src/Impostor.Server/Net/Inner/Objects/Systems/ShipStatus/HeliSabotageSystemType.cs @@ -31,9 +31,6 @@ public void Serialize(IMessageWriter writer, bool initialState) public void Deserialize(IMessageReader reader, bool initialState) { - // TODO: Find out what these 2 bytes are used for - _ = reader.ReadByte(); - _ = reader.ReadByte(); Countdown = reader.ReadSingle(); Timer = reader.ReadSingle(); ActiveConsoles.Clear(); // TODO: Thread safety