Skip to content

Commit

Permalink
Artillery Tables - Support for ammo that has native airFriction (#1…
Browse files Browse the repository at this point in the history
…0059)

* 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>
  • Loading branch information
3 people committed Jun 23, 2024
1 parent 05d6327 commit aed2222
Show file tree
Hide file tree
Showing 3 changed files with 49 additions and 3 deletions.
3 changes: 2 additions & 1 deletion addons/artillerytables/functions/fnc_firedEH.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ if (isNumber (configFile >> "CfgMagazines" >> _magazine >> QGVAR(airFriction)))
_airFriction = getNumber (configFile >> "CfgMagazines" >> _magazine >> QGVAR(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);

Expand All @@ -60,6 +60,7 @@ if (_newMuzzleVelocityCoefficent != 1) then {
_projectile setVelocity _bulletVelocity;
};

if (_airFriction > 0) exitWith {}; // positive value indicates it has vanilla airFriction, so we can just exit

[{
params ["_projectile", "_kFactor", "_time"];
Expand Down
11 changes: 9 additions & 2 deletions addons/artillerytables/functions/fnc_rangeTableOpen.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,15 @@ _mags = _mags apply {
private _initSpeed = getNumber (_magCfg >> _x >> "initSpeed");
_magParamsArray pushBackUnique _initSpeed;
private _airFriction = 0;
if (_advCorrection) then {
_airFriction = if (isNumber (_magCfg >> _x >> QGVAR(airFriction))) then { getNumber (_magCfg >> _x >> QGVAR(airFriction)) } else { DEFAULT_AIR_FRICTION };
private _magAirFriction = getNumber (_magCfg >> _x >> QGVAR(airFriction));
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;
[getText (_magCfg >> _x >> "displayNameShort"), getText (_magCfg >> _x >> "displayName"), _initSpeed, _airFriction]
Expand Down
38 changes: 38 additions & 0 deletions docs/wiki/framework/artillery-tables-framework.md
Original file line number Diff line number Diff line change
@@ -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)
```

0 comments on commit aed2222

Please sign in to comment.