Skip to content

Commit

Permalink
Advanced Ballistics - Removed confusing 'simulationRadius' setting
Browse files Browse the repository at this point in the history
  • Loading branch information
ulteq committed Nov 24, 2017
1 parent 39e0773 commit f7d91a8
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 25 deletions.
8 changes: 0 additions & 8 deletions addons/advanced_ballistics/ACE_Settings.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -79,12 +79,4 @@ class ACE_Settings {
value = 0.05;
sliderSettings[] = {0, 0.2, 0.05, 1};
};
class GVAR(simulationRadius) {
category = CSTRING(DisplayName);
displayName = CSTRING(simulationRadius_DisplayName);
description = CSTRING(simulationRadius_Description);
typeName = "SCALAR";
value = 3000;
sliderSettings[] = {0, 3000, 3000, 0};
};
};
6 changes: 0 additions & 6 deletions addons/advanced_ballistics/CfgVehicles.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -79,12 +79,6 @@ class CfgVehicles {
typeName = "NUMBER";
defaultValue = 0.05;
};
class simulationRadius {
displayName = CSTRING(simulationRadius_DisplayName);
description = CSTRING(simulationRadius_Description);
typeName = "NUMBER";
defaultValue = 3000;
};
};
class ModuleDescription {
description = CSTRING(Description);
Expand Down
26 changes: 16 additions & 10 deletions addons/advanced_ballistics/functions/fnc_handleFired.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,19 @@ TRACE_10("firedEH:",_unit, _weapon, _muzzle, _mode, _ammo, _magazine, _projectil

if (!(_ammo isKindOf "BulletBase")) exitWith {};
if (!alive _projectile) exitWith {};
if (_unit distance ACE_player > GVAR(simulationRadius)) exitWith {};
if (underwater _unit) exitWith {};

private _bulletVelocity = velocity _projectile;
private _muzzleVelocity = vectorMagnitude _bulletVelocity;
private _airFriction = getNumber(configFile >> "CfgAmmo" >> _ammo >> "airFriction");
private _timeToLive = getNumber(configFile >> "CfgAmmo" >> _ammo >> "timeToLive");
private _maxRange = if (_airFriction < 0) then {
-ln(1 - _airFriction * _muzzleVelocity * _timeToLive) / _airFriction
} else {
_muzzleVelocity * _timeToLive
};
if (_unit distance ACE_player > _maxRange) exitWith {};

private _abort = GVAR(disabledInFullAutoMode) && {!local _unit && {getNumber(configFile >> "CfgWeapons" >> _weapon >> _mode >> "autoFire") == 1}};
if (!local _unit && {!_abort && !GVAR(simulateForEveryone)}) then {
// The shooter is non local -> abort unless we match an exception rule
Expand All @@ -37,6 +47,11 @@ if (!local _unit && {!_abort && !GVAR(simulateForEveryone)}) then {
};
};
//if (!GVAR(vehicleGunnerEnabled) && !(_unit isKindOf "Man")) then { _abort = true; }; // We currently do not have firedEHs on vehicles
if (_abort) exitWith {
if (missionNamespace getVariable [QEGVAR(windDeflection,enabled), false]) then {
EGVAR(windDeflection,trackedBullets) pushBack [_projectile, getNumber(configFile >> "CfgAmmo" >> _ammo >> "airFriction")];
};
};

// Get Weapon and Ammo Configurations
private _AmmoCacheEntry = uiNamespace getVariable format[QGVAR(%1), _ammo];
Expand All @@ -55,9 +70,6 @@ private _temperature = nil; // We need the variable in this scope. So we need to

private _ammoCount = _unit ammo _muzzle;

private _bulletVelocity = velocity _projectile;
private _muzzleVelocity = vectorMagnitude _bulletVelocity;

if (GVAR(barrelLengthInfluenceEnabled)) then {
_muzzleVelocity = _muzzleVelocity + ([_barrelLength, _muzzleVelocityTable, _barrelLengthTable, _muzzleVelocity] call FUNC(calculateBarrelLengthVelocityShift));
};
Expand All @@ -78,12 +90,6 @@ if (GVAR(muzzleVelocityVariationEnabled)) then {
_bulletVelocity = (vectorNormalized _bulletVelocity) vectorMultiply _muzzleVelocity;
_projectile setVelocity _bulletVelocity;

if (_abort) exitWith {
if (missionNamespace getVariable [QEGVAR(windDeflection,enabled), false]) then {
EGVAR(windDeflection,trackedBullets) pushBack [_projectile, getNumber(configFile >> "CfgAmmo" >> _ammo >> "airFriction")];
};
};

private _bulletTraceVisible = false;
if (GVAR(bulletTraceEnabled) && cameraView == "GUNNER") then {
if (currentWeapon ACE_player == binocular ACE_player) then {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,5 @@ if !(_activated) exitWith {};
[_logic, QGVAR(simulateForSnipers), "simulateForSnipers"] call EFUNC(common,readSettingFromModule);
[_logic, QGVAR(simulateForGroupMembers), "simulateForGroupMembers"] call EFUNC(common,readSettingFromModule);
[_logic, QGVAR(simulationInterval), "simulationInterval"] call EFUNC(common,readSettingFromModule);
[_logic, QGVAR(simulationRadius), "simulationRadius"] call EFUNC(common,readSettingFromModule);

GVAR(simulationInterval) = 0 max GVAR(simulationInterval) min 0.2;

0 comments on commit f7d91a8

Please sign in to comment.