mirror of
https://github.com/tribufu/node-gamedig
synced 2026-05-18 09:35:50 +00:00
Fix raw player subobject in fivem, assettocorsa, gamespy2 Fixes #222
Clarify nodejs 12 requirement for gamedig 3 Fixes #220 Release 3.0.1
This commit is contained in:
parent
d65a24dc18
commit
fec5a1fac6
6 changed files with 25 additions and 20 deletions
|
|
@ -23,19 +23,18 @@ class AssettoCorsa extends Core {
|
|||
state.raw.carInfo = carInfo.Cars;
|
||||
state.raw.serverInfo = serverInfo;
|
||||
|
||||
state.players = carInfo.Cars.reduce((r, e) => {
|
||||
if (e.IsConnected) {
|
||||
r.push({
|
||||
name: e.DriverName,
|
||||
car: e.Model,
|
||||
skin: e.Skin,
|
||||
nation: e.DriverNation,
|
||||
team: e.DriverTeam
|
||||
for (const car of carInfo.Cars) {
|
||||
if (car.IsConnected) {
|
||||
state.players.push({
|
||||
name: car.DriverName,
|
||||
car: car.Model,
|
||||
skin: car.Skin,
|
||||
nation: car.DriverNation,
|
||||
team: car.DriverTeam
|
||||
});
|
||||
}
|
||||
return r;
|
||||
}, state.players);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = AssettoCorsa;
|
||||
module.exports = AssettoCorsa;
|
||||
|
|
|
|||
|
|
@ -25,7 +25,6 @@ class FiveM extends Quake2 {
|
|||
responseType: 'json'
|
||||
});
|
||||
state.raw.players = json;
|
||||
state.players = [];
|
||||
for (const player of json) {
|
||||
state.players.push({name: player.name, ping: player.ping});
|
||||
}
|
||||
|
|
|
|||
|
|
@ -29,7 +29,9 @@ class Gamespy2 extends Core {
|
|||
{
|
||||
const body = await this.sendPacket([0, 0xff, 0]);
|
||||
const reader = this.reader(body);
|
||||
state.players = this.readFieldData(reader);
|
||||
for (const rawPlayer of this.readFieldData(reader)) {
|
||||
state.players.push(rawPlayer);
|
||||
}
|
||||
}
|
||||
|
||||
// Parse teams
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue