mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
Add maximum unconsciousness time option
This commit is contained in:
parent
84e1937515
commit
d1c95ba8a1
@ -63,6 +63,10 @@ class ACE_Settings {
|
|||||||
typeName = "BOOL";
|
typeName = "BOOL";
|
||||||
value = 0;
|
value = 0;
|
||||||
};
|
};
|
||||||
|
class GVAR(maxUnconsciousTime) {
|
||||||
|
typeName = "SCALAR";
|
||||||
|
value = -1;
|
||||||
|
};
|
||||||
class GVAR(maxReviveTime) {
|
class GVAR(maxReviveTime) {
|
||||||
typeName = "SCALAR";
|
typeName = "SCALAR";
|
||||||
value = 120;
|
value = 120;
|
||||||
|
@ -122,6 +122,12 @@ class CfgVehicles {
|
|||||||
typeName = "BOOL";
|
typeName = "BOOL";
|
||||||
defaultValue = 0;
|
defaultValue = 0;
|
||||||
};
|
};
|
||||||
|
class maxUnconsciousTime {
|
||||||
|
displayName = "Max. Uncon. Time";
|
||||||
|
description = "Maximum time a unit can be unconscious before dying. Negative Values disable this.";
|
||||||
|
typeName = "NUMBER";
|
||||||
|
defaultValue = -1;
|
||||||
|
};
|
||||||
class bleedingCoefficient {
|
class bleedingCoefficient {
|
||||||
displayName = "Bleeding coefficient";
|
displayName = "Bleeding coefficient";
|
||||||
description = "Coefficient to modify the bleeding speed";
|
description = "Coefficient to modify the bleeding speed";
|
||||||
|
@ -8,7 +8,13 @@ if !(local _unit) exitWith {};
|
|||||||
|
|
||||||
[_unit] call FUNC(init);
|
[_unit] call FUNC(init);
|
||||||
|
|
||||||
//Reset captive status for respawning unit
|
// Reset captive status for respawning unit
|
||||||
if (!(_unit getVariable ["ACE_isUnconscious", false])) then {
|
if (!(_unit getVariable ["ACE_isUnconscious", false])) then {
|
||||||
[_unit, QGVAR(unconscious), false] call EFUNC(common,setCaptivityStatus);
|
[_unit, QGVAR(unconscious), false] call EFUNC(common,setCaptivityStatus);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// Remove maximum unconsciousness time handler
|
||||||
|
_maxUnconHandle = _unit getVariable [QGVAR(maxUnconTimeHandle), -1];
|
||||||
|
if (_maxUnconHandle > 0) then {
|
||||||
|
[_maxUnconHandle] call CBA_fnc_removePerFrameHandler;
|
||||||
|
};
|
||||||
|
@ -33,6 +33,7 @@ if !(_activated) exitWith {};
|
|||||||
[_logic, QGVAR(AIDamageThreshold), "AIDamageThreshold"] call EFUNC(common,readSettingFromModule);
|
[_logic, QGVAR(AIDamageThreshold), "AIDamageThreshold"] call EFUNC(common,readSettingFromModule);
|
||||||
[_logic, QGVAR(enableUnsconsiousnessAI), "enableUnsconsiousnessAI"] call EFUNC(common,readSettingFromModule);
|
[_logic, QGVAR(enableUnsconsiousnessAI), "enableUnsconsiousnessAI"] call EFUNC(common,readSettingFromModule);
|
||||||
[_logic, QGVAR(preventInstaDeath), "preventInstaDeath"] call EFUNC(common,readSettingFromModule);
|
[_logic, QGVAR(preventInstaDeath), "preventInstaDeath"] call EFUNC(common,readSettingFromModule);
|
||||||
|
[_logic, QGVAR(maxUnconsciousTime), "maxUnconsciousTime"] call EFUNC(common,readSettingFromModule);
|
||||||
[_logic, QGVAR(bleedingCoefficient), "bleedingCoefficient"] call EFUNC(common,readSettingFromModule);
|
[_logic, QGVAR(bleedingCoefficient), "bleedingCoefficient"] call EFUNC(common,readSettingFromModule);
|
||||||
[_logic, QGVAR(painCoefficient), "painCoefficient"] call EFUNC(common,readSettingFromModule);
|
[_logic, QGVAR(painCoefficient), "painCoefficient"] call EFUNC(common,readSettingFromModule);
|
||||||
[_logic, QGVAR(keepLocalSettingsSynced), "keepLocalSettingsSynced"] call EFUNC(common,readSettingFromModule);
|
[_logic, QGVAR(keepLocalSettingsSynced), "keepLocalSettingsSynced"] call EFUNC(common,readSettingFromModule);
|
||||||
|
@ -22,6 +22,15 @@ _unit = _this select 0;
|
|||||||
_set = if (count _this > 1) then {_this select 1} else {true};
|
_set = if (count _this > 1) then {_this select 1} else {true};
|
||||||
_minWaitingTime = if (count _this > 2) then {_this select 2} else {DEFAULT_DELAY};
|
_minWaitingTime = if (count _this > 2) then {_this select 2} else {DEFAULT_DELAY};
|
||||||
|
|
||||||
|
// No change, fuck off. (why is there no xor?)
|
||||||
|
if (_set isEqualTo (_unit getVariable ["ACE_isUnconscious", false])) exitWith {};
|
||||||
|
|
||||||
|
// Remove maximum unconsciousness time handler
|
||||||
|
_maxUnconHandle = _unit getVariable [QGVAR(maxUnconTimeHandle), -1];
|
||||||
|
if (_maxUnconHandle > 0) then {
|
||||||
|
[_maxUnconHandle] call CBA_fnc_removePerFrameHandler;
|
||||||
|
};
|
||||||
|
|
||||||
if !(_set) exitwith {
|
if !(_set) exitwith {
|
||||||
_unit setvariable ["ACE_isUnconscious", false, true];
|
_unit setvariable ["ACE_isUnconscious", false, true];
|
||||||
};
|
};
|
||||||
@ -86,4 +95,14 @@ _startingTime = time;
|
|||||||
|
|
||||||
[DFUNC(unconsciousPFH), 0.1, [_unit,_animState, _originalPos, _startingTime, _minWaitingTime, false, vehicle _unit isKindOf "ParachuteBase"] ] call CBA_fnc_addPerFrameHandler;
|
[DFUNC(unconsciousPFH), 0.1, [_unit,_animState, _originalPos, _startingTime, _minWaitingTime, false, vehicle _unit isKindOf "ParachuteBase"] ] call CBA_fnc_addPerFrameHandler;
|
||||||
|
|
||||||
|
// Maximum unconsciousness time
|
||||||
|
_maxUnconTime = _unit getVariable [QGVAR(maxUnconsciousTime), GVAR(maxUnconsciousTime)];
|
||||||
|
if (_maxUnconTime >= 0) then {
|
||||||
|
_handle = [{
|
||||||
|
_unit = _this select 0;
|
||||||
|
[_unit] call FUNC(setDead);
|
||||||
|
}, [_unit], _maxUnconTime, 0.5] call EFUNC(common,waitAndExecute);
|
||||||
|
_unit setVariable [QGVAR(maxUnconTimeHandle), _handle];
|
||||||
|
};
|
||||||
|
|
||||||
["medical_onUnconscious", [_unit, true]] call EFUNC(common,globalEvent);
|
["medical_onUnconscious", [_unit, true]] call EFUNC(common,globalEvent);
|
||||||
|
Loading…
Reference in New Issue
Block a user