This commit is contained in:
PabstMirror 2015-02-04 00:35:51 -06:00
parent 24ab11a1e2
commit 11cd426b87
10 changed files with 100 additions and 75 deletions

View File

@ -14,7 +14,7 @@ class Extended_PostInit_EventHandlers {
class Extended_GetIn_EventHandlers { class Extended_GetIn_EventHandlers {
class All { class All {
class GVAR(AutoDetachCaptive) { class GVAR(AutoDetachCaptive) {
getIn = "if (local (_this select 2) && {(_this select 2) getVariable ['ACE_isEscorting', false]}) then {(_this select 2) setVariable ['ACE_isEscorting', false, true]}"; getIn = QUOTE(_this call FUNC(handleGetIn));
}; };
}; };
}; };
@ -32,16 +32,7 @@ class Extended_GetOut_EventHandlers {
class Extended_Killed_EventHandlers { class Extended_Killed_EventHandlers {
class CAManBase { class CAManBase {
class GVAR(AutoDetachCaptive) { class GVAR(AutoDetachCaptive) {
killed = "if ((_this select 0) getVariable ['ACE_isCaptive', false]) then {(_this select 0) setVariable ['ACE_isCaptive', false, true]}; if ((_this select 0) getVariable ['ACE_isEscorting', false]) then {(_this select 0) setVariable ['ACE_isEscorting', false, true]};"; killed = QUOTE(_this call FUNC(handleKilled));
};
};
};
//handle captive and unconsciousness state
class Extended_Init_EventHandlers {
class CAManBase {
class GVAR(AutoDetachCaptive) {
init = "_this call ACE_Captives_fnc_initUnit";
}; };
}; };
}; };
@ -50,7 +41,7 @@ class Extended_Init_EventHandlers {
class Extended_InitPost_EventHandlers { class Extended_InitPost_EventHandlers {
class CAManBase { class CAManBase {
class GVAR(InitPost) { class GVAR(InitPost) {
init = "if (local (_this select 0)) then {_this call ACE_Captives_fnc_initPost};"; init = QUOTE(_this call FUNC(handleUnitInitPost));
}; };
}; };
}; };

View File

@ -6,12 +6,13 @@ PREP(canFriskPerson);
PREP(canLoadCaptive); PREP(canLoadCaptive);
PREP(canUnloadCaptive); PREP(canUnloadCaptive);
PREP(escortCaptive); PREP(escortCaptive);
PREP(handleGetIn);
PREP(handleGetOut); PREP(handleGetOut);
PREP(handleKilled);
PREP(handleKnockedOut); PREP(handleKnockedOut);
PREP(handlePlayerChanged); PREP(handlePlayerChanged);
PREP(handleWokeUp); PREP(handleWokeUp);
PREP(initPost); PREP(handleUnitInitPost);
PREP(initUnit);
PREP(loadCaptive); PREP(loadCaptive);
PREP(openFriskMenu); PREP(openFriskMenu);
PREP(setCaptive); PREP(setCaptive);

View File

@ -18,14 +18,14 @@ class CfgPatches {
#include "CfgWeapons.hpp" #include "CfgWeapons.hpp"
class ACE_Core_canInteractConditions { class ACE_canInteractConditions {
class ACE_Interaction_isNotEscorting { class GVAR(isNotEscorting) {
condition = "!(_player getVariable ['ACE_isEscorting', false])"; condition = QUOTE(!(_player getVariable ['ACE_isEscorting', false])";
}; };
class ACE_Interaction_isNotCaptive { class GVAR(isNotCaptive) {
condition = "!(_player getVariable ['ACE_isCaptive', false])"; condition = "!(_player getVariable ['ACE_isCaptive', false])";
}; };
class ACE_Interaction_isNotSurrendering { class GVAR(isNotSurrendering) {
condition = "!(_player getVariable ['ACE_isSurrender', false])"; condition = "!(_player getVariable ['ACE_isSurrender', false])";
}; };
}; };

View File

@ -0,0 +1,24 @@
/*
* Author: commy2
* Handles when a unit gets in to a vehicle. Release escorted captive when entering a vehicle
*
* Arguments:
* 0: _vehicle <OBJECT>
* 2: dunno <OBJECT>
* 1: _unit <OBJECT>
*
* Return Value:
* The return value <BOOL>
*
* Example:
* -
*
* Public: No
*/
#include "script_component.hpp"
PARAMS_3(_vehicle,_dontcare,_unit);
if ((local _unit) && (_unit getVariable ["ACE_isEscorting", false])) then {
_unit setVariable ["ACE_isEscorting", false, true];
};

View File

@ -19,16 +19,16 @@
PARAMS_3(_vehicle,_dontcare,_unit); PARAMS_3(_vehicle,_dontcare,_unit);
if (!local _unit) exitWith {}; if ((local _unit)&&(_unit getVariable ["ACE_isCaptive", false])) then {
if (!(_unit getVariable ["ACE_isCaptive", false])) exitWith {};
private ["_cargoIndex"]; private ["_cargoIndex"];
_cargoIndex = _unit getVariable ["ACE_Captives_CargoIndex", -1]; _cargoIndex = _unit getVariable ["ACE_Captives_CargoIndex", -1];
//If captive was not "unloaded", then move them back into the vehicle. //If captive was not "unloaded", then move them back into the vehicle.
if (_cargoIndex != -1) exitWith { if (_cargoIndex != -1) exitWith {
_unit moveInCargo [_vehicle, _cargoIndex]; _unit moveInCargo [_vehicle, _cargoIndex];
}; };
[_unit, "ACE_AmovPercMstpScapWnonDnon", 2] call EFUNC(common,doAnimation); [_unit, "ACE_AmovPercMstpScapWnonDnon", 2] call EFUNC(common,doAnimation);
};

View File

@ -0,0 +1,26 @@
/*
* Author: PabstMirror
* Handles when a unit is kill. Reset captivity and escorting status when getting killed
*
* Arguments:
* 0: _oldUnit <OBJECT>
*
* Return Value:
* None
*
* Example:
* -
*
* Public: No
*/
#include "script_component.hpp"
PARAMS_1(_oldUnit);
if (_oldUnit getVariable ["ACE_isCaptive", false]) then {
_oldUnit setVariable ["ACE_isCaptive", false, true];
};
if (_oldUnit getVariable ["ACE_isEscorting", false]) then {
_oldUnit setVariable ["ACE_isEscorting", false, true]
};

View File

@ -0,0 +1,29 @@
/*
* Author: commy2
* handle captive and unconsciousness state and prevent grenades
*
* Arguments:
* 0: _unit <OBJECT>
*
* Return Value:
* The return value <BOOL>
*
* Example:
* TODO
*
* Public: No
*/
#include "script_component.hpp"
PARAMS_1(_unit);
// prevent players from throwing grenades
[_unit, "Throw", {(_this select 1) getVariable ["ACE_isCaptive", false]}, {}] call EFUNC(common,addActionEventhandler);
if (local _unit) then {
// reset status on mission start
if (_unit getVariable ["ACE_isCaptive", false]) then {
_unit setVariable ["ACE_isCaptive", false];
[_unit, true] call FUNC(setCaptive);
};
};

View File

@ -1,24 +0,0 @@
/*
* Author: commy2
* TODO
*
* Arguments:
* 0: _unit <OBJECT>
*
* Return Value:
* The return value <BOOL>
*
* Example:
* TODO
*
* Public: No
*/
#include "script_component.hpp"
PARAMS_1(_unit);
// reset status on mission start
if (_unit getVariable ["ACE_isCaptive", false]) then {
_unit setVariable ["ACE_isCaptive", false];
[_unit, true] call ACE_Captives_fnc_setCaptive;
};

View File

@ -1,22 +0,0 @@
/*
* Author: commy2
* TODO
*
* Arguments:
* 0: _unit <OBJECT>
*
* Return Value:
* The return value <BOOL>
*
* Example:
* TODO
*
* Public: No
*/
#include "script_component.hpp"
PARAMS_1(_unit);
// prevent players from throwing grenades
[_unit, "Throw", {(_this select 1) getVariable ["ACE_isCaptive", false]}, {}] call EFUNC(common,addActionEventhandler);

View File

@ -31,6 +31,6 @@ if (isNull _vehicle) then {
}; };
if ((!isNil "_target") && {!isNil "_vehicle"}) then { if ((!isNil "_target") && {!isNil "_vehicle"}) then {
_unit setVariable ["ACE_isEscorting", false]; _unit setVariable ["ACE_isEscorting", false, true];
["MoveInCaptive", [_target], [_target, _vehicle]] call EFUNC(common,targetEvent); ["MoveInCaptive", [_target], [_target, _vehicle]] call EFUNC(common,targetEvent);
}; };