def getSPGShotResult(targetPosition,
                     shotIdx,
                     shotPos,
                     shotVel,
                     shotGravity,
                     player=None,
                     target=None):
    if player is None:
        player = BigWorld.player()
    shotResult = SPGShotResultEnum.NOT_HIT
    if targetPosition is None or player is None:
        return shotResult
    else:
        vehicleDescriptor = player.getVehicleDescriptor()
        shotDescr = vehicleDescriptor.getShot(shotIdx)
        minBounds, maxBounds = player.arena.getSpaceBB()
        endPos, _, collData, usedMaxDistance = AimingSystems.getCappedShotTargetInfos(
            shotPos, shotVel, shotGravity, shotDescr, player.playerVehicleID,
            minBounds, maxBounds, CollisionStrategy.COLLIDE_DYNAMIC_AND_STATIC)
        if not usedMaxDistance:
            if collData is None and (
                    endPos -
                    targetPosition).lengthSquared < _SPG_SHOT_RESULT_TOLERANCE:
                shotResult = SPGShotResultEnum.HIT
            elif collData is not None and collData.isVehicle():
                if target is None:
                    target = BigWorld.target()
                if isinstance(target, VehicleEntity):
                    targetVehicleID = target.id
                else:
                    targetVehicleID = None
                if targetVehicleID == collData.entity.id:
                    shotResult = SPGShotResultEnum.HIT
        return shotResult
 def __getTargetedEnemyForGun(self, gunShotPosition, excludeTeam):
     shotPos, shotVec = self.__getShotPosition(self.__turretYaw,
                                               self.__gunPitch,
                                               gunShotPosition)
     shotDescr = self._avatar.getVehicleDescriptor().shot
     gravity = Math.Vector3(0.0, -shotDescr.gravity, 0.0)
     testVehicleID = self.getAttachedVehicleID()
     collisionStrategy = AimingSystems.CollisionStrategy.COLLIDE_DYNAMIC_AND_STATIC
     minBounds, maxBounds = BigWorld.player().arena.getSpaceBB()
     _, _, collision, _ = AimingSystems.getCappedShotTargetInfos(
         shotPos, shotVec, gravity, shotDescr, testVehicleID, minBounds,
         maxBounds, collisionStrategy)
     if collision is not None:
         entity = collision.entity
         if entity is not None and entity.publicInfo and entity.publicInfo[
                 'team'] is not excludeTeam and entity.health > 0:
             return entity
     return
 def __getGunMarkerPosition(self, shotPos, shotVec, dispersionAngles):
     shotDescr = self._avatar.getVehicleDescriptor().shot
     gravity = Math.Vector3(0.0, -shotDescr.gravity, 0.0)
     testVehicleID = self.getAttachedVehicleID()
     collisionStrategy = AimingSystems.CollisionStrategy.COLLIDE_DYNAMIC_AND_STATIC
     minBounds, maxBounds = BigWorld.player().arena.getSpaceBB()
     endPos, direction, collData, usedMaxDistance = AimingSystems.getCappedShotTargetInfos(
         shotPos, shotVec, gravity, shotDescr, testVehicleID, minBounds,
         maxBounds, collisionStrategy)
     distance = shotDescr.maxDistance if usedMaxDistance else (
         endPos - shotPos).length
     markerDiameter = 2.0 * distance * dispersionAngles[0]
     idealMarkerDiameter = 2.0 * distance * dispersionAngles[1]
     replayCtrl = BattleReplay.g_replayCtrl
     if replayCtrl.isPlaying and replayCtrl.isClientReady:
         markerDiameter, endPos, direction = replayCtrl.getGunMarkerParams(
             endPos, direction)
     return (endPos, direction, markerDiameter, idealMarkerDiameter,
             collData)