update/track deaths+killers per weapon

This commit is contained in:
SowinskiBraeden committed 2024-01-04 09:43:37 -08:00
1 parent 970abfac9f
commit 747cf04769
5 files changed
+15 -3

No files matched your search

+6
View File
@@ -61,6 +61,8 @@ module.exports = {
shotsLandedPerBodyPart: copy(BodyParts),
timesShotPerBodyPart: copy(BodyParts),
weaponStats: createWeaponsObject({
kills: 0,
deaths: 0,
shotsLanded: 0,
timesShot: 0,
shotsLandedPerBodyPart: copy(BodyParts),
@@ -101,6 +103,8 @@ module.exports = {
player.shotsLandedPerBodyPart = copy(BodyParts);
player.timesShotPerBodyPart = copy(BodyParts);
player.weaponStats = createWeaponsObject({
kills: 0,
deaths: 0,
shotsLanded: 0,
timesShot: 0,
shotsLandedPerBodyPart: copy(BodyParts),
@@ -112,6 +116,8 @@ module.exports = {
// If a new weapon is not in the existing weaponStats, this will add it.
createWeaponStats(player, weapon) {
player.weaponStats[weapon] = {
kills: 0,
deaths: 0,
shotsLanded: 0,
timesShot: 0,
shotsLandedPerBodyPart: copy(BodyParts),
+1 -1
View File
@@ -70,5 +70,5 @@ module.exports = {
},
},
weaponClassOf: (weapon) => Object.keys(module.exports.weapons).filter(v => module.exports.weapons[v].hasOwnProperty(weapon))[0],
weaponClassOf: (weapon) => Object.keys(module.exports.weapons).filter(c => weapon in module.exports.weapons[c])[0],
}