only use for medical, keep setCaptive for captives

This commit is contained in:
commy2 2017-12-06 17:22:07 +01:00
parent 1890c71c65
commit eba99f4707
3 changed files with 16 additions and 5 deletions

View File

@ -21,23 +21,32 @@
[QGVAR(setStatusEffect), {_this call FUNC(statusEffect_set)}] call CBA_fnc_addEventHandler;
["forceWalk", false, ["ACE_SwitchUnits", "ACE_Attach", "ACE_dragging", "ACE_Explosives", "ACE_Ladder", "ACE_Sandbag", "ACE_refuel", "ACE_rearm", "ACE_dragging"]] call FUNC(statusEffect_addType);
["blockSprint", false, []] call FUNC(statusEffect_addType);
["setCaptive", true, [QEGVAR(captives,Handcuffed), QEGVAR(captives,Surrendered), "ace_unconscious"]] call FUNC(statusEffect_addType);
["setCaptive", true, [QEGVAR(captives,Handcuffed), QEGVAR(captives,Surrendered)]] call FUNC(statusEffect_addType);
["blockDamage", false, ["fixCollision", "ACE_cargo"]] call FUNC(statusEffect_addType);
["blockEngine", false, ["ACE_Refuel"]] call FUNC(statusEffect_addType);
["setHidden", true, ["ace_unconscious"]] call FUNC(statusEffect_addType);
[QGVAR(forceWalk), {
params ["_object", "_set"];
TRACE_2("forceWalk EH",_object,_set);
_object forceWalk (_set > 0);
}] call CBA_fnc_addEventHandler;
[QGVAR(blockSprint), { //Name reversed from `allowSprint` because we want NOR logic
params ["_object", "_set"];
TRACE_2("blockSprint EH",_object,_set);
_object allowSprint (_set == 0);
}] call CBA_fnc_addEventHandler;
[QGVAR(setCaptive), {
params ["_object", "_set"];
TRACE_2("setCaptive EH",_object,_set);
_object setCaptive (_set > 0);
}] call CBA_fnc_addEventHandler;
[QGVAR(setHidden), {
params ["_object", "_set"];
TRACE_2("setHidden EH",_object,_set);
private _visibility = _object getUnitTrait "camouflageCoef";
if (_set > 0) then {
if (_visibility != 0) then {
@ -49,6 +58,7 @@
_object setUnitTrait ["camouflageCoef", _visibility];
};
}] call CBA_fnc_addEventHandler;
[QGVAR(blockDamage), { //Name reversed from `allowDamage` because we want NOR logic
params ["_object", "_set"];
if ((_object isKindOf "CAManBase") && {(["ace_medical"] call FUNC(isModLoaded))}) then {
@ -59,6 +69,7 @@
_object allowDamage (_set == 0);
};
}] call CBA_fnc_addEventHandler;
[QGVAR(blockEngine), {
params ["_vehicle", "_set"];
_vehicle setVariable [QGVAR(blockEngine), _set > 0, true];

View File

@ -97,7 +97,7 @@ if (GVAR(moveUnitsFromGroupOnUnconscious)) then {
};
// Delay Unconscious so the AI dont instant stop shooting on the unit #3121
if (GVAR(delayUnconCaptive) == 0) then {
[_unit, "setCaptive", "ace_unconscious", true] call EFUNC(common,statusEffect_set);
[_unit, "setHidden", "ace_unconscious", true] call EFUNC(common,statusEffect_set);
} else {
// when the Delay is so high that the unit can wake up and get uncon again we need to check if it is the correct wait that got executed
private _counter = _unit getVariable [QGVAR(unconsciousCounter), 0];
@ -106,7 +106,7 @@ if (GVAR(delayUnconCaptive) == 0) then {
[{
params ["_unit", "_counter"];
if (_unit getVariable ["ACE_isUnconscious", false] && (_unit getVariable [QGVAR(unconsciousCounter), 0]) == _counter) then {
[_unit, "setCaptive", "ace_unconscious", true] call EFUNC(common,statusEffect_set);
[_unit, "setHidden", "ace_unconscious", true] call EFUNC(common,statusEffect_set);
};
},[_unit, _counter], GVAR(delayUnconCaptive)] call CBA_fnc_waitAndExecute;
};

View File

@ -36,7 +36,7 @@ if (!alive _unit) exitWith {
if (GVAR(moveUnitsFromGroupOnUnconscious)) then {
[_unit, false, "ACE_isUnconscious", side group _unit] call EFUNC(common,switchToGroupSide);
};
[_unit, "setCaptive", "ace_unconscious", false] call EFUNC(common,statusEffect_set);
[_unit, "setHidden", "ace_unconscious", false] call EFUNC(common,statusEffect_set);
[_unit, false] call EFUNC(common,disableAI);
//_unit setUnitPos _originalPos;
@ -104,7 +104,7 @@ if !(_unit getVariable ["ACE_isUnconscious",false]) exitWith {
};
if (!_hasMovedOut) then {
// Reset the unit back to the previous captive state.
[_unit, "setCaptive", "ace_unconscious", false] call EFUNC(common,statusEffect_set);
[_unit, "setHidden", "ace_unconscious", false] call EFUNC(common,statusEffect_set);
// Swhich the unit back to its original group
//Unconscious units shouldn't be put in another group #527: