mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
fixed prevent instant death setting
This commit is contained in:
parent
d4a6dd1038
commit
ecf16ad9f1
@ -172,7 +172,7 @@ class CfgVehicles {
|
|||||||
defaultValue = 1;
|
defaultValue = 1;
|
||||||
};
|
};
|
||||||
class maxReviveTime {
|
class maxReviveTime {
|
||||||
displayName = "MAx Revive time";
|
displayName = "Max Revive time";
|
||||||
description = "Max amount of seconds a unit can spend in revive state";
|
description = "Max amount of seconds a unit can spend in revive state";
|
||||||
typeName = "NUMBER";
|
typeName = "NUMBER";
|
||||||
defaultValue = 1;
|
defaultValue = 1;
|
||||||
|
@ -60,6 +60,8 @@ if (GVAR(level) >= 2) then {
|
|||||||
if ((_minLethalDamage <= _newDamage) && {[_unit, [_selection] call FUNC(selectionNameToNumber), _newDamage] call FUNC(determineIfFatal)}) then {
|
if ((_minLethalDamage <= _newDamage) && {[_unit, [_selection] call FUNC(selectionNameToNumber), _newDamage] call FUNC(determineIfFatal)}) then {
|
||||||
if ([_unit] call FUNC(setDead)) then {
|
if ([_unit] call FUNC(setDead)) then {
|
||||||
_damageReturn = 1;
|
_damageReturn = 1;
|
||||||
|
} else {
|
||||||
|
_damageReturn = 0.89;
|
||||||
};
|
};
|
||||||
} else {
|
} else {
|
||||||
_damageReturn = 0.89;
|
_damageReturn = 0.89;
|
||||||
@ -68,7 +70,7 @@ if (GVAR(level) >= 2) then {
|
|||||||
};
|
};
|
||||||
[_unit] call FUNC(addToInjuredCollection);
|
[_unit] call FUNC(addToInjuredCollection);
|
||||||
|
|
||||||
if (_unit getVariable [QGVAR(preventDeath), false] && {_damageReturn >= 0.9} && {_selection in ["", "head", "body"]}) exitWith {
|
if (_unit getVariable [QGVAR(preventDeath), GVAR(preventInstaDeath)] && {_damageReturn >= 0.9} && {_selection in ["", "head", "body"]}) exitWith {
|
||||||
if (vehicle _unit != _unit and {damage _vehicle >= 1}) then {
|
if (vehicle _unit != _unit and {damage _vehicle >= 1}) then {
|
||||||
// @todo
|
// @todo
|
||||||
// [_unit] call FUNC(unload);
|
// [_unit] call FUNC(unload);
|
||||||
|
@ -24,7 +24,6 @@ if !(_activated) exitWith {};
|
|||||||
|
|
||||||
[_logic, QGVAR(medicSetting), "medicSetting"] call EFUNC(common,readSettingFromModule);
|
[_logic, QGVAR(medicSetting), "medicSetting"] call EFUNC(common,readSettingFromModule);
|
||||||
[_logic, QGVAR(maxRevives), "maxRevives"] call EFUNC(common,readSettingFromModule);
|
[_logic, QGVAR(maxRevives), "maxRevives"] call EFUNC(common,readSettingFromModule);
|
||||||
|
[_logic, QGVAR(maxReviveTime), "maxReviveTime"] call EFUNC(common,readSettingFromModule);
|
||||||
[_logic, QGVAR(enableOverdosing), "enableOverdosing"] call EFUNC(common,readSettingFromModule);
|
[_logic, QGVAR(enableOverdosing), "enableOverdosing"] call EFUNC(common,readSettingFromModule);
|
||||||
[_logic, QGVAR(bleedingCoefficient), "bleedingCoefficient"] call EFUNC(common,readSettingFromModule);
|
[_logic, QGVAR(bleedingCoefficient), "bleedingCoefficient"] call EFUNC(common,readSettingFromModule);
|
||||||
|
|
||||||
|
|
||||||
|
@ -13,39 +13,45 @@
|
|||||||
|
|
||||||
#include "script_component.hpp"
|
#include "script_component.hpp"
|
||||||
|
|
||||||
private ["_unit"];
|
private ["_unit", "_force"];
|
||||||
_unit = _this select 0;
|
_unit = _this select 0;
|
||||||
_force = false;
|
_force = false;
|
||||||
if (count _this >= 2) then {
|
if (count _this >= 2) then {
|
||||||
_force = _this select 1;
|
_force = _this select 1;
|
||||||
};
|
};
|
||||||
|
|
||||||
if (!alive _unit) exitwith{};
|
if (!alive _unit) exitwith{true};
|
||||||
if (!local _unit) exitwith {
|
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 */
|
||||||
|
false;
|
||||||
};
|
};
|
||||||
|
|
||||||
if (GVAR(preventInstaDeath) && !_force) exitwith {
|
if ((_unit getVariable [QGVAR(preventDeath), GVAR(preventInstaDeath)]) && !_force) exitwith {
|
||||||
if (_unit getvariable [QGVAR(inReviveState), false]) exitwith {}; // already in revive state
|
if (_unit getvariable [QGVAR(inReviveState), false]) exitwith {false}; // already in revive state
|
||||||
_unit setvariable [QGVAR(inReviveState), true, true];
|
_unit setvariable [QGVAR(inReviveState), true, true];
|
||||||
[_unit] call FUNC(setUnconscious);
|
_unit setvariable [QGVAR(reviveStartTime), time];
|
||||||
|
[_unit, true] call FUNC(setUnconscious);
|
||||||
|
|
||||||
[{
|
[{
|
||||||
private ["_args","_unit","_startTime"];
|
private ["_args","_unit","_startTime"];
|
||||||
_args = _this select 0;
|
_args = _this select 0;
|
||||||
_unit = _args select 0;
|
_unit = _args select 0;
|
||||||
_startTime = _args select 1;
|
_startTime = _unit getvariable [QGVAR(reviveStartTime), 0];
|
||||||
|
|
||||||
if (time - _startTime > GVAR(maxReviveTime)) exitwith {
|
if (time - _startTime > GVAR(maxReviveTime)) exitwith {
|
||||||
[(_this select 1)] call cba_fnc_removePerFrameHandler;
|
[(_this select 1)] call cba_fnc_removePerFrameHandler;
|
||||||
[_unit, true] call FUNC(setDead);
|
|
||||||
_unit setvariable [QGVAR(inReviveState), nil, true];
|
_unit setvariable [QGVAR(inReviveState), nil, true];
|
||||||
|
_unit setvariable [QGVAR(reviveStartTime), nil];
|
||||||
|
|
||||||
|
[_unit, true] call FUNC(setDead);
|
||||||
};
|
};
|
||||||
|
|
||||||
if !(_unit getvariable [QGVAR(inReviveState), false]) exitwith {
|
if !(_unit getvariable [QGVAR(inReviveState), false]) exitwith {
|
||||||
|
_unit setvariable [QGVAR(reviveStartTime), nil];
|
||||||
[(_this select 1)] call cba_fnc_removePerFrameHandler;
|
[(_this select 1)] call cba_fnc_removePerFrameHandler;
|
||||||
};
|
};
|
||||||
}, 1, [_unit, time] ] call CBA_fnc_addPerFrameHandler;
|
}, 1, [_unit] ] call CBA_fnc_addPerFrameHandler;
|
||||||
|
false;
|
||||||
};
|
};
|
||||||
|
|
||||||
_unit setvariable ["ACE_isDead", true, true];
|
_unit setvariable ["ACE_isDead", true, true];
|
||||||
@ -53,3 +59,4 @@ if (isPLayer _unit) then {
|
|||||||
_unit setvariable ["isDeadPlayer", true, true];
|
_unit setvariable ["isDeadPlayer", true, true];
|
||||||
};
|
};
|
||||||
_unit setdamage 1;
|
_unit setdamage 1;
|
||||||
|
true;
|
||||||
|
Loading…
Reference in New Issue
Block a user