Chemlights cleanup (#4304)

This commit is contained in:
PabstMirror 2016-08-31 15:12:40 -05:00 committed by Glowbal
parent 1df3a73461
commit 41d758567e
6 changed files with 22 additions and 12 deletions

View File

@ -2,6 +2,6 @@
if (!hasInterface) exitWith {}; if (!hasInterface) exitWith {};
["firedPlayer", DFUNC(throwEH)] call EFUNC(common,addEventHandler); ["ace_firedPlayer", DFUNC(throwEH)] call CBA_fnc_addEventHandler;
["firedPlayerNonLocal", DFUNC(throwEH)] call EFUNC(common,addEventHandler); // ["ace_firedPlayerNonLocal", DFUNC(throwEH)] call CBA_fnc_addEventHandler;
["firedNonPlayer", DFUNC(throwEH)] call EFUNC(common,addEventHandler); // ["ace_firedNonPlayer", DFUNC(throwEH)] call CBA_fnc_addEventHandler;

View File

@ -5,7 +5,7 @@
* Arguments: * Arguments:
* 0: Vehicle <OBJECT> * 0: Vehicle <OBJECT>
* 1: Player <OBJECT> * 1: Player <OBJECT>
* 3: Parameters <ARRAY> * 2: Parameters <ARRAY>
* *
* Return value: * Return value:
* None * None

View File

@ -3,7 +3,7 @@
* Check if an ammo classname is an IR chemlight. * Check if an ammo classname is an IR chemlight.
* *
* Arguments: * Arguments:
* 1: Projectile or ammo classname <OBJECT> or <STRING> * 0: Projectile or ammo classname <OBJECT> or <STRING>
* *
* Return Value: * Return Value:
* Is IR chemlight? <BOOL> * Is IR chemlight? <BOOL>

View File

@ -3,8 +3,8 @@
* Kill chemlight and any dummy objects attached to it. * Kill chemlight and any dummy objects attached to it.
* *
* Arguments: * Arguments:
* 1: Chemlight object <OBJECT> * 0: Chemlight object <OBJECT>
* 2: Light marker vehicle <OBJECT> * 1: Light marker vehicle <OBJECT>
* *
* Return Value: * Return Value:
* None * None

View File

@ -16,7 +16,7 @@
#include "script_component.hpp" #include "script_component.hpp"
params ["_unit", "_weapon", "_muzzle", "_mode", "_ammo", "_magazine", "_projectile", "_vehicle", "_gunner", "_turret"]; params ["_unit", "_weapon", "", "", "_ammo", "", "_projectile"];
if ((_weapon != "Throw") || {!(_ammo isKindOf ["Chemlight_base", configFile >> "CfgAmmo"])}) exitWith {}; if ((_weapon != "Throw") || {!(_ammo isKindOf ["Chemlight_base", configFile >> "CfgAmmo"])}) exitWith {};
@ -27,6 +27,11 @@ if (isNull _projectile) then {
if (local _unit) then { if (local _unit) then {
if ([_ammo] call FUNC(isIRClass)) then { if ([_ammo] call FUNC(isIRClass)) then {
[{_this call FUNC(throwIR)}, [_projectile, _ammo]] call CBA_fnc_execNextFrame; // Handle advancedThrowing:
if ((ace_player getVariable [QEGVAR(advancedThrowing,activeThrowable), objNull]) == _projectile) then {
[_projectile, _ammo, true] call FUNC(throwIR); // direct call if we are priming with adv throw
} else {
[{_this call FUNC(throwIR)}, [_projectile, _ammo]] call CBA_fnc_execNextFrame;
};
}; };
}; };

View File

@ -3,8 +3,9 @@
* Create and throw IR chemlight. * Create and throw IR chemlight.
* *
* Arguments: * Arguments:
* 1: Original throw projectile <OBJECT> * 0: Original throw projectile <OBJECT>
* 2: Class of projectile <STRING> * 1: Class of projectile <STRING>
* 2: Adv throw (default: false) <BOOL><OPTIONAL>
* *
* Return Value: * Return Value:
* None * None
@ -17,7 +18,7 @@
#include "script_component.hpp" #include "script_component.hpp"
params ["_projectile", "_ammo"]; params ["_projectile", "_ammo", ["_replaceAdvThrowable", false]];
private _config = configFile >> "CfgAmmo" >> _ammo; private _config = configFile >> "CfgAmmo" >> _ammo;
private _dummyClass = getText (_config >> "ACE_Chemlight_IR"); private _dummyClass = getText (_config >> "ACE_Chemlight_IR");
@ -29,3 +30,7 @@ private _dummy = _dummyClass createVehicle _pos;
_dummy setPosATL _pos; _dummy setPosATL _pos;
[_dummy, 90, 0] call BIS_fnc_setPitchBank; [_dummy, 90, 0] call BIS_fnc_setPitchBank;
_dummy setVelocity _velocity; _dummy setVelocity _velocity;
if (_replaceAdvThrowable) then {
ace_player setVariable [QEGVAR(advancedThrowing,activeThrowable), _dummy];
};