Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 30 additions & 0 deletions ui/src/data/decoders/__tests__/protobufDecoderV2.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -351,6 +351,36 @@ describe("ProtobufDecoderV2.decodeChunk", () => {
expect(vehicleStates![1]).toEqual(vehicleStates![0]); // unchanged state carries forward
});

it("maps VIRTUAL/LOGIC per-frame sides to the VIRTUAL faction (backport parity with v1)", () => {
const buffer = encodePb(PbChunk, {
index: 0,
startFrame: 0,
frameCount: 2,
frames: [
{
frameNum: 0,
soldiers: [{
id: 1,
position: { x: 0, y: 0, z: 0 },
bearing: 0,
lifestate: 1,
side: "VIRTUAL",
}, {
id: 2,
position: { x: 0, y: 0, z: 0 },
bearing: 0,
lifestate: 1,
side: "LOGIC",
}],
},
],
});

const chunk = decoder.decodeChunk(buffer);
expect(chunk.entities.get(1)![0].side).toBe("VIRTUAL");
expect(chunk.entities.get(2)![0].side).toBe("VIRTUAL");
});

it("decodes v2 soldier extensions", () => {
const buffer = encodePb(PbChunk, {
index: 0,
Expand Down
2 changes: 2 additions & 0 deletions ui/src/data/decoders/protobufDecoderV2.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,8 @@ function mapSideString(raw: string): Side {
case "INDEPENDENT": return "GUER";
case "CIV":
case "CIVILIAN": return "CIV";
case "VIRTUAL":
case "LOGIC": return "VIRTUAL";
default: return "CIV";
}
}
Expand Down
Loading