Merge pull request #1599 from acemod/captivesFixes

Captives fixes
This commit is contained in:
PabstMirror 2015-06-13 13:15:29 -05:00
commit fdb30f4e68
5 changed files with 22 additions and 33 deletions

View File

@ -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;
@ -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; \
}; \
}; \
};

View File

@ -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}

View File

@ -3,15 +3,14 @@
* 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
*/
@ -19,10 +18,6 @@
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]}

View File

@ -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);

View File

@ -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
[
[