mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
Added revive state / prevent death and unconscious conditions
This commit is contained in:
parent
d016874583
commit
e6042ca04f
@ -64,4 +64,8 @@ class ACE_Settings {
|
|||||||
typeName = "BOOL";
|
typeName = "BOOL";
|
||||||
value = false;
|
value = false;
|
||||||
};
|
};
|
||||||
|
class GVAR(maxReviveTime) {
|
||||||
|
typeName = "NUMBER";
|
||||||
|
value = 120;
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
@ -219,7 +219,7 @@ if (isNil QGVAR(level)) then {
|
|||||||
}, 0, []] call CBA_fnc_addPerFrameHandler;
|
}, 0, []] call CBA_fnc_addPerFrameHandler;
|
||||||
|
|
||||||
// broadcast injuries to JIP clients in a MP session
|
// broadcast injuries to JIP clients in a MP session
|
||||||
if (isMultiplayer && !isDedicated) then {
|
if (isMultiplayer) then {
|
||||||
[QGVAR(onPlayerConnected), "onPlayerConnected", {
|
[QGVAR(onPlayerConnected), "onPlayerConnected", {
|
||||||
if (isNil QGVAR(InjuredCollection)) then {
|
if (isNil QGVAR(InjuredCollection)) then {
|
||||||
GVAR(InjuredCollection) = [];
|
GVAR(InjuredCollection) = [];
|
||||||
@ -234,3 +234,11 @@ if (isMultiplayer && !isDedicated) then {
|
|||||||
}foreach GVAR(InjuredCollection);
|
}foreach GVAR(InjuredCollection);
|
||||||
}, []] call BIS_fnc_addStackedEventHandler;
|
}, []] call BIS_fnc_addStackedEventHandler;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
[
|
||||||
|
{(((_this select 0) getvariable [QGVAR(bloodVolume), 0]) < 65)},
|
||||||
|
{(((_this select 0) getvariable [QGVAR(pain), 0]) > 48)},
|
||||||
|
{(((_this select 0) call FUNC(getBloodLoss)) > 0.25)},
|
||||||
|
{((_this select 0) getvariable [QGVAR(inReviveState), false])}
|
||||||
|
] call FUNC(registerUnconsciousCondition);
|
||||||
|
@ -25,8 +25,27 @@ if (!local _unit) exitwith {
|
|||||||
[[_unit, _force], QUOTE(DFUNC(setDead)), _unit, false] call EFUNC(common,execRemoteFnc); /* TODO Replace by event system */
|
[[_unit, _force], QUOTE(DFUNC(setDead)), _unit, false] call EFUNC(common,execRemoteFnc); /* TODO Replace by event system */
|
||||||
};
|
};
|
||||||
|
|
||||||
if (missionNamespace getVariable [QGVAR(enableRevive), false]) exitwith {
|
if (GVAR(preventInstaDeath) && !_force) exitwith {
|
||||||
// TODO Implement the revive state
|
if (_unit getvariable [QGVAR(inReviveState), false]) exitwith {}; // already in revive state
|
||||||
|
_unit setvariable [QGVAR(inReviveState), true, true];
|
||||||
|
[_unit] call FUNC(setUnconscious);
|
||||||
|
|
||||||
|
[{
|
||||||
|
private ["_args","_unit","_startTime"];
|
||||||
|
_args = _this select 0;
|
||||||
|
_unit = _args select 0;
|
||||||
|
_startTime = _args select 1;
|
||||||
|
|
||||||
|
if (time - _startTime > GVAR(maxReviveTime)) exitwith {
|
||||||
|
[(_this select 1)] call cba_fnc_removePerFrameHandler;
|
||||||
|
[_unit, true] call FUNC(setDead);
|
||||||
|
_unit setvariable [QGVAR(inReviveState), nil, true];
|
||||||
|
};
|
||||||
|
|
||||||
|
if !(_unit getvariable [QGVAR(inReviveState), false]) exitwith {
|
||||||
|
[(_this select 1)] call cba_fnc_removePerFrameHandler;
|
||||||
|
};
|
||||||
|
}, 1, [_unit, time] ] call CBA_fnc_addPerFrameHandler;
|
||||||
};
|
};
|
||||||
|
|
||||||
_unit setvariable ["ACE_isDead", true, true];
|
_unit setvariable ["ACE_isDead", true, true];
|
||||||
|
Loading…
Reference in New Issue
Block a user