mirror of
https://codeberg.org/demostf/inspector.git
synced 2026-06-03 18:14:08 +02:00
mark baselines
This commit is contained in:
parent
aa20564ccd
commit
a7577f78a5
3 changed files with 14 additions and 3 deletions
|
|
@ -80,6 +80,14 @@ function formatPropValue(value: SendPropValue): string {
|
|||
|
||||
function formatEntity(entity: PacketEntity, prop_names: Map<number, { table: String, prop: String }>, class_names: Map<number, String>,): string {
|
||||
let class_name = class_names.get(entity.server_class);
|
||||
let baseline = entity.baseline_props.map(prop => {
|
||||
let names = prop_names.get(prop.identifier);
|
||||
if (names) {
|
||||
return `(${names.table}.${names.prop})=${formatPropValue(prop.value)}`;
|
||||
} else {
|
||||
return `([unknown prop])=${prop.value}`;
|
||||
}
|
||||
})
|
||||
let props = entity.props.map(prop => {
|
||||
let names = prop_names.get(prop.identifier);
|
||||
if (names) {
|
||||
|
|
@ -88,7 +96,7 @@ function formatEntity(entity: PacketEntity, prop_names: Map<number, { table: Str
|
|||
return `[unknown prop]=${prop.value}`;
|
||||
}
|
||||
})
|
||||
return `entity ${entity.entity_index}(${class_name}) ${entity.pvs}: ` + props.join(', ');
|
||||
return `entity ${entity.entity_index}(${class_name}) ${entity.pvs}: ` + baseline.concat(props).join(', ');
|
||||
}
|
||||
|
||||
function formatEventDefinition(event: GameEventDefinition): string {
|
||||
|
|
@ -100,7 +108,7 @@ function filteredEntities(entities: PacketEntity[], search: Search) {
|
|||
if (search.filter || search.entity) {
|
||||
return entities.filter(entities => {
|
||||
return (search.entity == 0 || search.entity == entities.entity_index) &&
|
||||
(search.filter.length < 3 || filterEntity(entities.server_class, entities.props, search))
|
||||
(search.filter.length < 3 || filterEntity(entities.server_class, entities.baseline_props.concat(entities.props), search))
|
||||
});
|
||||
} else {
|
||||
return entities;
|
||||
|
|
|
|||
1
www/src/parser.d.ts
vendored
1
www/src/parser.d.ts
vendored
|
|
@ -3281,6 +3281,7 @@ export interface PacketEntity {
|
|||
delay?: number | null;
|
||||
entity_index: EntityId;
|
||||
in_pvs: boolean;
|
||||
baseline_props: SendProp[];
|
||||
props: SendProp[];
|
||||
pvs: PVS;
|
||||
serial_number: number;
|
||||
|
|
|
|||
|
|
@ -92,6 +92,7 @@ export function filterPacket(
|
|||
}
|
||||
|
||||
function filterPropNames(prop_names: Map<number, { table: string, prop: string }>, filter: string): number[] {
|
||||
filter = filter.toLowerCase();
|
||||
let ids = [];
|
||||
for (let [id, {table, prop}] of prop_names.entries()) {
|
||||
if (table.toLowerCase().includes(filter) || prop.toLowerCase().includes(filter)) {
|
||||
|
|
@ -102,6 +103,7 @@ function filterPropNames(prop_names: Map<number, { table: string, prop: string }
|
|||
}
|
||||
|
||||
function filterClassNames(class_names: Map<number, string>, filter: string): number[] {
|
||||
filter = filter.toLowerCase();
|
||||
let ids = [];
|
||||
for (let [id, name] of class_names.entries()) {
|
||||
if (name.toLowerCase().includes(filter)) {
|
||||
|
|
@ -141,7 +143,7 @@ export function filterMessage(
|
|||
case "GameEvent":
|
||||
return search.entity == 0 && message.event.type.includes(search.filter)
|
||||
case "PacketEntities":
|
||||
return message.removed_entities.includes(search.entity) || message.entities.some(entity => (search.entity == 0 || entity.entity_index == search.entity) && filterEntity(entity.server_class, entity.props, search))
|
||||
return message.removed_entities.includes(search.entity) || message.entities.some(entity => (search.entity == 0 || entity.entity_index == search.entity) && filterEntity(entity.server_class, entity.baseline_props.concat(entity.props), search))
|
||||
case "TempEntities":
|
||||
return search.entity == 0 && message.events.some(event => filterEntity(event.class_id, event.props, search))
|
||||
case "GetCvarValue":
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue