mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
General - Use ace_common_fnc_isAwake
where possible (#10098)
* Use `ace_common_fnc_isAwake` where possible * Revert bad change
This commit is contained in:
parent
516eb48c93
commit
ee0e947611
@ -21,7 +21,6 @@ params ["_unit", "_target"];
|
|||||||
|
|
||||||
(_target getVariable [QGVAR(isHandcuffed), false]) &&
|
(_target getVariable [QGVAR(isHandcuffed), false]) &&
|
||||||
{isNull (attachedTo _target)} &&
|
{isNull (attachedTo _target)} &&
|
||||||
{alive _target} &&
|
{_target call EFUNC(common,isAwake)} &&
|
||||||
{!(_target getVariable ["ACE_isUnconscious", false])} &&
|
|
||||||
{(vehicle _unit) == _unit} &&
|
{(vehicle _unit) == _unit} &&
|
||||||
{(vehicle _target) == _target}
|
{(vehicle _target) == _target}
|
||||||
|
@ -20,7 +20,7 @@
|
|||||||
params ["_unit", "_target", "_vehicle"];
|
params ["_unit", "_target", "_vehicle"];
|
||||||
|
|
||||||
// Don't show "Load Captive" if unit is unconscious (already has "Load Patient")
|
// Don't show "Load Captive" if unit is unconscious (already has "Load Patient")
|
||||||
if (_target getVariable ["ACE_isUnconscious", false]) exitWith {false};
|
if !(_target call EFUNC(common,isAwake)) exitWith {false};
|
||||||
|
|
||||||
if ((isNull _target) && {_unit getVariable [QGVAR(isEscorting), false]}) then {
|
if ((isNull _target) && {_unit getVariable [QGVAR(isEscorting), false]}) then {
|
||||||
//Looking at a vehicle while escorting, get target from attached objects:
|
//Looking at a vehicle while escorting, get target from attached objects:
|
||||||
|
@ -39,7 +39,7 @@ if (_state) then {
|
|||||||
_args params ["_unit", "_target", "_actionID"];
|
_args params ["_unit", "_target", "_actionID"];
|
||||||
|
|
||||||
if (_unit getVariable [QGVAR(isEscorting), false]) then {
|
if (_unit getVariable [QGVAR(isEscorting), false]) then {
|
||||||
if (!alive _target || {!alive _unit} || {!canStand _target} || {!canStand _unit} || {_target getVariable ["ACE_isUnconscious", false]} || {_unit getVariable ["ACE_isUnconscious", false]} || {!isNull (attachedTo _unit)}) then {
|
if (!canStand _target || {!canStand _unit} || {!(_target call EFUNC(common,isAwake))} || {!(_unit call EFUNC(common,isAwake))} || {!isNull (attachedTo _unit)}) then {
|
||||||
_unit setVariable [QGVAR(isEscorting), false, true];
|
_unit setVariable [QGVAR(isEscorting), false, true];
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
@ -19,7 +19,7 @@
|
|||||||
params ["_unit", "_newAnimation"];
|
params ["_unit", "_newAnimation"];
|
||||||
TRACE_2("AnimChanged",_unit,_newAnimation);
|
TRACE_2("AnimChanged",_unit,_newAnimation);
|
||||||
if (_unit == (vehicle _unit)) then {
|
if (_unit == (vehicle _unit)) then {
|
||||||
if ((_newAnimation != "ACE_AmovPercMstpSsurWnonDnon") && {!(_unit getVariable ["ACE_isUnconscious", false])}) then {
|
if ((_newAnimation != "ACE_AmovPercMstpSsurWnonDnon") && {_unit call EFUNC(common,isAwake)}) then {
|
||||||
TRACE_1("Handcuff animation interrupted",_newAnimation);
|
TRACE_1("Handcuff animation interrupted",_newAnimation);
|
||||||
[_unit, "ACE_AmovPercMstpScapWnonDnon", 1] call EFUNC(common,doAnimation);
|
[_unit, "ACE_AmovPercMstpScapWnonDnon", 1] call EFUNC(common,doAnimation);
|
||||||
};
|
};
|
||||||
|
@ -19,7 +19,7 @@
|
|||||||
params ["_unit", "_newAnimation"];
|
params ["_unit", "_newAnimation"];
|
||||||
|
|
||||||
TRACE_2("AnimChanged",_unit,_newAnimation);
|
TRACE_2("AnimChanged",_unit,_newAnimation);
|
||||||
if ((_newAnimation != "ACE_AmovPercMstpSsurWnonDnon") && {!(_unit getVariable ["ACE_isUnconscious", false])}) then {
|
if ((_newAnimation != "ACE_AmovPercMstpSsurWnonDnon") && {_unit call EFUNC(common,isAwake)}) then {
|
||||||
TRACE_1("Surrender animation interrupted",_newAnimation);
|
TRACE_1("Surrender animation interrupted",_newAnimation);
|
||||||
[_unit, "ACE_AmovPercMstpSsurWnonDnon", 1] call EFUNC(common,doAnimation);
|
[_unit, "ACE_AmovPercMstpSsurWnonDnon", 1] call EFUNC(common,doAnimation);
|
||||||
};
|
};
|
||||||
|
@ -91,7 +91,7 @@ if (_state) then {
|
|||||||
_unit removeEventHandler ["AnimChanged", _animChangedEHID];
|
_unit removeEventHandler ["AnimChanged", _animChangedEHID];
|
||||||
_unit setVariable [QGVAR(handcuffAnimEHID), -1];
|
_unit setVariable [QGVAR(handcuffAnimEHID), -1];
|
||||||
|
|
||||||
if (((vehicle _unit) == _unit) && {!(_unit getVariable ["ACE_isUnconscious", false])}) then {
|
if (((vehicle _unit) == _unit) && {_unit call EFUNC(common,isAwake)}) then {
|
||||||
//Break out of hands up animation loop
|
//Break out of hands up animation loop
|
||||||
[_unit, "ACE_AmovPercMstpScapWnonDnon_AmovPercMstpSnonWnonDnon", 2] call EFUNC(common,doAnimation);
|
[_unit, "ACE_AmovPercMstpScapWnonDnon_AmovPercMstpSnonWnonDnon", 2] call EFUNC(common,doAnimation);
|
||||||
};
|
};
|
||||||
|
@ -86,8 +86,7 @@ if (_state) then {
|
|||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
if (!alive _unit) exitWith {};
|
if !(_unit call EFUNC(common,isAwake)) exitWith {}; //don't touch animations if unconscious
|
||||||
if (_unit getVariable ["ACE_isUnconscious", false]) exitWith {}; //don't touch animations if unconscious
|
|
||||||
|
|
||||||
//if we are in "hands up" animationState, crack it now
|
//if we are in "hands up" animationState, crack it now
|
||||||
if (((vehicle _unit) == _unit) && {(animationState _unit) == "ACE_AmovPercMstpSsurWnonDnon"}) then {
|
if (((vehicle _unit) == _unit) && {(animationState _unit) == "ACE_AmovPercMstpSsurWnonDnon"}) then {
|
||||||
@ -99,7 +98,7 @@ if (_state) then {
|
|||||||
params ["_args", "_pfID"];
|
params ["_args", "_pfID"];
|
||||||
_args params ["_unit", "_maxTime"];
|
_args params ["_unit", "_maxTime"];
|
||||||
//If waited long enough or they re-surrendered or they are unconscious, exit loop
|
//If waited long enough or they re-surrendered or they are unconscious, exit loop
|
||||||
if ((CBA_missionTime > _maxTime) || {_unit getVariable [QGVAR(isSurrendering), false]} || {_unit getVariable ["ACE_isUnconscious", false]}) exitWith {
|
if ((CBA_missionTime > _maxTime) || {_unit getVariable [QGVAR(isSurrendering), false]} || {!(_unit call EFUNC(common,isAwake))}) exitWith {
|
||||||
[_pfID] call CBA_fnc_removePerFrameHandler;
|
[_pfID] call CBA_fnc_removePerFrameHandler;
|
||||||
};
|
};
|
||||||
//Only break animation if they are actualy the "hands up" animation (because we are using switchmove there won't be an transition)
|
//Only break animation if they are actualy the "hands up" animation (because we are using switchmove there won't be an transition)
|
||||||
|
@ -29,7 +29,7 @@ if !([_unit] call EFUNC(common,isPlayer)) then {
|
|||||||
_unit disableConversation true;
|
_unit disableConversation true;
|
||||||
} else {
|
} else {
|
||||||
//Sanity check to make sure we don't enable unconsious AI
|
//Sanity check to make sure we don't enable unconsious AI
|
||||||
if (_unit getVariable ["ace_isunconscious", false] && alive _unit) exitWith {
|
if (_unit getVariable ["ACE_isUnconscious", false] && alive _unit) exitWith {
|
||||||
ERROR("Enabling AI for unconsious unit");
|
ERROR("Enabling AI for unconsious unit");
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -22,7 +22,7 @@ params ["_unit", ["_distance", 10], ["_cargoOnly", false]];
|
|||||||
private _nearVehicles = nearestObjects [_unit, ["Car", "Air", "Tank", "Ship_F", "Pod_Heli_Transport_04_crewed_base_F"], _distance];
|
private _nearVehicles = nearestObjects [_unit, ["Car", "Air", "Tank", "Ship_F", "Pod_Heli_Transport_04_crewed_base_F"], _distance];
|
||||||
_nearVehicles select {
|
_nearVehicles select {
|
||||||
// Filter cargo seats that will eject unconscious units (e.g. quad bike)
|
// Filter cargo seats that will eject unconscious units (e.g. quad bike)
|
||||||
private _canSitInCargo = (!(_unit getVariable ['ACE_isUnconscious', false])) || {(getNumber (configOf _x >> "ejectDeadCargo")) == 0};
|
private _canSitInCargo = (_unit call EFUNC(common,isAwake)) || {(getNumber (configOf _x >> "ejectDeadCargo")) == 0};
|
||||||
((fullCrew [_x, "", true]) findIf {
|
((fullCrew [_x, "", true]) findIf {
|
||||||
_x params ["_body", "_role", "_cargoIndex"];
|
_x params ["_body", "_role", "_cargoIndex"];
|
||||||
(isNull _body) // seat empty
|
(isNull _body) // seat empty
|
||||||
|
@ -23,4 +23,4 @@ if (isNull _target) exitWith {false};
|
|||||||
// check if disabled for faction
|
// check if disabled for faction
|
||||||
if ((faction _target) in GVAR(disabledFactions)) exitWith {false};
|
if ((faction _target) in GVAR(disabledFactions)) exitWith {false};
|
||||||
|
|
||||||
(!alive _target) || {_target getVariable ["ACE_isUnconscious", false]}
|
!(_target call EFUNC(common,isAwake))
|
||||||
|
@ -23,4 +23,4 @@ if (isNull _target) exitWith {false};
|
|||||||
// check if disabled for faction
|
// check if disabled for faction
|
||||||
if ((faction _target) in GVAR(disabledFactions)) exitWith {false};
|
if ((faction _target) in GVAR(disabledFactions)) exitWith {false};
|
||||||
|
|
||||||
((!alive _target) || {_target getVariable ["ACE_isUnconscious", false]}) && {_player canAdd ["ACE_dogtag_1", 1/*, true*/]} // Todo: Uncomment in 2.18
|
!(_target call EFUNC(common,isAwake)) && {_player canAdd ["ACE_dogtag_1", 1/*, true*/]} // Todo: Uncomment in 2.18
|
||||||
|
@ -33,7 +33,7 @@ if (!GVAR(dragAndFire)) then {
|
|||||||
private _inBuilding = _unit call FUNC(isObjectOnObject);
|
private _inBuilding = _unit call FUNC(isObjectOnObject);
|
||||||
|
|
||||||
// Play release animation
|
// Play release animation
|
||||||
if !(_unit getVariable ["ACE_isUnconscious", false]) then {
|
if (_unit call EFUNC(common,isAwake)) then {
|
||||||
[_unit, "released"] call EFUNC(common,doGesture);
|
[_unit, "released"] call EFUNC(common,doGesture);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -44,7 +44,7 @@ if (_tryLoad && {!(_target isKindOf "CAManBase")} && {["ace_cargo"] call EFUNC(c
|
|||||||
|
|
||||||
// Fix anim when aborting carrying persons
|
// Fix anim when aborting carrying persons
|
||||||
if (_target isKindOf "CAManBase" || {animationState _unit in CARRY_ANIMATIONS}) then {
|
if (_target isKindOf "CAManBase" || {animationState _unit in CARRY_ANIMATIONS}) then {
|
||||||
if (isNull objectParent _unit && {!(_unit getVariable ["ACE_isUnconscious", false])}) then {
|
if (isNull objectParent _unit && {_unit call EFUNC(common,isAwake)}) then {
|
||||||
[_unit, "", 2] call EFUNC(common,doAnimation);
|
[_unit, "", 2] call EFUNC(common,doAnimation);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -77,7 +77,7 @@ if (_average > _gBlackOut && {GETEGVAR(medical,enabled,false) && {ACE_player cal
|
|||||||
|
|
||||||
GVAR(GForces_CC) ppEffectAdjust [1,1,0,[0,0,0,1],[0,0,0,0],[1,1,1,1],[10,10,0,0,0,0.1,0.5]];
|
GVAR(GForces_CC) ppEffectAdjust [1,1,0,[0,0,0,1],[0,0,0,0],[1,1,1,1],[10,10,0,0,0,0.1,0.5]];
|
||||||
|
|
||||||
if !(ACE_player getVariable ["ACE_isUnconscious", false]) then {
|
if (ACE_player call EFUNC(common,isAwake)) then {
|
||||||
if (_average > 0.30 * _gBlackOut) then {
|
if (_average > 0.30 * _gBlackOut) then {
|
||||||
private _strength = ((_average - 0.30 * _gBlackOut) / (0.70 * _gBlackOut)) max 0;
|
private _strength = ((_average - 0.30 * _gBlackOut) / (0.70 * _gBlackOut)) max 0;
|
||||||
GVAR(GForces_CC) ppEffectAdjust [1,1,0,[0,0,0,1],[0,0,0,0],[1,1,1,1],[2 * (1 - _strength),2 * (1 - _strength),0,0,0,0.1,0.5]];
|
GVAR(GForces_CC) ppEffectAdjust [1,1,0,[0,0,0,1],[0,0,0,0],[1,1,1,1],[2 * (1 - _strength),2 * (1 - _strength),0,0,0,0.1,0.5]];
|
||||||
|
@ -15,4 +15,4 @@
|
|||||||
* Public: No
|
* Public: No
|
||||||
*/
|
*/
|
||||||
|
|
||||||
GVAR(effects) in [2, 3] && {!GETVAR(ACE_player,ACE_isUnconscious,false)} // return
|
GVAR(effects) in [2, 3] && {ACE_player call EFUNC(common,isAwake)} // return
|
||||||
|
@ -18,7 +18,6 @@
|
|||||||
|
|
||||||
params ["_unit", "_target"];
|
params ["_unit", "_target"];
|
||||||
|
|
||||||
alive _target
|
_target call EFUNC(common,isAwake)
|
||||||
&& {!(_target getVariable ["ACE_isUnconscious", false])}
|
|
||||||
&& {side group _unit == side group _target}
|
&& {side group _unit == side group _target}
|
||||||
&& {group _unit != group _target} // return
|
&& {group _unit != group _target} // return
|
||||||
|
@ -18,7 +18,6 @@
|
|||||||
|
|
||||||
params ["_unit", "_target"];
|
params ["_unit", "_target"];
|
||||||
|
|
||||||
alive _target
|
_target call EFUNC(common,isAwake)
|
||||||
&& {!(_target getVariable ["ACE_isUnconscious", false])}
|
|
||||||
&& {!([_target] call EFUNC(common,isPlayer))}
|
&& {!([_target] call EFUNC(common,isPlayer))}
|
||||||
&& {_target in units group _unit}
|
&& {_target in units group _unit}
|
||||||
|
@ -19,6 +19,5 @@
|
|||||||
params ["_unit", "_target"];
|
params ["_unit", "_target"];
|
||||||
|
|
||||||
_target isKindOf "CAManBase" &&
|
_target isKindOf "CAManBase" &&
|
||||||
{alive _target} &&
|
{_target call EFUNC(common,isAwake)} &&
|
||||||
{_unit distance _target < 4} &&
|
{_unit distance _target < 4} // return
|
||||||
{!(_target getVariable ["ACE_isUnconscious", false])} // return
|
|
||||||
|
@ -44,15 +44,14 @@ if (GVAR(isSwimming) && {currentWeapon _unit isNotEqualTo ""}) then {
|
|||||||
private _exitCondition = !(
|
private _exitCondition = !(
|
||||||
(alive GVAR(attachHelper)) &&
|
(alive GVAR(attachHelper)) &&
|
||||||
{ alive _parent } &&
|
{ alive _parent } &&
|
||||||
{ alive _unit } &&
|
{ _unit call EFUNC(common,isAwake) } &&
|
||||||
{
|
{
|
||||||
currentWeapon _unit isEqualTo ""
|
currentWeapon _unit isEqualTo ""
|
||||||
|| {_unit call EFUNC(common,isSwimming)} // swimming in wetsuit forces weapon in hands
|
|| {_unit call EFUNC(common,isSwimming)} // swimming in wetsuit forces weapon in hands
|
||||||
|| {getPosASLW _unit select 2 < -1.5} // walking-to-swimming animation in wetsuit lasts for 3 seconds
|
|| {getPosASLW _unit select 2 < -1.5} // walking-to-swimming animation in wetsuit lasts for 3 seconds
|
||||||
} &&
|
} &&
|
||||||
{ [_unit, objNull, [INTERACTION_EXCEPTIONS]] call EFUNC(common,canInteractWith) } &&
|
{ [_unit, objNull, [INTERACTION_EXCEPTIONS]] call EFUNC(common,canInteractWith) } &&
|
||||||
{ "unconscious" isNotEqualTo toLowerANSI animationState _unit } &&
|
{ "unconscious" != animationState _unit } &&
|
||||||
{ !(_unit getVariable ["ACE_isUnconscious", false]) } &&
|
|
||||||
{ ACE_player == _unit }
|
{ ACE_player == _unit }
|
||||||
);
|
);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user