diff --git a/addons/captives/functions/fnc_doLoadCaptive.sqf b/addons/captives/functions/fnc_doLoadCaptive.sqf index 2a8bc055ec..a06a569e12 100644 --- a/addons/captives/functions/fnc_doLoadCaptive.sqf +++ b/addons/captives/functions/fnc_doLoadCaptive.sqf @@ -27,7 +27,7 @@ if ((isNull _target) && {_unit getVariable [QGVAR(isEscorting), false]}) then { }; } forEach (attachedObjects _unit); }; -if ((isNull _target) || {(vehicle _target) != _target} || {!(_target getVariable [QGVAR(isHandcuffed), false])}) exitWith {ERROR("");}; +if ((isNull _target) || {(vehicle _target) != _target} || {!(_target getVariable [QGVAR(isHandcuffed), false])}) exitWith {WARNING("");}; if (isNull _vehicle) then { //Looking at a captive unit, search for nearby vehicles with valid seats: @@ -44,7 +44,7 @@ if (isNull _vehicle) then { }; }; -if (isNull _vehicle) exitWith {ERROR("");}; +if (isNull _vehicle) exitWith {WARNING("Could not find vehicle to load captive");}; _unit setVariable [QGVAR(isEscorting), false, true]; [QGVAR(moveInCaptive), [_target, _vehicle], [_target]] call CBA_fnc_targetEvent; diff --git a/addons/captives/functions/fnc_findEmptyNonFFVCargoSeat.sqf b/addons/captives/functions/fnc_findEmptyNonFFVCargoSeat.sqf index cf67614f91..63792a7c55 100644 --- a/addons/captives/functions/fnc_findEmptyNonFFVCargoSeat.sqf +++ b/addons/captives/functions/fnc_findEmptyNonFFVCargoSeat.sqf @@ -18,50 +18,22 @@ params ["_vehicle"]; TRACE_1("params", _vehicle); -_vehicleConfig = configFile >> "CfgVehicles" >> (typeOf _vehicle); +private _vehicleConfig = configFile >> "CfgVehicles" >> (typeOf _vehicle); -_proxyOrder = getArray (_vehicleConfig >> "getInProxyOrder"); -_transportSoldier = getNumber (_vehicleConfig >> "transportSoldier"); -_realCargoCount = if (isArray (_vehicleConfig >> "getInProxyOrder")) then {count _proxyOrder} else {_transportSoldier}; +scopeName "main"; -//Find FFV turrets: -_ffvCargoIndexes = []; { - _turretConfig = [_vehicleConfig, _x] call EFUNC(common,getTurretConfigPath); - _isCargoProxy = ((getText (_turretConfig >> "proxyType")) == "CPCargo") && {isNumber (_turretConfig >> "proxyIndex")}; - - if (_isCargoProxy) then { - _proxyCargoIndex = getNumber (_turretConfig >> "proxyIndex"); - _cargoIndex = _proxyOrder find _proxyCargoIndex; - _ffvCargoIndexes pushBack _cargoIndex; + _x params ["_unit", "_role", "_cargoIndex", "_turretPath", "_isPersonTurret"]; + if ((isNull _unit) && {_role == "cargo"} && {_cargoIndex > -1} && {!_isPersonTurret}) then { + [_cargoIndex, false] breakOut "main"; }; -} forEach (allTurrets [_vehicle, true]); +} forEach (fullCrew [_vehicle, "", true]); -//Find Empty Seats: -_occupiedSeats = []; { - _x params ["", "", "_xIndex"]; - if (_xIndex > -1) then {_occupiedSeats pushBack _xIndex;}; -} forEach (fullCrew _vehicle); - -TRACE_3("Searching for empty seat",_realCargoCount,_ffvCargoIndexes,_occupiedSeats); - -_emptyCargoSeatReturn = [-1, false]; - -//First seach for non-ffv seats: -for "_index" from 0 to (_realCargoCount - 1) do { - if ((!(_index in _ffvCargoIndexes)) && {!(_index in _occupiedSeats)}) exitWith { - _emptyCargoSeatReturn = [_index, false]; + _x params ["_unit", "_role", "_cargoIndex", "_turretPath", "_isPersonTurret"]; + if ((isNull _unit) && {_cargoIndex > -1}) then { + [_cargoIndex, true] breakOut "main"; }; -}; +} forEach (fullCrew [_vehicle, "", true]); -//Only use FFV if none found: -if (_emptyCargoSeatReturn isEqualTo [-1, false]) then { - for "_index" from 0 to (_realCargoCount - 1) do { - if (!(_index in _occupiedSeats)) exitWith { - _emptyCargoSeatReturn = [_index, true]; - }; - }; -}; - -_emptyCargoSeatReturn +[-1, false] diff --git a/addons/captives/functions/fnc_setHandcuffed.sqf b/addons/captives/functions/fnc_setHandcuffed.sqf index 1859bfb0b1..d2011b5292 100644 --- a/addons/captives/functions/fnc_setHandcuffed.sqf +++ b/addons/captives/functions/fnc_setHandcuffed.sqf @@ -20,7 +20,7 @@ params ["_unit","_state"]; TRACE_2("params",_unit,_state); if (!local _unit) exitWith { - ERROR("running setHandcuffed on remote unit"); + WARNING("running setHandcuffed on remote unit"); }; if !(missionNamespace getVariable [QGVAR(captivityEnabled), false]) exitWith { @@ -35,7 +35,7 @@ if !(missionNamespace getVariable [QGVAR(captivityEnabled), false]) exitWith { }; if ((_unit getVariable [QGVAR(isHandcuffed), false]) isEqualTo _state) exitWith { - ERROR("setHandcuffed: current state same as new"); + WARNING("setHandcuffed: current state same as new"); }; if (_state) then { diff --git a/addons/captives/functions/fnc_setSurrendered.sqf b/addons/captives/functions/fnc_setSurrendered.sqf index 6acd3436aa..53e709bab7 100644 --- a/addons/captives/functions/fnc_setSurrendered.sqf +++ b/addons/captives/functions/fnc_setSurrendered.sqf @@ -20,7 +20,7 @@ params ["_unit","_state"]; TRACE_2("params",_unit,_state); if (!local _unit) exitWith { - ERROR("running surrender on remote unit"); + WARNING("running surrender on remote unit"); }; if !(missionNamespace getVariable [QGVAR(captivityEnabled), false]) exitWith { @@ -35,12 +35,12 @@ if !(missionNamespace getVariable [QGVAR(captivityEnabled), false]) exitWith { }; if ((_unit getVariable [QGVAR(isSurrendering), false]) isEqualTo _state) exitWith { - ERROR("Surrender: current state same as new"); + WARNING("Surrender: current state same as new"); }; if (_state) then { - if ((vehicle _unit) != _unit) exitWith {ERROR("Cannot surrender while mounted");}; - if (_unit getVariable [QGVAR(isHandcuffed), false]) exitWith {ERROR("Cannot surrender while handcuffed");}; + if ((vehicle _unit) != _unit) exitWith {WARNING("Cannot surrender while mounted");}; + if (_unit getVariable [QGVAR(isHandcuffed), false]) exitWith {WARNING("Cannot surrender while handcuffed");}; _unit setVariable [QGVAR(isSurrendering), true, true]; diff --git a/addons/captives/functions/fnc_vehicleCaptiveMoveIn.sqf b/addons/captives/functions/fnc_vehicleCaptiveMoveIn.sqf index dbd3e0af5c..503d80de2c 100644 --- a/addons/captives/functions/fnc_vehicleCaptiveMoveIn.sqf +++ b/addons/captives/functions/fnc_vehicleCaptiveMoveIn.sqf @@ -19,10 +19,10 @@ params ["_target","_vehicle"]; TRACE_2("params",_target,_vehicle); -_getSeat = [_vehicle] call FUNC(findEmptyNonFFVCargoSeat); +private _getSeat = [_vehicle] call FUNC(findEmptyNonFFVCargoSeat); TRACE_1("free cargo seat",_getSeat); _getSeat params ["_cargoIndex"]; -if (_cargoIndex == -1) exitWith {ERROR("cargo index -1");}; +if (_cargoIndex == -1) exitWith {WARNING("cargo index -1");}; _target moveInCargo [_vehicle, _cargoIndex]; _target assignAsCargoIndex [_vehicle, _cargoIndex];