mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
fix for #1297 Being near Campfires messes up basic medical and causes large fps lag
Should only do a max of 1 PFH at a time. If new damage is received before the PFH is completed, it will reset.
This commit is contained in:
parent
0a743d847c
commit
572b46a473
@ -48,20 +48,28 @@ if (diag_frameno > (_unit getVariable [QGVAR(basic_frameNo), -3]) + 2) then {
|
||||
_unit setVariable [QGVAR(hitPoints), []];
|
||||
_unit setVariable [QGVAR(damages), []];
|
||||
_unit setVariable [QGVAR(structDamage), 0];
|
||||
|
||||
if (isnil {_unit getvariable QGVAR(structDamagePFH)}) then {
|
||||
// Assign orphan structural damage to torso
|
||||
[{
|
||||
private ["_unit", "_damagesum"];
|
||||
_unit = _this select 0;
|
||||
_damagesum = (_unit getHitPointDamage "HitHead") +
|
||||
(_unit getHitPointDamage "HitBody") +
|
||||
(_unit getHitPointDamage "HitLeftArm") +
|
||||
(_unit getHitPointDamage "HitRightArm") +
|
||||
(_unit getHitPointDamage "HitLeftLeg") +
|
||||
(_unit getHitPointDamage "HitRightLeg");
|
||||
if (_damagesum < 0.06 and damage _unit > 0.06 and alive _unit) then {
|
||||
_unit setHitPointDamage ["HitBody", damage _unit];
|
||||
};
|
||||
}, [_unit], 2, 0.1] call EFUNC(common,waitAndExecute);
|
||||
[{
|
||||
private ["_unit", "_damagesum"];
|
||||
_unit = (_this select 0) select 0;
|
||||
if (diag_tickTime - _unit getvariable [QGVAR(structDamagePFH),-2] >= 2) then {
|
||||
_unit setVariable [QGVAR(structDamagePFH), nil];
|
||||
_damagesum = (_unit getHitPointDamage "HitHead") +
|
||||
(_unit getHitPointDamage "HitBody") +
|
||||
(_unit getHitPointDamage "HitLeftArm") +
|
||||
(_unit getHitPointDamage "HitRightArm") +
|
||||
(_unit getHitPointDamage "HitLeftLeg") +
|
||||
(_unit getHitPointDamage "HitRightLeg");
|
||||
if (_damagesum < 0.06 and damage _unit > 0.06 and alive _unit) then {
|
||||
_unit setHitPointDamage ["HitBody", damage _unit];
|
||||
};
|
||||
[(_this select 1)] call cba_fnc_removePerFrameHandler;
|
||||
};
|
||||
}, 0, [_unit]] call CBA_fnc_addPerFrameHandler;
|
||||
};
|
||||
_unit setVariable [QGVAR(structDamagePFH), diag_tickTime]; // Assign starting time or reset it
|
||||
};
|
||||
|
||||
_newDamage = _damage - (damage _unit);
|
||||
|
Loading…
Reference in New Issue
Block a user