Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Captives fixes #1599

Merged
merged 4 commits into from
Jun 13, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions addons/captives/CfgVehicles.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,13 @@ class CfgVehicles {
priority = 2.2;
hotkey = "L";
};
class GVAR(UnloadCaptive) {
displayName = CSTRING(UnloadCaptive);
distance = 4;
condition = QUOTE([ARR_2(_player, _target)] call FUNC(canUnloadCaptive));
statement = QUOTE([ARR_2(_player, _target)] call FUNC(doUnloadCaptive));
priority = 1.2;
};
class ACE_FriskPerson {
displayName = CSTRING(FriskPerson);
distance = 2;
Expand Down Expand Up @@ -111,13 +118,6 @@ class CfgVehicles {
exceptions[] = {"isNotEscorting"}; \
priority = 1.2; \
}; \
class GVAR(UnloadCaptive) { \
displayName = CSTRING(UnloadCaptive); \
distance = 4; \
condition = QUOTE([ARR_2(_player, _target)] call FUNC(canUnloadCaptive)); \
statement = QUOTE([ARR_2(_player, _target)] call FUNC(doUnloadCaptive)); \
priority = 1.2; \
}; \
}; \
};

Expand Down
4 changes: 3 additions & 1 deletion addons/captives/functions/fnc_canEscortCaptive.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,6 @@ PARAMS_2(_unit,_target);
(_target getVariable [QGVAR(isHandcuffed), false]) &&
{isNull (attachedTo _target)} &&
{alive _target} &&
{!(_target getVariable ["ACE_isUnconscious", false])}
{!(_target getVariable ["ACE_isUnconscious", false])} &&
{(vehicle _unit) == _unit} &&
{(vehicle _target) == _target}
15 changes: 5 additions & 10 deletions addons/captives/functions/fnc_canUnloadCaptive.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -3,26 +3,21 @@
* Check if the unit can unload a captive from the vehicle.
*
* Arguments:
* 0: Unit that wants to unload a captive <OBJECT>
* 1: A captive. ObjNull for the first escorted captive <OBJECT>
* 2: Vehicle to unload a captive from <OBJECT>
* 0: Unit that wants to unload a captive (player) <OBJECT>
* 1: A captive loaded in a vehicle <OBJECT>
*
* Return Value:
* The return value <BOOL>
*
* Example:
* [player, bob, car1] call ACE_captives_fnc_canUnloadCaptive;
* [player, bob] call ACE_captives_fnc_canUnloadCaptive;
*
* Public: No
*/
#include "script_component.hpp"

private ["_cargo"];

PARAMS_2(_unit,_vehicle);
PARAMS_2(_player,_unit);

_cargo = crew _vehicle; // Can also unload from driver, gunner, commander, turret positions. They shouldn't be there anyway.

_cargo = [_cargo, {_this getVariable [QGVAR(isHandcuffed), false]}] call EFUNC(common,filter);

count _cargo > 0
((vehicle _unit) != _unit) && {_unit getVariable [QGVAR(isHandcuffed), false]}
19 changes: 4 additions & 15 deletions addons/captives/functions/fnc_doUnloadCaptive.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -4,29 +4,18 @@
*
* Arguments:
* 0: Unit that wants to unload a captive <OBJECT>
* 1: Vehicle to unload a captive from. <BOOL>
* 1: A captive loaded in a vehicle <OBJECT>
*
* Return Value:
* Nothing
*
* Example:
* [bob, car] call ACE_captives_fnc_doUnloadCaptive
* [bob, prisoner] call ACE_captives_fnc_doUnloadCaptive
*
* Public: No
*/
#include "script_component.hpp"

PARAMS_2(_unit,_vehicle);
PARAMS_2(_unit,_target);

private ["_cargo", "_target"];

_cargo = crew _vehicle; // Can also unload from driver, gunner, commander, turret positions. They shouldn't be there anyway.

_cargo = [_cargo, {_this getVariable [QGVAR(isHandcuffed), false]}] call EFUNC(common,filter);

if ((count _cargo) > 0) then {
_target = _cargo select 0;
["MoveOutCaptive", [_target], [_target]] call EFUNC(common,targetEvent);
} else {
ERROR("No captive to unload");
};
["MoveOutCaptive", [_target], [_target]] call EFUNC(common,targetEvent);
3 changes: 3 additions & 0 deletions addons/interaction/functions/fnc_addPassengersActions.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,9 @@ _actions = [];
case (commander _vehicle): { QUOTE(A3\ui_f\data\IGUI\RscIngameUI\RscUnitInfo\role_commander_ca.paa) };
default { "" };
};
if (_unit getVariable [QEGVAR(captives,isHandcuffed), false]) then {
_icon = QUOTE(PATHTOEF(captives,UI\handcuff_ca.paa));
};
_actions pushBack
[
[
Expand Down