Enabled wind deflection for grenades and vehicle gunners:

*Added a new module option to disable WD for vehicle gunners
*Fixed enabled setting not being initialized
This commit is contained in:
ulteq 2015-04-18 21:17:37 +02:00
parent c1ee623808
commit d8b461db91
6 changed files with 20 additions and 5 deletions

View File

@ -5,6 +5,12 @@ class ACE_Settings {
typeName = "BOOL";
value = 1;
};
class GVAR(vehicleEnabled) {
displayName = "Vehicle Enabled";
description = "Enables wind deflection for static/vehicle gunners";
typeName = "BOOL";
value = 1;
};
class GVAR(simulationInterval) {
displayName = "Simulation Interval";
description = "Defines the interval between every calculation step";

View File

@ -5,7 +5,7 @@ class Extended_PreInit_EventHandlers {
};
class Extended_FiredBIS_EventHandlers {
class CAManBase {
class AllVehicles {
class ADDON {
firedBIS = QUOTE(_this call FUNC(handleFired));
};

View File

@ -17,6 +17,12 @@ class CfgVehicles {
typeName = "BOOL";
defaultValue = 1;
};
class vehicleEnabled {
displayName = "Vehicle Enabled";
description = "Enables wind deflection for static/vehicle gunners";
typeName = "BOOL";
defaultValue = 1;
};
class simulationInterval {
displayName = "Simulation Interval";
description = "Defines the interval between every calculation step";

View File

@ -21,15 +21,16 @@
*/
#include "script_component.hpp"
if (missionNamespace getVariable [QEGVAR(advanced_ballistics,enabled), false]) exitWith {false};
private ["_unit", "_bullet"];
_unit = _this select 0;
_bullet = _this select 6;
if (missionNamespace getVariable [QEGVAR(advanced_ballistics,enabled), false] && (_bullet isKindOf "BulletBase") && (_unit isKindOf "Man")) exitWith {false};
if (!hasInterface) exitWith {false};
if (!(GVAR(enabled))) exitWith {false};
if (!(_bullet isKindOf "BulletBase")) exitWith {false};
if (!(GVAR(vehicleEnabled)) && !(_unit isKindOf "Man")) exitWith {false};
if (!((_bullet isKindOf "BulletBase") || (_bullet isKindOf "GrenadeBase"))) exitWith {false};
if (_unit distance ACE_player > GVAR(simulationRadius)) exitWith {false};
if (!([_unit] call EFUNC(common,isPlayer))) exitWith {false};

View File

@ -22,6 +22,8 @@ _activated = _this select 2;
if !(_activated) exitWith {};
[_logic, QGVAR(enabled), "enabled"] call EFUNC(common,readSettingFromModule);
[_logic, QGVAR(vehicleEnabled), "vehicleEnabled"] call EFUNC(common,readSettingFromModule);
[_logic, QGVAR(simulationInterval), "simulationInterval"] call EFUNC(common,readSettingFromModule);
[_logic, QGVAR(simulationRadius), "simulationRadius"] call EFUNC(common,readSettingFromModule);

View File

@ -26,7 +26,7 @@
_bulletVelocity = velocity _bullet;
_bulletSpeed = vectorMagnitude _bulletVelocity;
if (!alive _bullet || _bulletSpeed < 100) exitwith {
if (!alive _bullet || ((_bullet isKindOf "BulletBase") && _bulletSpeed < 100)) exitwith {
[_this select 1] call cba_fnc_removePerFrameHandler;
};