mirror of
https://codeberg.org/demostf/frontend.git
synced 2026-06-03 18:24:12 +02:00
building progress
This commit is contained in:
parent
066cf9287f
commit
812f3cdd0e
2 changed files with 9 additions and 4 deletions
|
|
@ -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,
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
import {BuildingState, WorldBoundaries, BuildingType, Team} from "../Data/Parser";
|
||||
import {BuildingState, WorldBoundaries, BuildingType, Team, MedicState} from "../Data/Parser";
|
||||
import {Show} from "solid-js";
|
||||
|
||||
export interface BuildingProp {
|
||||
|
|
@ -55,8 +55,10 @@ export function Building(props: BuildingProp) {
|
|||
try {
|
||||
const image = () => getBuildingType(props.building.buildingType);
|
||||
return <g transform={transform()}>
|
||||
<circle r={16} stroke-width={1} stroke="white" fill={teamColor()}
|
||||
opacity={alpha()}/>
|
||||
<circle r={16} stroke-width={1.5} stroke="white" fill={teamColor()}
|
||||
opacity={alpha()}
|
||||
stroke-dasharray={`${props.building.buildProgress} 100`}
|
||||
/>
|
||||
<image href={image()} class="player-icon" height={32} width={32} transform={`translate(-16 -16)`}
|
||||
opacity={imageOpacity()}/>
|
||||
<Show when={props.building.angle}>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue