reduce some overhead

This commit is contained in:
commy2 2016-10-07 05:10:43 +02:00
parent 4bc1c1db56
commit b0c0156d75
3 changed files with 7 additions and 24 deletions

View File

@ -5,7 +5,7 @@
* Arguments:
* 0: Unit <OBJECT>
* 1: Selection, can be "Head", "Body", "Arms" or "Legs" <STRING>
* 2: Damage (optional, default: true) <BOOLEAN>
* 2: Damage <BOOLEAN>
*
* Return Value:
* None
@ -23,11 +23,7 @@
*/
#include "script_component.hpp"
params [["_unit", objNull, [objNull]], ["_selection", "", [""]], ["_damage", true, [false]]];
if (!local _unit) exitWith {
ERROR("Unit not local or null");
};
params ["_unit", "_selection", "_damage"];
_damage = [0, DAMAGED_MIN_THRESHOLD] select _damage;

View File

@ -24,16 +24,7 @@ if (!local _unit) exitWith {
_unit setVariable [QGVAR(isLimping), _isLimping, true];
if (_isLimping) then {
if (_unit getHitPointDamage "HitLegs" >= DAMAGED_MIN_THRESHOLD && {_unit getHitPointDamage "HitLegs" != LIMPING_MIN_DAMAGE}) then {
[_unit, "Legs", true] call FUNC(damageBodyPart);
} else {
[_unit, "Legs", false] call FUNC(damageBodyPart);
};
} else {
if (_unit getHitPointDamage "HitLegs" >= DAMAGED_MIN_THRESHOLD && {_unit getHitPointDamage "HitLegs" != LIMPING_MIN_DAMAGE}) then {
[_unit, "Legs", true] call FUNC(damageBodyPart);
} else {
[_unit, "Legs", false] call FUNC(damageBodyPart);
};
};
// refresh
private _isDamaged = _unit getHitPointDamage "HitLegs" >= DAMAGED_MIN_THRESHOLD && {_unit getHitPointDamage "HitLegs" != LIMPING_MIN_DAMAGE};
[_unit, "Legs", _isDamaged] call FUNC(damageBodyPart);

View File

@ -16,11 +16,7 @@
*/
#include "script_component.hpp"
params [["_unit", objNull, [objNull]], ["_bodyPart", "", [""]]];
if (!local _unit) exitWith {
ERROR("Unit not local or null");
};
params ["_unit", "_bodyPart"];
if (_bodyPart == "All") exitWith {
[_unit, "Head"] call FUNC(updateBodyPartVisuals);