Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 4 commits into from
Jun 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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)
```
Loading