Captives - Allow disarming and blindfolding captives in vehicles (#9463)

* Can disarm captives in vehicles

* Can blindfold captives in vehicles

* Fix dropping goggles/blindfold into large vehicles

* Apply suggestions from code review

Co-authored-by: Grim <69561145+LinkIsGrim@users.noreply.github.com>

---------

Co-authored-by: Grim <69561145+LinkIsGrim@users.noreply.github.com>
This commit is contained in:
Fabio Schick 2023-10-09 19:58:49 +02:00 committed by GitHub
parent 941207c45c
commit b4c72d8255
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 13 additions and 7 deletions

View File

@ -22,7 +22,5 @@ params ["_unit", "_target"];
(_target getVariable [QGVAR(isHandcuffed), false]) && (_target getVariable [QGVAR(isHandcuffed), false]) &&
{isNull (attachedTo _target)} && {isNull (attachedTo _target)} &&
{alive _target} && {alive _target} &&
{isNull objectParent _unit} &&
{isNull objectParent _target} &&
{(GVAR(blindfolds) findAny (_unit call EFUNC(common,uniqueItems))) != -1} && {(GVAR(blindfolds) findAny (_unit call EFUNC(common,uniqueItems))) != -1} &&
{!((goggles _target) in GVAR(blindfolds))} {!((goggles _target) in GVAR(blindfolds))}

View File

@ -22,6 +22,4 @@ params ["_unit", "_target"];
(_target getVariable [QGVAR(isHandcuffed), false]) && (_target getVariable [QGVAR(isHandcuffed), false]) &&
{isNull (attachedTo _target)} && {isNull (attachedTo _target)} &&
{alive _target} && {alive _target} &&
{isNull objectParent _unit} &&
{isNull objectParent _target} &&
{(goggles _target) in GVAR(blindfolds)} {(goggles _target) in GVAR(blindfolds)}

View File

@ -66,10 +66,16 @@ if (_state) then { // Blindfold target
removeGoggles _target; removeGoggles _target;
}; };
// Handle for things that need to be dropped to the ground // Handle for things that need to be dropped to the ground or in a vehicle inventory
if (_dropGoggles) then { if (_dropGoggles) then {
private _weaponHolder = nearestObject [_target, "WeaponHolder"]; private _weaponHolder = nearestObject [_target, "WeaponHolder"];
if (isNull _weaponHolder || {_target distance _weaponHolder > 2}) then { // if _target is in a vehicle, use vehicle inventory as container
private _inVehicle = !isNull objectParent _target;
if (_inVehicle) then {
_weaponHolder = objectParent _target;
};
if (!_inVehicle && {isNull _weaponHolder || {_target distance _weaponHolder > 2}}) then {
_weaponHolder = createVehicle ["GroundWeaponHolder", [0, 0, 0], [], 0, "NONE"]; _weaponHolder = createVehicle ["GroundWeaponHolder", [0, 0, 0], [], 0, "NONE"];
_weaponHolder setPosASL getPosASL _target; _weaponHolder setPosASL getPosASL _target;
}; };

View File

@ -29,7 +29,6 @@ if (_putDownAnim != "") exitWith { false };
(alive _target) && (alive _target) &&
{(abs (speed _target)) < 1} && {(abs (speed _target)) < 1} &&
{(vehicle _target) == _target} &&
{(_target getVariable ["ACE_isUnconscious", false]) || {(_target getVariable ["ACE_isUnconscious", false]) ||
{_target getVariable [QEGVAR(captives,isHandcuffed), false]} || {_target getVariable [QEGVAR(captives,isHandcuffed), false]} ||
{_target getVariable [QEGVAR(captives,isSurrendering), false]}} {_target getVariable [QEGVAR(captives,isSurrendering), false]}}

View File

@ -39,6 +39,11 @@ if (_doNotDropAmmo && {({_x in _listOfItemsToRemove} count (magazines _target))
private _holder = objNull; private _holder = objNull;
// if _target is in a vehicle, use vehicle inventory as container
if (!isNull objectParent _target) then {
_holder = objectParent _target;
};
//If not dropping ammo, don't use an existing container //If not dropping ammo, don't use an existing container
if (!_doNotDropAmmo) then { if (!_doNotDropAmmo) then {
{ {