mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
e2ac18a05d
* advanced_ballistics * advanced_fatigue * advanced_throwing * ai * aircraft * arsenal * atragmx * attach * backpacks * ballistics * captives * cargo * chemlights * common * concertina_wire * cookoff * dagr * disarming * disposable * dogtags * dragging * explosives * fastroping * fcs * finger * frag * gestures * gforces * goggles * grenades * gunbag * hearing * hitreactions * huntir * interact_menu * interaction * inventory * kestrel4500 * laser * laserpointer * logistics_uavbattery * logistics_wirecutter * magazinerepack * map * map_gestures * maptools * markers * medical * medical_ai * medical_blood * medical_menu * microdagr * minedetector * missileguidance * missionmodules * mk6mortar * modules * movement * nametags * nightvision * nlaw * optics * optionsmenu * overheating * overpressure * parachute * pylons * quickmount * rangecard * rearm * recoil * refuel * reload * reloadlaunchers * repair * respawn * safemode * sandbag * scopes * slideshow * spectator * spottingscope * switchunits * tacticalladder * tagging * trenches * tripod * ui * vector * vehiclelock * vehicles * viewdistance * weaponselect * weather * winddeflection * yardage450 * zeus * arsenal defines.hpp * optionals * DEBUG_MODE_FULL 1 * DEBUG_MODE_FULL 2 * Manual fixes * Add SQF Validator check for #include after block comment * explosives fnc_openTimerUI * fix uniqueItems
74 lines
2.1 KiB
Plaintext
74 lines
2.1 KiB
Plaintext
#include "script_component.hpp"
|
|
/*
|
|
* Author: commy2
|
|
* Start the carrying process.
|
|
*
|
|
* Arguments:
|
|
* 0: Unit that should do the carrying <OBJECT>
|
|
* 1: Object to carry <OBJECT>
|
|
*
|
|
* Return Value:
|
|
* None
|
|
*
|
|
* Example:
|
|
* [player, cursorTarget] call ace_dragging_fnc_startCarry;
|
|
*
|
|
* Public: No
|
|
*/
|
|
|
|
params ["_unit", "_target"];
|
|
TRACE_2("params",_unit,_target);
|
|
|
|
// check weight
|
|
private _weight = [_target] call FUNC(getWeight);
|
|
|
|
if (_weight > missionNamespace getVariable ["ACE_maxWeightCarry", 1E11]) exitWith {
|
|
[localize LSTRING(UnableToDrag)] call EFUNC(common,displayTextStructured);
|
|
};
|
|
|
|
private _timer = CBA_missionTime + 5;
|
|
|
|
// handle objects vs persons
|
|
if (_target isKindOf "CAManBase") then {
|
|
|
|
// add a primary weapon if the unit has none.
|
|
if (primaryWeapon _unit == "") then {
|
|
_unit addWeapon "ACE_FakePrimaryWeapon";
|
|
};
|
|
|
|
// select primary, otherwise the drag animation actions don't work.
|
|
_unit selectWeapon primaryWeapon _unit;
|
|
|
|
// move a bit closer and adjust direction when trying to pick up a person
|
|
_target setDir (getDir _unit + 180);
|
|
_target setPosASL (getPosASL _unit vectorAdd (vectorDir _unit));
|
|
|
|
[_unit, "AcinPknlMstpSnonWnonDnon_AcinPercMrunSnonWnonDnon", 2, true] call EFUNC(common,doAnimation);
|
|
[_target, "AinjPfalMstpSnonWrflDnon_carried_Up", 2, true] call EFUNC(common,doAnimation);
|
|
|
|
_timer = CBA_missionTime + 15;
|
|
|
|
} else {
|
|
|
|
// select no weapon and stop sprinting
|
|
_unit action ["SwitchWeapon", _unit, _unit, 299];
|
|
[_unit, "AmovPercMstpSnonWnonDnon", 0] call EFUNC(common,doAnimation);
|
|
|
|
[_unit, "forceWalk", "ACE_dragging", true] call EFUNC(common,statusEffect_set);
|
|
|
|
};
|
|
|
|
[_unit, "blockThrow", "ACE_dragging", true] call EFUNC(common,statusEffect_set);
|
|
|
|
// prevent multiple players from accessing the same object
|
|
[_unit, _target, true] call EFUNC(common,claim);
|
|
|
|
|
|
// prevents draging and carrying at the same time
|
|
_unit setVariable [QGVAR(isCarrying), true, true];
|
|
|
|
// required for aborting animation
|
|
_unit setVariable [QGVAR(carriedObject), _target, true];
|
|
|
|
[FUNC(startCarryPFH), 0.2, [_unit, _target, _timer]] call CBA_fnc_addPerFrameHandler;
|