mirror of
https://github.com/demostf/demo.js
synced 2026-06-04 00:54:14 +02:00
sort props when encoding
This commit is contained in:
parent
2b0075736b
commit
6462480cbb
1 changed files with 7 additions and 0 deletions
|
|
@ -26,6 +26,13 @@ export function getEntityUpdate(sendTable: SendTable, stream: BitStream): SendPr
|
|||
|
||||
export function encodeEntityUpdate(props: SendProp[], sendTable: SendTable, stream: BitStream) {
|
||||
const allProps = sendTable.flattenedProps;
|
||||
|
||||
props.sort((propA, propB) => {
|
||||
const indexA = allProps.findIndex((propDef) => propDef.fullName === propA.definition.fullName);
|
||||
const indexB = allProps.findIndex((propDef) => propDef.fullName === propB.definition.fullName);
|
||||
return indexA - indexB;
|
||||
});
|
||||
|
||||
let lastIndex = -1;
|
||||
for (const prop of props) {
|
||||
stream.writeBoolean(true);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue