mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
Redo XEH
This commit is contained in:
parent
24ab11a1e2
commit
11cd426b87
@ -14,7 +14,7 @@ class Extended_PostInit_EventHandlers {
|
||||
class Extended_GetIn_EventHandlers {
|
||||
class All {
|
||||
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 CAManBase {
|
||||
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]};";
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
//handle captive and unconsciousness state
|
||||
class Extended_Init_EventHandlers {
|
||||
class CAManBase {
|
||||
class GVAR(AutoDetachCaptive) {
|
||||
init = "_this call ACE_Captives_fnc_initUnit";
|
||||
killed = QUOTE(_this call FUNC(handleKilled));
|
||||
};
|
||||
};
|
||||
};
|
||||
@ -50,7 +41,7 @@ class Extended_Init_EventHandlers {
|
||||
class Extended_InitPost_EventHandlers {
|
||||
class CAManBase {
|
||||
class GVAR(InitPost) {
|
||||
init = "if (local (_this select 0)) then {_this call ACE_Captives_fnc_initPost};";
|
||||
init = QUOTE(_this call FUNC(handleUnitInitPost));
|
||||
};
|
||||
};
|
||||
};
|
||||
|
@ -6,12 +6,13 @@ PREP(canFriskPerson);
|
||||
PREP(canLoadCaptive);
|
||||
PREP(canUnloadCaptive);
|
||||
PREP(escortCaptive);
|
||||
PREP(handleGetIn);
|
||||
PREP(handleGetOut);
|
||||
PREP(handleKilled);
|
||||
PREP(handleKnockedOut);
|
||||
PREP(handlePlayerChanged);
|
||||
PREP(handleWokeUp);
|
||||
PREP(initPost);
|
||||
PREP(initUnit);
|
||||
PREP(handleUnitInitPost);
|
||||
PREP(loadCaptive);
|
||||
PREP(openFriskMenu);
|
||||
PREP(setCaptive);
|
||||
|
@ -18,14 +18,14 @@ class CfgPatches {
|
||||
#include "CfgWeapons.hpp"
|
||||
|
||||
|
||||
class ACE_Core_canInteractConditions {
|
||||
class ACE_Interaction_isNotEscorting {
|
||||
condition = "!(_player getVariable ['ACE_isEscorting', false])";
|
||||
class ACE_canInteractConditions {
|
||||
class GVAR(isNotEscorting) {
|
||||
condition = QUOTE(!(_player getVariable ['ACE_isEscorting', false])";
|
||||
};
|
||||
class ACE_Interaction_isNotCaptive {
|
||||
class GVAR(isNotCaptive) {
|
||||
condition = "!(_player getVariable ['ACE_isCaptive', false])";
|
||||
};
|
||||
class ACE_Interaction_isNotSurrendering {
|
||||
class GVAR(isNotSurrendering) {
|
||||
condition = "!(_player getVariable ['ACE_isSurrender', false])";
|
||||
};
|
||||
};
|
||||
|
24
addons/captives/functions/fnc_handleGetIn.sqf
Normal file
24
addons/captives/functions/fnc_handleGetIn.sqf
Normal 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];
|
||||
};
|
@ -19,16 +19,16 @@
|
||||
|
||||
PARAMS_3(_vehicle,_dontcare,_unit);
|
||||
|
||||
if (!local _unit) exitWith {};
|
||||
if (!(_unit getVariable ["ACE_isCaptive", false])) exitWith {};
|
||||
if ((local _unit)&&(_unit getVariable ["ACE_isCaptive", false])) then {
|
||||
|
||||
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 (_cargoIndex != -1) exitWith {
|
||||
_unit moveInCargo [_vehicle, _cargoIndex];
|
||||
};
|
||||
//If captive was not "unloaded", then move them back into the vehicle.
|
||||
if (_cargoIndex != -1) exitWith {
|
||||
_unit moveInCargo [_vehicle, _cargoIndex];
|
||||
};
|
||||
|
||||
[_unit, "ACE_AmovPercMstpScapWnonDnon", 2] call EFUNC(common,doAnimation);
|
||||
[_unit, "ACE_AmovPercMstpScapWnonDnon", 2] call EFUNC(common,doAnimation);
|
||||
};
|
26
addons/captives/functions/fnc_handleKilled.sqf
Normal file
26
addons/captives/functions/fnc_handleKilled.sqf
Normal 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]
|
||||
};
|
29
addons/captives/functions/fnc_handleUnitInitPost.sqf
Normal file
29
addons/captives/functions/fnc_handleUnitInitPost.sqf
Normal 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);
|
||||
};
|
||||
};
|
@ -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;
|
||||
};
|
@ -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);
|
@ -31,6 +31,6 @@ if (isNull _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);
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user