mirror of
https://github.com/demostf/demo.js
synced 2026-06-04 00:54:14 +02:00
add fallback for getting teams from entity props
This commit is contained in:
parent
04fc9b1f76
commit
2cccec390a
2 changed files with 5 additions and 1 deletions
|
|
@ -16,7 +16,7 @@ const echo = function (data) {
|
||||||
fs.readFile(argv._[0], function (err, data) {
|
fs.readFile(argv._[0], function (err, data) {
|
||||||
if (err) throw err;
|
if (err) throw err;
|
||||||
const demo = Demo.fromNodeBuffer(data);
|
const demo = Demo.fromNodeBuffer(data);
|
||||||
const analyser = demo.getAnalyser(argv.slow ? ParseMode.ENTITIES : Demo.ParseMode.MINIMAL);
|
const analyser = demo.getAnalyser(argv.slow ? 1 : 0);
|
||||||
const head = analyser.getHeader();
|
const head = analyser.getHeader();
|
||||||
if (argv.head) {
|
if (argv.head) {
|
||||||
echo(head);
|
echo(head);
|
||||||
|
|
|
||||||
|
|
@ -38,6 +38,10 @@ export function handleHL2DMEntity(entity: PacketEntity, match: Match, message: P
|
||||||
}
|
}
|
||||||
const propName = prop.definition.ownerTableName + '.' + prop.definition.name;
|
const propName = prop.definition.ownerTableName + '.' + prop.definition.name;
|
||||||
switch (propName) {
|
switch (propName) {
|
||||||
|
case 'DT_BaseEntity.m_iTeamNum':
|
||||||
|
if (!player.user.team) {
|
||||||
|
player.user.team = prop.value === 2 ? 'red' : 'blue';
|
||||||
|
}
|
||||||
case 'DT_BasePlayer.m_iHealth':
|
case 'DT_BasePlayer.m_iHealth':
|
||||||
player.health = prop.value as number;
|
player.health = prop.value as number;
|
||||||
break;
|
break;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue