building progress

This commit is contained in:
Robin Appelman 2025-06-28 20:10:14 +02:00
commit 812f3cdd0e
2 changed files with 9 additions and 4 deletions

View file

@ -204,6 +204,7 @@ export interface BuildingState {
level: number,
team: Team,
buildingType: BuildingType,
buildProgress: number,
}
export interface ProjectileState {
@ -329,7 +330,7 @@ export class ParsedDemo {
}
const PLAYER_PACK_SIZE = 9;
const BUILDING_PACK_SIZE = 7;
const BUILDING_PACK_SIZE = 8;
const PROJECTILE_PACK_SIZE = 6;
const CART_PACK_SIZE = 4;
@ -384,6 +385,7 @@ function unpackBuilding(bytes: Uint8Array, base: number, world: WorldBoundaries)
const team = (((team_type_health >> 13) & 1) === 0) ? Team.Blue : Team.Red;
const level = (team_type_health >> 14);
const buildingType = ((team_type_health >> 10) & 7) as BuildingType;
const buildProgress = bytes[base + 7];
return {
position: {x, y},
@ -392,6 +394,7 @@ function unpackBuilding(bytes: Uint8Array, base: number, world: WorldBoundaries)
team,
buildingType,
level,
buildProgress,
}
}