mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
dbe372cb48
* Code cleanup * Moved keybinds to initKeybinds.sqf * Update addons/dragging/initKeybinds.sqf Co-authored-by: Grim <69561145+LinkIsGrim@users.noreply.github.com> * Update addons/dragging/functions/fnc_carryObject.sqf Co-authored-by: Grim <69561145+LinkIsGrim@users.noreply.github.com> * Update addons/dragging/functions/fnc_getWeight.sqf Co-authored-by: Grim <69561145+LinkIsGrim@users.noreply.github.com> * Rephrasing and adjustments for dragging --------- Co-authored-by: Grim <69561145+LinkIsGrim@users.noreply.github.com>
45 lines
1.2 KiB
Plaintext
45 lines
1.2 KiB
Plaintext
#include "script_component.hpp"
|
|
/*
|
|
* Author: commy2
|
|
* Handles the weapon changed event.
|
|
*
|
|
* Arguments:
|
|
* 0: Unit <OBJECT>
|
|
* 1: Weapon <STRING>
|
|
*
|
|
* Return Value:
|
|
* None
|
|
*
|
|
* Example:
|
|
* [player, primaryWeapon player] 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);
|
|
};
|
|
};
|
|
};
|