2015-03-18 00:36:56 +00:00
|
|
|
/*
|
|
|
|
* Author: L-H, commy2
|
|
|
|
*
|
|
|
|
* Handles raising and lowering the dragged weapon to be able to place it on top of objects.
|
|
|
|
*
|
2015-08-09 12:53:13 +00:00
|
|
|
* Arguments:
|
|
|
|
* 0: Scroll amount <NUMBER>
|
2015-03-18 00:36:56 +00:00
|
|
|
*
|
2015-08-09 12:53:13 +00:00
|
|
|
* Return Value:
|
|
|
|
* Handled or not. <BOOL>
|
|
|
|
*
|
|
|
|
* Public: No
|
2015-03-18 00:36:56 +00:00
|
|
|
*/
|
|
|
|
#include "script_component.hpp"
|
|
|
|
|
2015-08-24 11:43:11 +00:00
|
|
|
private ["_unit", "_carriedItem", "_position", "_maxHeight"];
|
2015-08-09 12:53:13 +00:00
|
|
|
|
|
|
|
params ["_scrollAmount"];
|
|
|
|
|
2015-03-18 00:36:56 +00:00
|
|
|
// requires modifier key to be hold down
|
2015-08-24 11:43:11 +00:00
|
|
|
if (missionNamespace getVariable ["ACE_Modifier", 0] == 0) exitWith {false};
|
2015-03-18 00:36:56 +00:00
|
|
|
|
|
|
|
_unit = ACE_player;
|
|
|
|
|
|
|
|
// EH is always assigned. Exit and don't overwrite input if not carrying
|
|
|
|
if !(_unit getVariable [QGVAR(isCarrying), false]) exitWith {false};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// move carried item 15 cm per scroll interval
|
|
|
|
_scrollAmount = _scrollAmount * 0.15;
|
|
|
|
|
2015-03-25 12:32:59 +00:00
|
|
|
_carriedItem = _unit getVariable [QGVAR(carriedObject), objNull];
|
|
|
|
|
|
|
|
//disabled for persons
|
|
|
|
if (_carriedItem isKindOf "CAManBase") exitWith {false};
|
2015-03-18 00:36:56 +00:00
|
|
|
|
|
|
|
_position = getPosATL _carriedItem;
|
2015-04-03 22:26:27 +00:00
|
|
|
_maxHeight = (_unit modelToWorldVisual [0,0,0]) select 2;
|
2015-03-18 00:36:56 +00:00
|
|
|
|
|
|
|
_position set [2, ((_position select 2) + _scrollAmount min (_maxHeight + 1.5)) max _maxHeight];
|
|
|
|
|
|
|
|
// move up/down object and reattach at current position
|
|
|
|
detach _carriedItem;
|
|
|
|
_carriedItem setPosATL _position;
|
|
|
|
_carriedItem attachTo [_unit];
|
|
|
|
|
|
|
|
true
|