1
0
Fork 0
mirror of https://github.com/demostf/demo.js synced 2026-06-03 16:44:12 +02:00

add fallback for getting teams from entity props

This commit is contained in:
Robin Appelman 2018-03-09 00:04:13 +01:00
commit 2cccec390a
2 changed files with 5 additions and 1 deletions

View file

@ -16,7 +16,7 @@ const echo = function (data) {
fs.readFile(argv._[0], function (err, data) {
if (err) throw err;
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();
if (argv.head) {
echo(head);

View file

@ -38,6 +38,10 @@ export function handleHL2DMEntity(entity: PacketEntity, match: Match, message: P
}
const propName = prop.definition.ownerTableName + '.' + prop.definition.name;
switch (propName) {
case 'DT_BaseEntity.m_iTeamNum':
if (!player.user.team) {
player.user.team = prop.value === 2 ? 'red' : 'blue';
}
case 'DT_BasePlayer.m_iHealth':
player.health = prop.value as number;
break;