Merge pull request #4155 from acemod/firedEHCleanup

Minor cleanup of fired EH listeners
This commit is contained in:
Glowbal 2016-07-28 23:49:01 +02:00 committed by GitHub
commit a2a8f53157
5 changed files with 8 additions and 14 deletions

View File

@ -15,10 +15,8 @@ if(isServer) then {
// Register fire event handler
["ace_firedPlayer", DFUNC(fired)] call CBA_fnc_addEventHandler;
["ace_firedPlayerNonLocal", DFUNC(fired)] call CBA_fnc_addEventHandler;
["ace_firedNonPlayer", DFUNC(fired)] call CBA_fnc_addEventHandler;
["ace_firedPlayerVehicle", DFUNC(fired)] call CBA_fnc_addEventHandler;
["ace_firedPlayerVehicleNonLocal", DFUNC(fired)] call CBA_fnc_addEventHandler;
["ace_firedNonPlayerVehicle", DFUNC(fired)] call CBA_fnc_addEventHandler;
[FUNC(masterPFH), 0, []] call CBA_fnc_addPerFrameHandler;

View File

@ -51,7 +51,7 @@ if(GVAR(autoTrace)) then {
// We should do an {!(_round in GVAR(objects))}
// But we leave that out here for optimization. So this cannot be a framework function
// Otherwise, it should only be added once and from the FiredEH
if(_doFragTrack && alive _round) then {
if(_doFragTrack && {alive _round}) then {
_spallTrack = [];
_spallTrackID = [];

View File

@ -15,15 +15,13 @@
//IGNORE_PRIVATE_WARNING ["_unit", "_weapon", "_muzzle", "_mode", "_ammo", "_magazine", "_projectile", "_vehicle", "_gunner", "_turret"];
TRACE_10("firedEH:",_unit, _weapon, _muzzle, _mode, _ammo, _magazine, _projectile, _vehicle, _gunner, _turret);
private ["_adjustment", "_weaponIndex", "_zeroing", "_adjustment"];
_adjustment = _unit getVariable [QGVAR(Adjustment), []];
private _adjustment = _unit getVariable [QGVAR(Adjustment), []];
if (_adjustment isEqualTo []) exitWith {};
_weaponIndex = [_unit, currentWeapon _unit] call EFUNC(common,getWeaponIndex);
private _weaponIndex = [_unit, currentWeapon _unit] call EFUNC(common,getWeaponIndex);
if (_weaponIndex < 0) exitWith {};
_zeroing = _adjustment select _weaponIndex;
private _zeroing = _adjustment select _weaponIndex;
TRACE_1("Adjusting With",_zeroing);
if (_zeroing isEqualTo [0, 0, 0]) exitWith {};

View File

@ -15,11 +15,9 @@
*/
#include "script_component.hpp"
private ["_newOptics", "_adjustment"];
params ["_player"];
_adjustment = ACE_player getVariable QGVAR(Adjustment);
private _adjustment = ACE_player getVariable QGVAR(Adjustment);
if (isNil "_adjustment") then {
// [Windage, Elevation, Zero]
_adjustment = [[0, 0, 0], [0, 0, 0], [0, 0, 0]];
@ -30,7 +28,7 @@ if (isNil "_adjustment") then {
if (isNil QGVAR(Optics)) then {
GVAR(Optics) = ["", "", ""];
};
_newOptics = [_player] call FUNC(getOptics);
private _newOptics = [_player] call FUNC(getOptics);
{
if (_newOptics select _forEachIndex != _x) then {

View File

@ -18,9 +18,9 @@
//IGNORE_PRIVATE_WARNING ["_unit", "_weapon", "_muzzle", "_mode", "_ammo", "_magazine", "_projectile", "_vehicle", "_gunner", "_turret"];
TRACE_10("firedEH:",_unit, _weapon, _muzzle, _mode, _ammo, _magazine, _projectile, _vehicle, _gunner, _turret);
if (missionNamespace getVariable [QEGVAR(advanced_ballistics,enabled), false] && (_projectile isKindOf "BulletBase") && (_unit isKindOf "Man")) exitWith {false};
if (missionNamespace getVariable [QEGVAR(advanced_ballistics,enabled), false] && {_projectile isKindOf "BulletBase"} && {_unit isKindOf "Man"}) exitWith {false};
if (!((_projectile isKindOf "BulletBase") || (_projectile isKindOf "GrenadeBase"))) exitWith {false};
if (!((_projectile isKindOf "BulletBase") || {_projectile isKindOf "GrenadeBase"})) exitWith {false};
if (_unit distance ACE_player > GVAR(simulationRadius)) exitWith {false};
GVAR(trackedBullets) pushBack [_projectile, getNumber(configFile >> "CfgAmmo" >> _ammo >> "airFriction")];