ACE3/addons/dragging/functions/fnc_handlePlayerWeaponChanged.sqf
Dániel Boros af54808f67
Dragging - Add new dragging animations (#7950)
* New custom animation added

* Adjusted CfgMoves and the script components

* New drop animation and key handler

* CBA settings and new ManActions added

* Adjustments to the drop animation

* Added translations and fixed some stuff

* Update CfgMovesBasic.hpp

* Fix translations

Co-authored-by: Elgin675 <elgin675@hotmail.com>
Co-authored-by: Blutze <37950828+Blutze@users.noreply.github.com>

* Use the same key to drop object

* Update addons/dragging/stringtable.xml

Co-authored-by: Jo David <github@jonathandavid.de>

* Fix French translation

Co-authored-by: Elgin675 <elgin675@hotmail.com>

* Lower the weapon accuracy of the drag animations

* Removed auto-switch to handgun

* Update fnc_startDrag.sqf

 - Holding a launcher breaks the firing animation.
 - Now the unit has to hold either a primary weapon or handgun.

* Handle the unit's current weapon

Co-authored-by: BaerMitUmlaut <BaerMitUmlaut@users.noreply.github.com>

* Update addons/dragging/functions/fnc_handlePlayerWeaponChanged.sqf

Co-authored-by: Filip Maciejewski <veteran29@users.noreply.github.com>

* Update addons/dragging/initSettings.sqf

Co-authored-by: Elgin675 <elgin675@hotmail.com>
Co-authored-by: Blutze <37950828+Blutze@users.noreply.github.com>
Co-authored-by: Jo David <github@jonathandavid.de>
Co-authored-by: BaerMitUmlaut <BaerMitUmlaut@users.noreply.github.com>
Co-authored-by: Filip Maciejewski <veteran29@users.noreply.github.com>
Co-authored-by: jonpas <jonpas33@gmail.com>
2021-04-20 13:33:58 +02:00

52 lines
1.2 KiB
Plaintext

#include "script_component.hpp"
/*
* Author: commy2
* Handle the Weapon Changed Event
*
* Arguments:
* 0: Unit <OBJECT>
* 1: Weapon <STRING>
*
* Return Value:
* None
*
* Example:
* [_unit, "gun"] call ace_dragging_fnc_handlePlayerWeaponChanged;
*
* Public: No
*/
params ["_unit", "_weapon"];
TRACE_2("params",_unit,_weapon);
if (_unit getVariable [QGVAR(isDragging), false]) then {
// drop dragged object when changing weapon
if (_weapon != _unit getVariable [QGVAR(currentWeapon), ""]) then {
private _draggedObject = _unit getVariable [QGVAR(draggedObject), objNull];
[_unit, _draggedObject] call FUNC(dropObject);
};
};
if (_unit getVariable [QGVAR(isCarrying), false]) then {
private _carriedObject = _unit getVariable [QGVAR(carriedObject), objNull];
if (_carriedObject isKindOf "CAManBase") then {
if (_weapon != primaryWeapon _unit) then {
[_unit, _carriedObject] call FUNC(dropObject_carry);
};
} else {
// drop carried object when selecting any weapon
if (_weapon != "") then {
[_unit, _carriedObject] call FUNC(dropObject_carry);
};
};
};