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,
|
level: number,
|
||||||
team: Team,
|
team: Team,
|
||||||
buildingType: BuildingType,
|
buildingType: BuildingType,
|
||||||
|
buildProgress: number,
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface ProjectileState {
|
export interface ProjectileState {
|
||||||
|
|
@ -329,7 +330,7 @@ export class ParsedDemo {
|
||||||
}
|
}
|
||||||
|
|
||||||
const PLAYER_PACK_SIZE = 9;
|
const PLAYER_PACK_SIZE = 9;
|
||||||
const BUILDING_PACK_SIZE = 7;
|
const BUILDING_PACK_SIZE = 8;
|
||||||
const PROJECTILE_PACK_SIZE = 6;
|
const PROJECTILE_PACK_SIZE = 6;
|
||||||
const CART_PACK_SIZE = 4;
|
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 team = (((team_type_health >> 13) & 1) === 0) ? Team.Blue : Team.Red;
|
||||||
const level = (team_type_health >> 14);
|
const level = (team_type_health >> 14);
|
||||||
const buildingType = ((team_type_health >> 10) & 7) as BuildingType;
|
const buildingType = ((team_type_health >> 10) & 7) as BuildingType;
|
||||||
|
const buildProgress = bytes[base + 7];
|
||||||
|
|
||||||
return {
|
return {
|
||||||
position: {x, y},
|
position: {x, y},
|
||||||
|
|
@ -392,6 +394,7 @@ function unpackBuilding(bytes: Uint8Array, base: number, world: WorldBoundaries)
|
||||||
team,
|
team,
|
||||||
buildingType,
|
buildingType,
|
||||||
level,
|
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";
|
import {Show} from "solid-js";
|
||||||
|
|
||||||
export interface BuildingProp {
|
export interface BuildingProp {
|
||||||
|
|
@ -55,8 +55,10 @@ export function Building(props: BuildingProp) {
|
||||||
try {
|
try {
|
||||||
const image = () => getBuildingType(props.building.buildingType);
|
const image = () => getBuildingType(props.building.buildingType);
|
||||||
return <g transform={transform()}>
|
return <g transform={transform()}>
|
||||||
<circle r={16} stroke-width={1} stroke="white" fill={teamColor()}
|
<circle r={16} stroke-width={1.5} stroke="white" fill={teamColor()}
|
||||||
opacity={alpha()}/>
|
opacity={alpha()}
|
||||||
|
stroke-dasharray={`${props.building.buildProgress} 100`}
|
||||||
|
/>
|
||||||
<image href={image()} class="player-icon" height={32} width={32} transform={`translate(-16 -16)`}
|
<image href={image()} class="player-icon" height={32} width={32} transform={`translate(-16 -16)`}
|
||||||
opacity={imageOpacity()}/>
|
opacity={imageOpacity()}/>
|
||||||
<Show when={props.building.angle}>
|
<Show when={props.building.angle}>
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue