diff --git a/addons/captives/CfgMoves.hpp b/addons/captives/CfgMoves.hpp index aa64e85e22..6c0bfc3ce9 100644 --- a/addons/captives/CfgMoves.hpp +++ b/addons/captives/CfgMoves.hpp @@ -18,6 +18,11 @@ class CfgMovesBasic { default = "ACE_AmovPercMstpSsurWnonDnon"; PutDown = ""; }; + class ACE_CivilHandCuffedFFVActions: ACE_CivilStandHandcuffedActions { + stop = "ACE_HandcuffedFFV"; + StopRelaxed = "ACE_HandcuffedFFV"; + default = "ACE_HandcuffedFFV"; + }; }; }; @@ -55,6 +60,14 @@ class CfgMovesMaleSdr: CfgMovesBasic { InterpolateTo[] = {"Unconscious",0.01,"ACE_AmovPercMstpSnonWnonDnon_AmovPercMstpScapWnonDnon",0.1}; }; + //Handcuffed-FFV: + class ACE_HandcuffedFFV: ACE_AmovPercMstpScapWnonDnon { + file = "\A3\cargoposes_F_heli\anim\passenger_flatground_3idleunarmed.rtm"; + actions = "ACE_CivilHandCuffedFFVActions"; + ConnectTo[] = {"ACE_AmovPercMstpScapWnonDnon",0.1}; + }; + + //Surrender Anims: class ACE_AmovPercMstpSnonWnonDnon_AmovPercMstpSsurWnonDnon: CutSceneAnimationBase { actions = "ACE_CivilStandSurrenderActions"; diff --git a/addons/captives/functions/fnc_canLoadCaptive.sqf b/addons/captives/functions/fnc_canLoadCaptive.sqf index 1cdc4d86a1..254f0de693 100644 --- a/addons/captives/functions/fnc_canLoadCaptive.sqf +++ b/addons/captives/functions/fnc_canLoadCaptive.sqf @@ -17,22 +17,31 @@ */ #include "script_component.hpp" -private ["_objects"]; params ["_unit", "_target","_vehicle"]; -if (isNull _target) then { - _objects = attachedObjects _unit; - _objects = [_objects, {_this getVariable [QGVAR(isHandcuffed), false]}] call EFUNC(common,filter); - if ((count _objects) > 0) then {_target = _objects select 0;}; +if ((isNull _target) && {_unit getVariable [QGVAR(isEscorting), false]}) then { + //Looking at a vehicle while escorting, get target from attached objects: + { + if (_x getVariable [QGVAR(isHandcuffed), false]) exitWith { + _target = _x; + }; + } forEach (attachedObjects _unit); }; +if ((isNull _target) || {(vehicle _target) != _target} || {!(_target getVariable [QGVAR(isHandcuffed), false])}) exitWith {false}; if (isNull _vehicle) then { - _objects = nearestObjects [_unit, ["Car", "Tank", "Helicopter", "Plane", "Ship"], 10]; - if ((count _objects) > 0) then {_vehicle = _objects select 0;}; + //Looking at a captive unit, search for nearby vehicles with valid seats: + { + // if (([_x] call FUNC(findEmptyNonFFVCargoSeat)) != -1) exitWith { + if ((_x emptyPositions "cargo") > 0) exitWith { + _vehicle = _x; + }; + } forEach (nearestObjects [_unit, ["Car", "Tank", "Helicopter", "Plane", "Ship"], 10]); +} else { + // if (([_vehicle] call FUNC(findEmptyNonFFVCargoSeat)) == -1) then { + if ((_vehicle emptyPositions "cargo") == 0) then { + _vehicle = objNull; + }; }; -(!isNull _target) -&& {!isNull _vehicle} -&& {_unit getVariable [QGVAR(isEscorting), false]} -&& {_target getVariable [QGVAR(isHandcuffed), false]} -&& {([_vehicle] call FUNC(findEmptyNonFFVCargoSeat)) != -1} +(!isNull _vehicle) diff --git a/addons/captives/functions/fnc_doLoadCaptive.sqf b/addons/captives/functions/fnc_doLoadCaptive.sqf index d7df42eb0a..a4d7df8892 100644 --- a/addons/captives/functions/fnc_doLoadCaptive.sqf +++ b/addons/captives/functions/fnc_doLoadCaptive.sqf @@ -1,6 +1,6 @@ /* * Author: commy2 - * Unit loads the target object into a vehicle. + * Unit loads the target object into a vehicle. (logic same as canLoadCaptive) * * Arguments: * 0: Unit that wants to load a captive @@ -17,24 +17,34 @@ */ #include "script_component.hpp" -private "_objects"; - params ["_unit", "_target","_vehicle"]; -if (isNull _target) then { - _objects = attachedObjects _unit; - _objects = [_objects, {_this getVariable [QGVAR(isHandcuffed), false]}] call EFUNC(common,filter); - if ((count _objects) > 0) then {_target = _objects select 0;}; +if ((isNull _target) && {_unit getVariable [QGVAR(isEscorting), false]}) then { + //Looking at a vehicle while escorting, get target from attached objects: + { + if (_x getVariable [QGVAR(isHandcuffed), false]) exitWith { + _target = _x; + }; + } forEach (attachedObjects _unit); }; -if (isNull _target) exitWith {}; +if ((isNull _target) || {(vehicle _target) != _target} || {!(_target getVariable [QGVAR(isHandcuffed), false])}) exitWith {ERROR("");}; if (isNull _vehicle) then { - _objects = nearestObjects [_unit, ["Car", "Tank", "Helicopter", "Plane", "Ship"], 10]; - if ((count _objects) > 0) then {_vehicle = _objects select 0;}; + //Looking at a captive unit, search for nearby vehicles with valid seats: + { + // if (([_x] call FUNC(findEmptyNonFFVCargoSeat)) != -1) exitWith { + if ((_x emptyPositions "cargo") > 0) exitWith { + _vehicle = _x; + }; + } forEach (nearestObjects [_unit, ["Car", "Tank", "Helicopter", "Plane", "Ship"], 10]); +} else { + // if (([_vehicle] call FUNC(findEmptyNonFFVCargoSeat)) == -1) then { + if ((_vehicle emptyPositions "cargo") == 0) then { + _vehicle = objNull; + }; }; -if (isNull _vehicle) exitWith {}; -if ((!isNil "_target") && {!isNil "_vehicle"}) then { - _unit setVariable [QGVAR(isEscorting), false, true]; - ["MoveInCaptive", [_target], [_target, _vehicle]] call EFUNC(common,targetEvent); -}; +if (isNull _vehicle) exitWith {ERROR("");}; + +_unit setVariable [QGVAR(isEscorting), false, true]; +["MoveInCaptive", [_target], [_target, _vehicle]] call EFUNC(common,targetEvent); diff --git a/addons/captives/functions/fnc_setHandcuffed.sqf b/addons/captives/functions/fnc_setHandcuffed.sqf index 413e3d59b5..e1f06e2b61 100644 --- a/addons/captives/functions/fnc_setHandcuffed.sqf +++ b/addons/captives/functions/fnc_setHandcuffed.sqf @@ -48,6 +48,9 @@ if (_state) then { if ((vehicle _unit) == _unit) then { [_unit] call EFUNC(common,fixLoweredRifleAnimation); [_unit, "ACE_AmovPercMstpScapWnonDnon", 1] call EFUNC(common,doAnimation); + } else { + [_unit, "ACE_HandcuffedFFV", 2] call EFUNC(common,doAnimation); + [_unit, "ACE_HandcuffedFFV", 1] call EFUNC(common,doAnimation); }; //Adds an animation changed eh @@ -63,10 +66,11 @@ if (_state) then { [_unit, "ACE_AmovPercMstpScapWnonDnon", 1] call EFUNC(common,doAnimation); }; } else { + // _turretPath = []; // { - // _x params ["_xUnit", "", "", "_xTurretPath"]; - // if (_unit == _xUnit) exitWith {_turretPath = _xTurretPath}; + // _x params ["_xUnit", "", "", "_xTurretPath"]; + // if (_unit == _xUnit) exitWith {_turretPath = _xTurretPath}; // } forEach (fullCrew (vehicle _unit)); // TRACE_1("turret Path",_turretPath); // if (_turretPath isEqualTo []) exitWith {}; @@ -75,6 +79,10 @@ if (_state) then { // TRACE_1("reseting to",_gunnerAction); // [_unit, "ACE_HandcuffedFFV", 2] call EFUNC(common,doAnimation); // [_unit, "ACE_AmovPercMstpScapWnonDnon", 1] call EFUNC(common,doAnimation); + + + [_unit, "ACE_HandcuffedFFV", 2] call EFUNC(common,doAnimation); + [_unit, "ACE_HandcuffedFFV", 1] call EFUNC(common,doAnimation); }; }]; _unit setVariable [QGVAR(handcuffAnimEHID), _animChangedEHID]; diff --git a/addons/captives/functions/fnc_vehicleCaptiveMoveIn.sqf b/addons/captives/functions/fnc_vehicleCaptiveMoveIn.sqf index 6e79725242..cb1c2fd37a 100644 --- a/addons/captives/functions/fnc_vehicleCaptiveMoveIn.sqf +++ b/addons/captives/functions/fnc_vehicleCaptiveMoveIn.sqf @@ -20,9 +20,16 @@ private ["_cargoIndex"]; params ["_target","_vehicle"]; -_cargoIndex = [_vehicle] call FUNC(findEmptyNonFFVCargoSeat); -if (_cargoIndex < 0) exitWith {ERROR("No Seat Avail");}; +// _cargoIndex = [_vehicle] call FUNC(findEmptyNonFFVCargoSeat); +// if (_cargoIndex < 0) exitWith {ERROR("No Seat Avail");}; +// _target moveInCargo [_vehicle, _cargoIndex]; + +_target moveInCargo _vehicle; -_target moveInCargo [_vehicle, _cargoIndex]; _target assignAsCargo _vehicle; + +_cargoIndex = _vehicle getCargoIndex _target; _target setVariable [QGVAR(CargoIndex), _cargoIndex, true]; + +[_target, "ACE_HandcuffedFFV", 2] call EFUNC(common,doAnimation); +[_target, "ACE_HandcuffedFFV", 1] call EFUNC(common,doAnimation); diff --git a/addons/captives/script_component.hpp b/addons/captives/script_component.hpp index e68eb19d2f..375c956129 100644 --- a/addons/captives/script_component.hpp +++ b/addons/captives/script_component.hpp @@ -1,6 +1,8 @@ #define COMPONENT captives #include "\z\ace\addons\main\script_mod.hpp" +// #define DEBUG_MODE_FULL + #ifdef DEBUG_ENABLED_CAPTIVES #define DEBUG_MODE_FULL #endif