remoteFncs -> events

This commit is contained in:
PabstMirror 2015-02-03 23:13:44 -06:00
parent 4156143ecf
commit 4c727fbff5
7 changed files with 238 additions and 183 deletions

View File

@ -6,7 +6,7 @@ class CfgVehicles {
displayName = "$STR_ACE_Captives_SetCaptive";
distance = 4;
condition = QUOTE(('ACE_CableTie' in (items _player)) && {alive _target} && {!(_target getVariable ['ACE_isCaptive', false])});
statement = QUOTE(_player removeItem 'ACE_CableTie'; [ARR_2(_target, true)] call FUNC(setCaptive););
statement = QUOTE(_player removeItem 'ACE_CableTie'; [ARR_3(QGVAR(SetCaptive), [_target], [ARR_2(_target, true)])] call EFUNC(common,targetEvent););
showDisabled = 0;
priority = 2.4;
icon = QUOTE(PATHTOF(UI\handcuff_ca.paa));
@ -90,7 +90,7 @@ class CfgVehicles {
};
};
#define MACRO_LOADUNLOADCAPTIVE \
#define MACRO_LOADUNLOADCAPTIVE \
class ACE_Actions { \
class ACE_LoadCaptive { \
displayName = "$STR_ACE_Captives_LoadCaptive"; \
@ -143,7 +143,7 @@ class CfgVehicles {
MACRO_LOADUNLOADCAPTIVE
};
#define MACRO_ADDITEM(ITEM,COUNT) class _xx_##ITEM { \
#define MACRO_ADDITEM(ITEM,COUNT) class _xx_##ITEM { \
name = #ITEM; \
count = COUNT; \
};

View File

@ -1,3 +1,9 @@
// by commy2
[missionNamespace, "playerChanged", {_this call ACE_Captives_fnc_handlePlayerChanged}] call ACE_Core_fnc_addCustomEventhandler;
[QGVAR(MoveIn), {_this call FUNC(vehicleCaptiveMoveIn)}] call EFUNC(common,addEventHandler);
[QGVAR(MoveOut), {_this call FUNC(vehicleCaptiveMoveOut)}] call EFUNC(common,addEventHandler);
[QGVAR(SetCaptive), {_this call FUNC(vehicleCaptiveMoveOut)}] call EFUNC(common,addEventHandler);

View File

@ -20,9 +20,9 @@
PARAMS_1(_unit,_target,_vehicle);
if (isNull _target) then {
// _objects = attachedObjects _unit;
// _objects = [_objects, {_this getVariable ["ACE_isCaptive", false]}] call EFUNC(common,filter);
// _target = _objects select 0;
_objects = attachedObjects _unit;
_objects = [_objects, {_this getVariable ["ACE_isCaptive", false]}] call EFUNC(common,filter);
_target = _objects select 0;
};
if (isNull _vehicle) then {
@ -30,7 +30,7 @@ if (isNull _vehicle) then {
_vehicle = _objects select 0;
};
if (!isNil "_target" && {!isNil "_vehicle"}) then {
if ((!isNil "_target") && {!isNil "_vehicle"}) then {
_unit setVariable ["ACE_isEscorting", false];
[[_target, _vehicle], "{(_this select 0) moveInCargo (_this select 1); (_this select 0) assignAsCargo (_this select 1); (_this select 0) setVariable ['ACE_Captives_CargoIndex', (_this select 1) getCargoIndex (_this select 0), true];}", _target] call ACE_Core_fnc_execRemoteFnc;
[QGVAR(MoveIn), [_target], [_target, _vehicle]] call EFUNC(common,targetEvent);
};

View File

@ -24,12 +24,9 @@ _cargo = crew _vehicle; // Can also unload from driver, gunner, commander, turr
_cargo = [_cargo, {_this getVariable ["ACE_isCaptive", false]}] call EFUNC(common,filter);
if (count _cargo > 0) then {
if ((count _cargo) > 0) then {
_target = _cargo select 0;
_target setVariable ["ACE_Captives_CargoIndex", -1, true];
moveOut _target;
[_target, "ACE_AmovPercMstpScapWnonDnon", 2] call EFUNC(common,doAnimation);
[_target, "{unassignVehicle _this}", _target] call ACE_Core_fnc_execRemoteFnc;
[QGVAR(MoveOut), [_target], [_target]] call EFUNC(common,targetEvent);
} else {
ERROR("No captive to unload");
};

View File

@ -0,0 +1,28 @@
/*
* Author: PabstMirror
* Loads a captive into a vehicle
*
* Arguments:
* 0: The Captive <OBJECT>
* 1: The Vehicle <OBJECT>
*
* Return Value:
* Nothing
*
* Example:
* TODO
*
* Public: No
*/
#include "script_component.hpp"
PARAMS_2(_target,_vehicle);
private ["_cargoIndex"];
_target moveInCargo _vehicle;
_target assignAsCargo _vehicle;
_cargoIndex = _vehicle getCargoIndex _target;
_target setVariable ["ACE_Captives_CargoIndex", _cargoIndex, true];
TRACE_3("moveinEH",_target,_vehicle,_cargoIndex);

View File

@ -0,0 +1,24 @@
/*
* Author: PabstMirror
* Unloads a captive from a vehicle.
*
* Arguments:
* 0: Captive Unit being unloaded <OBJECT>
*
* Return Value:
* Nothing
*
* Example:
* TODO
*
* Public: No
*/
#include "script_component.hpp"
PARAMS_1(_unit);
_unit setVariable ["ACE_Captives_CargoIndex", -1, true];
moveOut _unit;
[_unit, "ACE_AmovPercMstpScapWnonDnon", 2] call EFUNC(common,doAnimation);
unassignVehicle _unit;