Skip to content
Permalink
Browse files
Consider having your vehicle shot as being shot yourself
Part of #792
  • Loading branch information
RussellLVP committed Jul 21, 2020
1 parent 751c256 commit e76cdfea11fa20636b740930fd95d41e6f1d8e0b
Showing 1 changed file with 13 additions and 3 deletions.
@@ -214,9 +214,19 @@ export class LimitsDecider extends PlayerEventObserver {
this.deathmatchDamageIssuedTime_.set(issuer, currentTime);
}

// Called when the |player| has taken a shot, irrespective of whether it hit anything.
onPlayerWeaponShot(player) {
this.deathmatchWeaponShotTime_.set(player, server.clock.monotonicallyIncreasingTime());
// Called when the |player| has taken a shot, irrespective of whether it hit anything. When the
// shot has hit a vehicle rather than a player, and the vehicle is occupied by a driver, then
// the driver will be tagged as having just taken damage instead.
onPlayerWeaponShot(player, weaponId, hitType, hitId, hitPosition) {
const currentTime = server.clock.monotonicallyIncreasingTime();

this.deathmatchWeaponShotTime_.set(player, currentTime);

if (hitType === 2 /* BULLET_HIT_TYPE_VEHICLE */) {
const vehicleId = server.vehicleManager.getById(hitId);
if (vehicleId && vehicleId.driver)
this.deathmatchDamageTakenTime_.set(vehicleId.driver, currentTime);
}
}

// ---------------------------------------------------------------------------------------------

0 comments on commit e76cdfe

Please sign in to comment.