Added max Revive lives

This commit is contained in:
Glowbal 2015-04-03 23:56:32 +02:00
parent bd813d0d7a
commit 4ddb496d8b
5 changed files with 29 additions and 6 deletions

View File

@ -14,10 +14,6 @@ class ACE_Settings {
typeName = "SCALAR";
values[] = {"Players only", "Players and AI"};
};
class GVAR(maxRevives) {
typeName = "NUMBER";
value = 1;
};
class GVAR(enableOverdosing) {
typeName = "BOOL";
value = true;
@ -68,6 +64,10 @@ class ACE_Settings {
typeName = "NUMBER";
value = 120;
};
class GVAR(amountOfReviveLives) {
typeName = "NUMBER";
value = -1;
};
class GVAR(allowDeadBodyMovement) {
typeName = "BOOL";
value = false;

View File

@ -173,6 +173,12 @@ class CfgVehicles {
typeName = "NUMBER";
defaultValue = 1;
};
class amountOfReviveLives {
displayName = "Max Revive lives";
description = "Max amount of lives a unit. 0 or -1 is disabled.";
typeName = "NUMBER";
defaultValue = -1;
};
class enableOverdosing {
displayName = "Enable Overdosing";
description = "Enable overdosing of medications";

View File

@ -61,6 +61,7 @@ _unit setVariable ["ACE_isUnconscious", false, true];
_unit setvariable [QGVAR(hasLostBlood), false, true];
_unit setvariable [QGVAR(isBleeding), false, true];
_unit setvariable [QGVAR(hasPain), false, true];
_unit setvariable [QGVAR(amountOfReviveLives), GVAR(amountOfReviveLives), true];
// medication
_allUsedMedication = _unit getVariable [QGVAR(allUsedMedication), []];

View File

@ -23,7 +23,7 @@ _activated = _this select 2;
if !(_activated) exitWith {};
[_logic, QGVAR(medicSetting), "medicSetting"] call EFUNC(common,readSettingFromModule);
[_logic, QGVAR(maxRevives), "maxRevives"] call EFUNC(common,readSettingFromModule);
[_logic, QGVAR(maxReviveTime), "maxReviveTime"] call EFUNC(common,readSettingFromModule);
[_logic, QGVAR(amountOfReviveLives), "maxReviveTime"] call EFUNC(common,readSettingFromModule);
[_logic, QGVAR(enableOverdosing), "enableOverdosing"] call EFUNC(common,readSettingFromModule);
[_logic, QGVAR(bleedingCoefficient), "bleedingCoefficient"] call EFUNC(common,readSettingFromModule);

View File

@ -27,7 +27,17 @@ if (!local _unit) exitwith {
};
if ((_unit getVariable [QGVAR(preventDeath), GVAR(preventInstaDeath)]) && !_force) exitwith {
if (_unit getvariable [QGVAR(inReviveState), false]) exitwith {false}; // already in revive state
if (_unit getvariable [QGVAR(inReviveState), false]) exitwith {
if (GVAR(amountOfReviveLives) > 0) then {
_lifesLeft = _unit getvariable[QGVAR(amountOfReviveLives), GVAR(amountOfReviveLives)];
if (_lifesLeft == 0) then {
[_unit, true] call FUNC(setDead);
};
};
false;
};
_unit setvariable [QGVAR(inReviveState), true, true];
_unit setvariable [QGVAR(reviveStartTime), time];
[_unit, true] call FUNC(setUnconscious);
@ -47,6 +57,12 @@ if ((_unit getVariable [QGVAR(preventDeath), GVAR(preventInstaDeath)]) && !_forc
};
if !(_unit getvariable [QGVAR(inReviveState), false]) exitwith {
// revived without dieing, so in case we have lifes, remove one.
if (GVAR(amountOfReviveLives) > 0) then {
_lifesLeft = _unit getvariable[QGVAR(amountOfReviveLives), GVAR(amountOfReviveLives)];
_unit setvariable [QGVAR(amountOfReviveLives), _lifesLeft - 1, true];
};
_unit setvariable [QGVAR(reviveStartTime), nil];
[(_this select 1)] call cba_fnc_removePerFrameHandler;
};