Formatting. Lazy eval

This commit is contained in:
Magnetar 2019-03-21 14:34:51 +01:00
parent 89927a8b94
commit cc11ad051d
5 changed files with 14 additions and 14 deletions

View File

@ -33,20 +33,20 @@ if ((isNull _unit) || {!alive _unit} || {!(_unit isKindOf "CAManBase")}) exitWit
ERROR_3("Bad Unit %1 [Type: %2] [Alive: %3]",_unit,typeOf _unit,alive _unit);
false
};
if (!local _unit) exitWith {
[QEGVAR(medical,setUnconscious), [_unit, _knockOut], _unit] call CBA_fnc_targetEvent;
true
};
if (_knockOut isEqualTo IS_UNCONSCIOUS(_unit)) exitWith {
WARNING_2("setUnconscious called with no change [Unit %1] [State [%2]", _unit, _knockOut);
false
};
private _beforeState = [_unit, EGVAR(medical,STATE_MACHINE)] call CBA_statemachine_fnc_getCurrentState;
if (currentWeapon _unit != primaryWeapon _unit) then {
_unit selectWeapon primaryWeapon _unit;
};
if (currentWeapon _unit != primaryWeapon _unit) then {
_unit selectWeapon primaryWeapon _unit;
};
if (_knockOut) then {
if (_minWaitingTime > 0) then {

View File

@ -23,16 +23,16 @@ params ["_unit", "_updateHead", "_updateBody", "_updateArms", "_updateLegs"];
TRACE_5("updateBodyPartVisuals",_unit,_updateHead,_updateBody,_updateArms,_updateLegs);
private _bodyPartDamage = _unit getVariable [QEGVAR(medical,bodyPartDamage), [0,0,0,0,0,0]];
if (_updateHead) then {
[_unit, "head", (_bodyPartDamage select 0) > VISUAL_BODY_DAMAGE_THRESHOLD] call FUNC(damageBodyPart);
};
};
if (_updateBody) then {
[_unit, "body", (_bodyPartDamage select 1) > VISUAL_BODY_DAMAGE_THRESHOLD] call FUNC(damageBodyPart);
};
};
if (_updateArms) then {
[_unit, "arms", ((_bodyPartDamage select 2) max (_bodyPartDamage select 3)) > VISUAL_BODY_DAMAGE_THRESHOLD] call FUNC(damageBodyPart);
};
};
if (_updateLegs) then {
[_unit, "legs", ((_bodyPartDamage select 4) max (_bodyPartDamage select 5)) > VISUAL_BODY_DAMAGE_THRESHOLD] call FUNC(damageBodyPart);
};

View File

@ -18,7 +18,7 @@ params ["_caller", "_target", "_bodyPart"];
private _bloodPressure = [0, 0];
if (alive _target && !([_target, _bodyPart] call FUNC(hasTourniquetAppliedTo))) then {
if (alive _target && {!([_target, _bodyPart] call FUNC(hasTourniquetAppliedTo))}) then {
_bloodPressure = GET_BLOOD_PRESSURE(_target);
};

View File

@ -44,7 +44,7 @@ private _medicalFacility =
private _objects = (lineIntersectsWith [_unit modelToWorldVisual [0, 0, (_eyePos select 2)], _unit modelToWorldVisual [0, 0, (_eyePos select 2) +10], _unit]);
{
if (((typeOf _x) in _medicalFacility) || (_x getVariable [QEGVAR(medical,isMedicalFacility),false])) exitWith {
if (((typeOf _x) in _medicalFacility) || {_x getVariable [QEGVAR(medical,isMedicalFacility),false]}) exitWith {
_isInBuilding = true;
};
} forEach _objects;
@ -52,7 +52,7 @@ private _objects = (lineIntersectsWith [_unit modelToWorldVisual [0, 0, (_eyePos
if (!_isInBuilding) then {
_objects = _unit nearObjects 7.5;
{
if (((typeOf _x) in _medicalFacility) || (_x getVariable [QEGVAR(medical,isMedicalFacility),false])) exitWith {
if (((typeOf _x) in _medicalFacility) || {_x getVariable [QEGVAR(medical,isMedicalFacility),false]}) exitWith {
_isInBuilding = true;
};
} forEach _objects;

View File

@ -26,7 +26,7 @@ private _foundEntry = false;
private _allUsedMedication = _target getVariable [QEGVAR(medical,allUsedMedication), []];
{
_x params ["_variableX", "_allMedsFromClassname"];
if (_variableX== _variable) exitWith {
if (_variableX == _variable) exitWith {
if !(_className in _allMedsFromClassname) then {
_allMedsFromClassname pushBack _className;
_x set [1, _allMedsFromClassname];
@ -43,7 +43,7 @@ if (!_foundEntry) then {
};
private _usedMeds = _target getVariable [_variable, 0];
if (_usedMeds >= floor (_maxDosage + round(random(2))) && _maxDosage >= 1) then {
if (_usedMeds >= floor (_maxDosage + round(random(2))) && {_maxDosage >= 1}) then {
[QEGVAR(medical,CriticalVitals), _target] call CBA_fnc_localEvent;
};