mirror of
https://github.com/AsgardEternal/SquadJS.git
synced 2024-09-28 07:14:23 -05:00
track playercontrollers for death logging
This commit is contained in:
parent
4ab1fd73e7
commit
753fc17e6a
@ -242,6 +242,8 @@ export default class SquadServer extends EventEmitter {
|
||||
this.logParser.on('PLAYER_WOUNDED', async (data) => {
|
||||
data.victim = await this.getPlayerByName(data.victimName);
|
||||
data.attacker = await this.getPlayerByName(data.attackerName);
|
||||
if (!data.attacker)
|
||||
data.attacker = await this.getPlayerByController(data.attackerPlayerController);
|
||||
|
||||
if (data.victim && data.attacker)
|
||||
data.teamkill =
|
||||
@ -257,6 +259,9 @@ export default class SquadServer extends EventEmitter {
|
||||
|
||||
this.logParser.on('PLAYER_DIED', async (data) => {
|
||||
data.victim = await this.getPlayerByName(data.victimName);
|
||||
data.attacker = await this.getPlayerByName(data.attackerName);
|
||||
if (!data.attacker)
|
||||
data.attacker = await this.getPlayerByController(data.attackerPlayerController);
|
||||
|
||||
if (data.victim && data.attacker)
|
||||
data.teamkill =
|
||||
@ -351,6 +356,9 @@ export default class SquadServer extends EventEmitter {
|
||||
players.push({
|
||||
...oldPlayerInfo[player.steamID],
|
||||
...player,
|
||||
playercontroller: this.logParser.eventStore.players[player.steamID]
|
||||
? this.logParser.eventStore.players[player.steamID].controller
|
||||
: null,
|
||||
squad: await this.getSquadByID(player.teamID, player.squadID)
|
||||
});
|
||||
|
||||
@ -542,6 +550,13 @@ export default class SquadServer extends EventEmitter {
|
||||
return this.getPlayerByCondition((player) => player.suffix === suffix, forceUpdate, false);
|
||||
}
|
||||
|
||||
async getPlayerByController(controller, forceUpdate) {
|
||||
return this.getPlayerByCondition(
|
||||
(player) => player.playercontroller === controller,
|
||||
forceUpdate
|
||||
);
|
||||
}
|
||||
|
||||
async pingSquadJSAPI() {
|
||||
if (this.pingSquadJSAPITimeout) clearTimeout(this.pingSquadJSAPITimeout);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user