mirror of
https://github.com/demostf/demo.js
synced 2026-06-04 00:54:14 +02:00
team and classes
This commit is contained in:
parent
bed36b2701
commit
8c337219b6
1 changed files with 14 additions and 1 deletions
15
parser.js
15
parser.js
|
|
@ -86,7 +86,8 @@ Parser.prototype.parseBody = function () {
|
||||||
this.state.users[userId] = {
|
this.state.users[userId] = {
|
||||||
name : name,
|
name : name,
|
||||||
userId : userId,
|
userId : userId,
|
||||||
steamId: steamId
|
steamId: steamId,
|
||||||
|
classes: {}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -113,6 +114,18 @@ Parser.prototype.parseBody = function () {
|
||||||
end_tick: tick
|
end_tick: tick
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
break;
|
||||||
|
case 'player_spawn':
|
||||||
|
userId = packet.event.values.userid;
|
||||||
|
if (!this.state.users[userId].team) { //only register first spawn
|
||||||
|
this.state.users[userId].team = packet.event.values.team === 2 ? 'red' : 'blue'
|
||||||
|
}
|
||||||
|
var classId = packet.event.values.class;
|
||||||
|
if (!this.state.users[userId].classes[classId]) {
|
||||||
|
this.state.users[userId].classes[classId] = 0;
|
||||||
|
}
|
||||||
|
this.state.users[userId].classes[classId]++;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue