Merge pull request #1066 from acemod/scopes-usefiredBisEH

Switch scopes to use firedBIS
This commit is contained in:
Nicolás Badano
2015-05-09 01:21:10 -03:00
2 changed files with 17 additions and 14 deletions

View File

@ -10,10 +10,10 @@ class Extended_PostInit_EventHandlers {
}; };
}; };
class Extended_Fired_EventHandlers { class Extended_FiredBIS_EventHandlers {
class CAManBase { class CAManBase {
class ADDON { class ADDON {
fired = QUOTE(_this call FUNC(firedEH);); firedBIS = QUOTE(_this call FUNC(firedEH););
}; };
}; };
}; };

View File

@ -3,12 +3,13 @@
* Adjusts the flight path of the bullet according to the zeroing * Adjusts the flight path of the bullet according to the zeroing
* *
* Argument: * Argument:
* 0: Unit <OBJECT> * 0: unit - Object the event handler is assigned to <OBJECT>
* 1: Weapon <STRING> * 1: weapon - Fired weapon <STRING>
* 3: Muzzle <STRING> * 2: muzzle - Muzzle that was used <STRING>
* 4: Magazine <STRING> * 3: mode - Current mode of the fired weapon <STRING>
* 5: Ammo <STRING> * 4: ammo - Ammo used <STRING>
* 6: Projectile <OBJECT> * 5: magazine - magazine name which was used <STRING>
* 6: projectile - Object of the projectile that was shot <OBJECT>
* *
* Return value: * Return value:
* None * None
@ -20,23 +21,25 @@
private ["_unit", "_adjustment", "_weapon", "_projectile", "_weaponIndex", "_zeroing", "_adjustment"]; private ["_unit", "_adjustment", "_weapon", "_projectile", "_weaponIndex", "_zeroing", "_adjustment"];
_unit = _this select 0; _unit = _this select 0;
_weapon = _this select 1;
_projectile = _this select 6;
// Exit if the unit doesn't have any adjusment variable // Exit if the unit doesn't have any adjusment variable
_adjustment = _unit getVariable QGVAR(Adjustment); _adjustment = _unit getVariable [QGVAR(Adjustment), []];
if (isNil "_adjustment") exitWith {}; if (_adjustment isEqualTo []) exitWith {};
// Exit if the unit isn't a player // Exit if the unit isn't a player
if !([_unit] call EFUNC(common,isPlayer)) exitWith {}; if !([_unit] call EFUNC(common,isPlayer)) exitWith {};
_weapon = _this select 1;
_projectile = _this select 5;
_weaponIndex = [_unit, currentWeapon _unit] call EFUNC(common,getWeaponIndex); _weaponIndex = [_unit, currentWeapon _unit] call EFUNC(common,getWeaponIndex);
if (_weaponIndex < 0) exitWith {}; if (_weaponIndex < 0) exitWith {};
_zeroing = _adjustment select _weaponIndex; _zeroing = _adjustment select _weaponIndex;
//Exit if adjusment is zero:
if (_zeroing isEqualTo [0,0,0]) exitWith {};
// Convert zeroing from mils to degrees // Convert zeroing from mils to degrees
_zeroing = [_zeroing, {_this * 0.05625}] call EFUNC(common,map); _zeroing = _zeroing vectorMultiply 0.05625;
[_projectile, (_zeroing select 1), (_zeroing select 0) + (_zeroing select 2), 0] call EFUNC(common,changeProjectileDirection); [_projectile, (_zeroing select 1), (_zeroing select 0) + (_zeroing select 2), 0] call EFUNC(common,changeProjectileDirection);