mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
carrying unconscious persons
This commit is contained in:
@ -17,36 +17,33 @@ private ["_unit", "_target"];
|
||||
_unit = _this select 0;
|
||||
_target = _this select 1;
|
||||
|
||||
// check weight
|
||||
private "_weight";
|
||||
_weight = [_target] call FUNC(getWeight);
|
||||
|
||||
if (_weight > GETMVAR(ACE_maxWeightCarry,1E11)) exitWith {
|
||||
[localize "STR_ACE_Dragging_UnableToDrag"] call EFUNC(common,displayTextStructured);
|
||||
};
|
||||
|
||||
// select no weapon and stop sprinting
|
||||
_unit action ["SwitchWeapon", _unit, _unit, 99];
|
||||
|
||||
[_unit, "isDragging", true] call EFUNC(common,setforceWalkStatus);
|
||||
|
||||
// prevent multiple players from accessing the same object
|
||||
[_unit, _target, true] call EFUNC(common,claim);
|
||||
|
||||
// get attachTo offset and direction.
|
||||
private ["_position", "_direction"];
|
||||
|
||||
_position = _target getVariable [QGVAR(carryPosition), [0, 0, 0]];
|
||||
_direction = _target getVariable [QGVAR(carryDirection), 0];
|
||||
|
||||
// add height offset of model
|
||||
private "_offset";
|
||||
_offset = (_target modelToWorld [0, 0, 0] select 2) - (_unit modelToWorld [0, 0, 0] select 2);
|
||||
// handle objects vs persons
|
||||
if (_target isKindOf "CAManBase") then {
|
||||
|
||||
_position = _position vectorAdd [0, 0, _offset];
|
||||
[_unit, "AcinPercMstpSnonWnonDnon", 2, true] call EFUNC(common,doAnimation);
|
||||
[_target, "AinjPfalMstpSnonWnonDf_carried_dead", 2, true] call EFUNC(common,doAnimation);
|
||||
|
||||
// attach object
|
||||
_target attachTo [_unit, _position];
|
||||
// attach person
|
||||
_target attachTo [_unit, _position, "LeftShoulder"];
|
||||
|
||||
} else {
|
||||
|
||||
// add height offset of model
|
||||
private "_offset";
|
||||
_offset = (_target modelToWorld [0, 0, 0] select 2) - (_unit modelToWorld [0, 0, 0] select 2);
|
||||
|
||||
_position = _position vectorAdd [0, 0, _offset];
|
||||
|
||||
// attach object
|
||||
_target attachTo [_unit, _position];
|
||||
|
||||
};
|
||||
_target setDir _direction;
|
||||
|
||||
_unit setVariable [QGVAR(isCarrying), true, true];
|
||||
|
Reference in New Issue
Block a user