2023-09-12 18:58:10 +00:00
|
|
|
#include "..\script_component.hpp"
|
2015-12-15 07:09:26 +00:00
|
|
|
/*
|
2016-01-20 18:19:46 +00:00
|
|
|
* Author: Commy2
|
2015-12-15 07:09:26 +00:00
|
|
|
* Handle "take" event
|
|
|
|
* I think it fixs jams when manually dragging a new magazine in from player's inventory
|
|
|
|
*
|
2016-06-18 09:50:41 +00:00
|
|
|
* Arguments:
|
2015-12-15 07:09:26 +00:00
|
|
|
* 0: unit - Object the event handler is assigned to <OBJECT>
|
|
|
|
* 1: container <OBJECT>
|
|
|
|
* 2: item <STRING>
|
|
|
|
*
|
2016-06-18 09:50:41 +00:00
|
|
|
* Return Value:
|
2015-12-15 07:09:26 +00:00
|
|
|
* None
|
|
|
|
*
|
2017-06-08 13:31:51 +00:00
|
|
|
* Example:
|
|
|
|
* [bob, thing, "thing"] call ace_overheating_fnc_handleTakeEH
|
|
|
|
*
|
2015-12-15 07:09:26 +00:00
|
|
|
* Public: No
|
|
|
|
*/
|
|
|
|
|
|
|
|
params ["_unit", "_container", "_item"];
|
|
|
|
TRACE_3("params",_unit,_container,_item);
|
|
|
|
|
|
|
|
if ((_unit == ACE_player)
|
2021-10-14 15:47:52 +00:00
|
|
|
&& {_container in [uniformContainer _unit, vestContainer _unit, backpackContainer _unit]}
|
|
|
|
&& {_item == currentMagazine _unit}
|
|
|
|
) then { //Todo: should this be any valid magazine for any jammed gun?
|
2015-12-15 07:09:26 +00:00
|
|
|
|
2021-10-14 15:47:52 +00:00
|
|
|
if (GVAR(unJamOnReload)) then {
|
|
|
|
TRACE_1("clearing jam",currentWeapon _unit);
|
|
|
|
[_unit, currentWeapon _unit, true] call FUNC(clearJam);
|
|
|
|
};
|
2015-12-15 07:09:26 +00:00
|
|
|
|
2021-10-14 15:47:52 +00:00
|
|
|
if (GVAR(cookoffCoef) > 0) then {
|
|
|
|
_unit setVariable [format [QGVAR(%1_ammoTemp), currentWeapon _unit], 0];
|
|
|
|
};
|
2015-12-15 07:09:26 +00:00
|
|
|
};
|