Artillery Tables - Support for ammo that has native airFriction (#10059)

* Artillery Tables - Support for ammo that has native `airFriction`

* fix comment

Co-authored-by: johnb432 <58661205+johnb432@users.noreply.github.com>

* Update addons/artillerytables/functions/fnc_rangeTableOpen.sqf

Co-authored-by: johnb432 <58661205+johnb432@users.noreply.github.com>

* replace if block with select const

Co-authored-by: johnb432 <58661205+johnb432@users.noreply.github.com>

---------

Co-authored-by: Grim <69561145+LinkIsGrim@users.noreply.github.com>
Co-authored-by: johnb432 <58661205+johnb432@users.noreply.github.com>
This commit is contained in:
PabstMirror 2024-06-22 22:34:34 -05:00 committed by GitHub
parent 05d6327e5e
commit aed2222b81
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 49 additions and 3 deletions

View File

@ -35,7 +35,7 @@ if (isNumber (configFile >> "CfgMagazines" >> _magazine >> QGVAR(airFriction)))
_airFriction = getNumber (configFile >> "CfgMagazines" >> _magazine >> QGVAR(airFriction)); _airFriction = getNumber (configFile >> "CfgMagazines" >> _magazine >> QGVAR(airFriction));
}; };
TRACE_1("",_airFriction); TRACE_1("",_airFriction);
if (_airFriction >= 0) exitWith {}; // 0 disables everything, >0 makes no sense if (_airFriction == 0) exitWith {}; // 0 disables everything
BEGIN_COUNTER(adjustmentsCalc); BEGIN_COUNTER(adjustmentsCalc);
@ -60,6 +60,7 @@ if (_newMuzzleVelocityCoefficent != 1) then {
_projectile setVelocity _bulletVelocity; _projectile setVelocity _bulletVelocity;
}; };
if (_airFriction > 0) exitWith {}; // positive value indicates it has vanilla airFriction, so we can just exit
[{ [{
params ["_projectile", "_kFactor", "_time"]; params ["_projectile", "_kFactor", "_time"];

View File

@ -41,8 +41,15 @@ _mags = _mags apply {
private _initSpeed = getNumber (_magCfg >> _x >> "initSpeed"); private _initSpeed = getNumber (_magCfg >> _x >> "initSpeed");
_magParamsArray pushBackUnique _initSpeed; _magParamsArray pushBackUnique _initSpeed;
private _airFriction = 0; private _airFriction = 0;
if (_advCorrection) then { private _magAirFriction = getNumber (_magCfg >> _x >> QGVAR(airFriction));
_airFriction = if (isNumber (_magCfg >> _x >> QGVAR(airFriction))) then { getNumber (_magCfg >> _x >> QGVAR(airFriction)) } else { DEFAULT_AIR_FRICTION }; if (_magAirFriction <= 0) then {
if (_advCorrection) then {
_airFriction = [DEFAULT_AIR_FRICTION, _magAirFriction] select (isNumber (_magCfg >> _x >> QGVAR(airFriction)));
};
} else {
// positive value, use ammo's airFriction (regardless of setting)
private _ammo = getText (_magCfg >> _x >> "ammo");
_airFriction = getNumber (configFile >> "CfgAmmo" >> _ammo >> "airFriction");
}; };
_magParamsArray pushBackUnique _airFriction; _magParamsArray pushBackUnique _airFriction;
[getText (_magCfg >> _x >> "displayNameShort"), getText (_magCfg >> _x >> "displayName"), _initSpeed, _airFriction] [getText (_magCfg >> _x >> "displayNameShort"), getText (_magCfg >> _x >> "displayName"), _initSpeed, _airFriction]

View File

@ -0,0 +1,38 @@
---
layout: wiki
title: Artillery Tables
description: Explains the configs for artillery tables.
group: framework
parent: wiki
mod: ace
version:
major: 3
minor: 13
patch: 0
---
## 1. Magazine Configs
```cpp
class CfgMagazines {
class yourMag {
ace_artillerytables_airFriction = -0.00006; // default value
// drag coefficent (when Air Resistance setting is enabled)
// can set to 0 to disable all muzzle effects and airFriction
// can set to +1 to use the ammo's native airFriction (not common, as most artillery ammo will have none)
```
## 2. Vehicle Configs
```cpp
class CfgVehicles {
class yourVic {
ace_artillerytables_showRangetable = 1; // [0 disabled, 1 enabled] falls back to artilleryScanner
// Show rangetable for this vehicle
ace_artillerytables_showGunLaying = 1; // [0 disabled, 1 enabled, 2 enabled w/ alt elevationMode] falls back to artilleryScanner
// Shows gun laying info (elev/azimuth)
ace_artillerytables_applyCorrections = 1; // [0 disabled, 1 enabled] falls back to artilleryScanner
// Apply advanced corrections (when setting enabled)
```