mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
Fixed indentation
This commit is contained in:
parent
451f8b6d0b
commit
d293008586
@ -24,9 +24,9 @@ if !(_unit getvariable[QGVAR(addedToUnitLoop),false]) then{
|
||||
};
|
||||
|
||||
if ([_unit] call FUNC(hasMedicalEnabled)) then {
|
||||
[{
|
||||
private "_unit";
|
||||
_unit = (_this select 0) select 0;
|
||||
[{
|
||||
private "_unit";
|
||||
_unit = (_this select 0) select 0;
|
||||
if (!alive _unit || !local _unit) then {
|
||||
[_this select 1] call CBA_fnc_removePerFrameHandler;
|
||||
} else {
|
||||
@ -41,5 +41,5 @@ if ([_unit] call FUNC(hasMedicalEnabled)) then {
|
||||
[_unit] call FUNC(playInjuredSound);
|
||||
};
|
||||
};
|
||||
}, 1, [_unit]] call CBA_fnc_addPerFrameHandler;
|
||||
}, 1, [_unit]] call CBA_fnc_addPerFrameHandler;
|
||||
};
|
||||
|
@ -24,7 +24,7 @@ _className = _this select 3;
|
||||
|
||||
_config = (ConfigFile >> "ACE_Medical_Treatments" >> "Basic" >> _className);
|
||||
if (GVAR(level)>=1) then {
|
||||
_config = (ConfigFile >> "ACE_Medical_Treatments" >> "Advanced" >> _className);
|
||||
_config = (ConfigFile >> "ACE_Medical_Treatments" >> "Advanced" >> _className);
|
||||
};
|
||||
if !(isClass _config) exitwith {false};
|
||||
|
||||
@ -40,9 +40,9 @@ if ("All" in _locations) exitwith {true};
|
||||
|
||||
_return = false;
|
||||
{
|
||||
if (_x == "field") exitwith {_return = true;};
|
||||
if (_x == "MedicalFacility" && {[_caller, _target] call FUNC(inMedicalFacility)}) exitwith {_return = true;};
|
||||
if (_x == "MedicalVehicle" && {[_caller, _target] call FUNC(inMedicalVehicle)}) exitwith {_return = true;};
|
||||
if (_x == "field") exitwith {_return = true;};
|
||||
if (_x == "MedicalFacility" && {[_caller, _target] call FUNC(inMedicalFacility)}) exitwith {_return = true;};
|
||||
if (_x == "MedicalVehicle" && {[_caller, _target] call FUNC(inMedicalVehicle)}) exitwith {_return = true;};
|
||||
}foreach _locations;
|
||||
|
||||
_return;
|
||||
|
@ -19,27 +19,27 @@ _totalBloodLoss = 0;
|
||||
|
||||
// Advanced medical bloodloss handling
|
||||
if (GVAR(level) >= 1) then {
|
||||
_tourniquets = _this getvariable [QGVAR(tourniquets), [0,0,0,0,0,0]];
|
||||
_openWounds = _this getvariable [QGVAR(openWounds), []];
|
||||
//_cardiacOutput = [_this] call FUNC(getCardiacOutput);
|
||||
_tourniquets = _this getvariable [QGVAR(tourniquets), [0,0,0,0,0,0]];
|
||||
_openWounds = _this getvariable [QGVAR(openWounds), []];
|
||||
//_cardiacOutput = [_this] call FUNC(getCardiacOutput);
|
||||
|
||||
{
|
||||
if ((_tourniquets select (_x select 2)) < 1) then {
|
||||
// total bleeding ratio * percentage of injury left
|
||||
_totalBloodLoss = _totalBloodLoss + ((_x select 4) * (_x select 3));
|
||||
{
|
||||
if ((_tourniquets select (_x select 2)) < 1) then {
|
||||
// total bleeding ratio * percentage of injury left
|
||||
_totalBloodLoss = _totalBloodLoss + ((_x select 4) * (_x select 3));
|
||||
|
||||
// (((BLOODLOSS_SMALL_WOUNDS * (_x select 0))) + ((BLOODLOSS_MEDIUM_WOUNDS * (_x select 1))) + ((BLOODLOSS_LARGE_WOUNDS * (_x select 2))) * (_cardiacOutput / DEFAULT_CARDIAC_OUTPUT));
|
||||
};
|
||||
}foreach _openWounds;
|
||||
// (((BLOODLOSS_SMALL_WOUNDS * (_x select 0))) + ((BLOODLOSS_MEDIUM_WOUNDS * (_x select 1))) + ((BLOODLOSS_LARGE_WOUNDS * (_x select 2))) * (_cardiacOutput / DEFAULT_CARDIAC_OUTPUT));
|
||||
};
|
||||
}foreach _openWounds;
|
||||
|
||||
_internalWounds = _this getvariable [QGVAR(internalWounds), []];
|
||||
{
|
||||
_totalBloodLoss = _totalBloodLoss + ((_x select 4) * (_x select 3));
|
||||
}foreach _internalWounds;
|
||||
_internalWounds = _this getvariable [QGVAR(internalWounds), []];
|
||||
{
|
||||
_totalBloodLoss = _totalBloodLoss + ((_x select 4) * (_x select 3));
|
||||
}foreach _internalWounds;
|
||||
|
||||
// cap the blood loss to be no greater as the current cardiac output
|
||||
//(_totalBloodLoss min _cardiacOutput);
|
||||
// cap the blood loss to be no greater as the current cardiac output
|
||||
//(_totalBloodLoss min _cardiacOutput);
|
||||
} else {
|
||||
// TODO basic medical
|
||||
// TODO basic medical
|
||||
};
|
||||
_totalBloodLoss;
|
||||
|
@ -47,9 +47,9 @@ if (GVAR(level) == 0) then {
|
||||
if (_damageReturn < 0.01) exitWith {0};
|
||||
|
||||
if (GVAR(level) >= 1) then {
|
||||
[_unit, _selectionName, _damage, _source, _projectile, _damageReturn] call FUNC(handleDamage_caching);
|
||||
[_unit, _selectionName, _damage, _source, _projectile, _damageReturn] call FUNC(handleDamage_caching);
|
||||
|
||||
if (_damageReturn > 0.9) then {
|
||||
if (_damageReturn > 0.9) then {
|
||||
_hitPoints = ["HitHead", "HitBody", "HitLeftArm", "HitRightArm", "HitLeftLeg", "HitRightLeg"];
|
||||
_newDamage = _damage - (damage _unit);
|
||||
if (_selectionName in _hitSelections) then {
|
||||
@ -62,7 +62,7 @@ if (GVAR(level) >= 1) then {
|
||||
} else {
|
||||
_damageReturn = 0.89;
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
if (_unit getVariable [QGVAR(preventDeath), false] && {_damageReturn >= 0.9} && {_selection in ["", "head", "body"]}) exitWith {
|
||||
|
@ -51,7 +51,7 @@ if (GVAR(enableInternalBleeding)) then {
|
||||
};
|
||||
|
||||
if (alive _unit && {!(_unit getvariable ["ACE_isUnconscious", false])}) then {
|
||||
[_unit, _newDamage] call FUNC(reactionToDamage);
|
||||
[_unit, _newDamage] call FUNC(reactionToDamage);
|
||||
};
|
||||
|
||||
_returnDamage;
|
||||
|
@ -30,8 +30,8 @@ if (_bodyPartn != 0) exitwith {};
|
||||
|
||||
if (_amountOfDamage > 0.4) then {
|
||||
if (random(1) >= 0.8) then {
|
||||
if !(_unit getvariable[QGVAR(airwayCollapsed), false]) then {
|
||||
_unit setvariable [QGVAR(airwayCollapsed), true, true];
|
||||
};
|
||||
if !(_unit getvariable[QGVAR(airwayCollapsed), false]) then {
|
||||
_unit setvariable [QGVAR(airwayCollapsed), true, true];
|
||||
};
|
||||
};
|
||||
};
|
||||
|
@ -22,13 +22,13 @@ _items = _this select 2;
|
||||
|
||||
_return = true;
|
||||
{
|
||||
//
|
||||
if (typeName _x == "ARRAY" && {({[_medic, _patient, _x] call FUNC(hasItem)}count _x == 0)}) exitwith {
|
||||
_return = false;
|
||||
};
|
||||
if (typeName _x == "STRING" && {!([_medic, _patient, _x] call FUNC(hasItem))}) exitwith {
|
||||
_return = false;
|
||||
};
|
||||
//
|
||||
if (typeName _x == "ARRAY" && {({[_medic, _patient, _x] call FUNC(hasItem)}count _x == 0)}) exitwith {
|
||||
_return = false;
|
||||
};
|
||||
if (typeName _x == "STRING" && {!([_medic, _patient, _x] call FUNC(hasItem))}) exitwith {
|
||||
_return = false;
|
||||
};
|
||||
}foreach _items;
|
||||
|
||||
_return;
|
||||
|
@ -71,6 +71,6 @@ _unit setVariable [QGVAR(allUsedMedication), []];
|
||||
|
||||
_logs = _unit getvariable [QGVAR(allLogs), []];
|
||||
{
|
||||
_unit setvariable [_x, nil, true];
|
||||
_unit setvariable [_x, nil, true];
|
||||
}foreach _logs;
|
||||
_unit setvariable [QGVAR(allLogs), [], true];
|
||||
|
@ -24,9 +24,9 @@ if (isnil QGVAR(setting_advancedMedicRoles)) exitwith {
|
||||
|
||||
if (GVAR(setting_advancedMedicRoles)) then {
|
||||
_class = _unit getvariable [QGVAR(medicClass), 0];
|
||||
if (_class >= _medicN) then {
|
||||
_return = true;
|
||||
};
|
||||
if (_class >= _medicN) then {
|
||||
_return = true;
|
||||
};
|
||||
} else {
|
||||
_return = true;
|
||||
};
|
||||
|
@ -20,54 +20,54 @@ _allTypes = ["stab", "grenade", "bullet", "explosive", "shell", "punch", "vehicl
|
||||
_allFoundDamageTypes = [];
|
||||
_configDamageTypes = (_injuryRouteConfig >> "damageTypes");
|
||||
for "_i" from 0 to (count _configDamageTypes -1) /* step +1 */ do {
|
||||
if (isClass(_configDamageTypes select _i)) then {
|
||||
_allFoundDamageTypes pushback (configName (_configDamageTypes select _i));
|
||||
};
|
||||
if (isClass(_configDamageTypes select _i)) then {
|
||||
_allFoundDamageTypes pushback (configName (_configDamageTypes select _i));
|
||||
};
|
||||
};
|
||||
GVAR(allAvailableDamageTypes) = _allFoundDamageTypes;
|
||||
|
||||
_parseForSubClassWounds = {
|
||||
_subClass = _this select 0;
|
||||
if (isClass (_entry >> _subClass)) exitwith {
|
||||
_subClassConfig = (_entry >> _subClass);
|
||||
_subClasstype = _classType + (configName _subClassConfig);
|
||||
_subClassselections = if (isArray(_subClassConfig >> "selections")) then { getArray(_subClassConfig >> "selections");} else { _selections };
|
||||
_subClassbloodLoss = if (isNumber(_subClassConfig >> "bleedingRate")) then { getNumber(_subClassConfig >> "bleedingRate");} else { _bloodLoss };
|
||||
_subClasspain = if (isNumber(_subClassConfig >> "pain")) then { getNumber(_subClassConfig >> "pain");} else { _pain };
|
||||
_subClassminDamage = if (isNumber(_subClassConfig >> "minDamage")) then { getNumber(_subClassConfig >> "minDamage");} else { _minDamage };
|
||||
_subClasscauses = if (isArray(_subClassConfig >> "causes")) then { getArray(_subClassConfig >> "causes");} else { _causes };
|
||||
if (count _selections > 0 && count _causes > 0) then {
|
||||
_allWoundClasses pushback [_subClasstype, _subClassselections, _subClassbloodLoss, _subClasspain, _subClassminDamage, _subClasscauses];
|
||||
};
|
||||
true;
|
||||
};
|
||||
false;
|
||||
_subClass = _this select 0;
|
||||
if (isClass (_entry >> _subClass)) exitwith {
|
||||
_subClassConfig = (_entry >> _subClass);
|
||||
_subClasstype = _classType + (configName _subClassConfig);
|
||||
_subClassselections = if (isArray(_subClassConfig >> "selections")) then { getArray(_subClassConfig >> "selections");} else { _selections };
|
||||
_subClassbloodLoss = if (isNumber(_subClassConfig >> "bleedingRate")) then { getNumber(_subClassConfig >> "bleedingRate");} else { _bloodLoss };
|
||||
_subClasspain = if (isNumber(_subClassConfig >> "pain")) then { getNumber(_subClassConfig >> "pain");} else { _pain };
|
||||
_subClassminDamage = if (isNumber(_subClassConfig >> "minDamage")) then { getNumber(_subClassConfig >> "minDamage");} else { _minDamage };
|
||||
_subClasscauses = if (isArray(_subClassConfig >> "causes")) then { getArray(_subClassConfig >> "causes");} else { _causes };
|
||||
if (count _selections > 0 && count _causes > 0) then {
|
||||
_allWoundClasses pushback [_subClasstype, _subClassselections, _subClassbloodLoss, _subClasspain, _subClassminDamage, _subClasscauses];
|
||||
};
|
||||
true;
|
||||
};
|
||||
false;
|
||||
};
|
||||
|
||||
// TODO classTypes are strings currently. Convert them to unqiue IDs instead.
|
||||
_woundsConfig = (_injuriesRootConfig >> "wounds");
|
||||
_allWoundClasses = [];
|
||||
if (isClass _woundsConfig) then {
|
||||
_amountOf = count _woundsConfig;
|
||||
for "_i" from 0 to (_amountOf -1) /* step +1 */ do {
|
||||
_entry = _woundsConfig select _i;
|
||||
if (isClass _entry) then {
|
||||
_classType = (ConfigName _entry);
|
||||
_selections = if (isArray(_entry >> "selections")) then { getArray(_entry >> "selections");} else {[]};
|
||||
_bloodLoss = if (isNumber(_entry >> "bleedingRate")) then { getNumber(_entry >> "bleedingRate");} else {0};
|
||||
_pain = if (isNumber(_entry >> "pain")) then { getNumber(_entry >> "pain");} else {0};
|
||||
_minDamage = if (isNumber(_entry >> "minDamage")) then { getNumber(_entry >> "minDamage");} else {0};
|
||||
_causes = if (isArray(_entry >> "causes")) then { getArray(_entry >> "causes");} else {[]};
|
||||
_amountOf = count _woundsConfig;
|
||||
for "_i" from 0 to (_amountOf -1) /* step +1 */ do {
|
||||
_entry = _woundsConfig select _i;
|
||||
if (isClass _entry) then {
|
||||
_classType = (ConfigName _entry);
|
||||
_selections = if (isArray(_entry >> "selections")) then { getArray(_entry >> "selections");} else {[]};
|
||||
_bloodLoss = if (isNumber(_entry >> "bleedingRate")) then { getNumber(_entry >> "bleedingRate");} else {0};
|
||||
_pain = if (isNumber(_entry >> "pain")) then { getNumber(_entry >> "pain");} else {0};
|
||||
_minDamage = if (isNumber(_entry >> "minDamage")) then { getNumber(_entry >> "minDamage");} else {0};
|
||||
_causes = if (isArray(_entry >> "causes")) then { getArray(_entry >> "causes");} else {[]};
|
||||
|
||||
if (["Minor"] call _parseForSubClassWounds || ["Medium"] call _parseForSubClassWounds || ["Large"] call _parseForSubClassWounds) exitwith {}; // continue to the next one
|
||||
if (["Minor"] call _parseForSubClassWounds || ["Medium"] call _parseForSubClassWounds || ["Large"] call _parseForSubClassWounds) exitwith {}; // continue to the next one
|
||||
|
||||
// There were no subclasses, so we will add this one instead.
|
||||
if (count _selections > 0 && count _causes > 0) then {
|
||||
_allWoundClasses pushback [_classType, _selections, _bloodLoss, _pain, _minDamage, _causes];
|
||||
};
|
||||
true;
|
||||
};
|
||||
};
|
||||
// There were no subclasses, so we will add this one instead.
|
||||
if (count _selections > 0 && count _causes > 0) then {
|
||||
_allWoundClasses pushback [_classType, _selections, _bloodLoss, _pain, _minDamage, _causes];
|
||||
};
|
||||
true;
|
||||
};
|
||||
};
|
||||
};
|
||||
GVAR(AllWoundInjuryTypes) = _allWoundClasses;
|
||||
|
||||
@ -76,20 +76,20 @@ _thresholds = getArray(_damageTypesConfig >> "thresholds");
|
||||
_selectionSpecific = getNumber(_damageTypesConfig >> "selectionSpecific");
|
||||
|
||||
{
|
||||
_varName = format[QGVAR(woundInjuryType_%1),_x];
|
||||
_woundTypes = [];
|
||||
_type = _x;
|
||||
{
|
||||
// Check if this type is in the causes of a wound class, if so, we will store the wound types for this damage type
|
||||
if (_type in (_x select 5)) then {
|
||||
_woundTypes pushback _x;
|
||||
};
|
||||
}foreach _allWoundClasses;
|
||||
_typeThresholds = _thresholds;
|
||||
_selectionSpecificType = _selectionSpecific;
|
||||
if (isClass(_damageTypesConfig >> _x)) then {
|
||||
if (isArray(_damageTypesConfig >> _x >> "thresholds")) then { _typeThresholds = getArray(_damageTypesConfig >> _x >> "thresholds");};
|
||||
if (isNumber(_damageTypesConfig >> _x >> "selectionSpecific")) then { _selectionSpecificType = getNumber(_damageTypesConfig >> _x >> "selectionSpecific");};
|
||||
};
|
||||
missionNamespace setvariable [_varName, [_typeThresholds, _selectionSpecificType > 0, _woundTypes]];
|
||||
_varName = format[QGVAR(woundInjuryType_%1),_x];
|
||||
_woundTypes = [];
|
||||
_type = _x;
|
||||
{
|
||||
// Check if this type is in the causes of a wound class, if so, we will store the wound types for this damage type
|
||||
if (_type in (_x select 5)) then {
|
||||
_woundTypes pushback _x;
|
||||
};
|
||||
}foreach _allWoundClasses;
|
||||
_typeThresholds = _thresholds;
|
||||
_selectionSpecificType = _selectionSpecific;
|
||||
if (isClass(_damageTypesConfig >> _x)) then {
|
||||
if (isArray(_damageTypesConfig >> _x >> "thresholds")) then { _typeThresholds = getArray(_damageTypesConfig >> _x >> "thresholds");};
|
||||
if (isNumber(_damageTypesConfig >> _x >> "selectionSpecific")) then { _selectionSpecificType = getNumber(_damageTypesConfig >> _x >> "selectionSpecific");};
|
||||
};
|
||||
missionNamespace setvariable [_varName, [_typeThresholds, _selectionSpecificType > 0, _woundTypes]];
|
||||
}foreach _allTypes;
|
||||
|
@ -29,13 +29,13 @@ if (count _items == 0) exitwith {};
|
||||
if ([_caller, _target, _items] call FUNC(useItems)) then {
|
||||
[[_target, _className], QUOTE(DFUNC(treatmentBandageLocal)), _target] call EFUNC(common,execRemoteFnc); /* TODO Replace by event system */
|
||||
{
|
||||
if (_x != "") then {
|
||||
[_target, _x] call FUNC(addToTriageCard);
|
||||
};
|
||||
}foreach _items;
|
||||
if (_x != "") then {
|
||||
[_target, _x] call FUNC(addToTriageCard);
|
||||
};
|
||||
}foreach _items;
|
||||
|
||||
["Medical_treatmentCompleted", [_caller, _target, _selectionName, _className, true]] call ace_common_fnc_localEvent;
|
||||
[_target, "activity", "STR_ACE_HAS_BANDAGED_ACTIVITY", [[_caller] call EFUNC(common,getName)]] call FUNC(addToLog);
|
||||
["Medical_treatmentCompleted", [_caller, _target, _selectionName, _className, true]] call ace_common_fnc_localEvent;
|
||||
[_target, "activity", "STR_ACE_HAS_BANDAGED_ACTIVITY", [[_caller] call EFUNC(common,getName)]] call FUNC(addToLog);
|
||||
};
|
||||
|
||||
true;
|
||||
|
@ -29,13 +29,13 @@ if (count _items == 0) exitwith {};
|
||||
if ([_caller, _target, _items] call FUNC(useItems)) then {
|
||||
[[_target, _className], QUOTE(DFUNC(treatmentMedicationLocal)), _target] call EFUNC(common,execRemoteFnc); /* TODO Replace by event system */
|
||||
{
|
||||
if (_x != "") then {
|
||||
[_target, _x] call FUNC(addToTriageCard);
|
||||
};
|
||||
}foreach _items;
|
||||
if (_x != "") then {
|
||||
[_target, _x] call FUNC(addToTriageCard);
|
||||
};
|
||||
}foreach _items;
|
||||
|
||||
["Medical_treatmentCompleted", [_caller, _target, _selectionName, _className, true]] call ace_common_fnc_localEvent;
|
||||
[_target, "activity", "STR_ACE_HAS_MEDICATION_ACTIVITY", [[_caller] call EFUNC(common,getName)]] call FUNC(addToLog);
|
||||
["Medical_treatmentCompleted", [_caller, _target, _selectionName, _className, true]] call ace_common_fnc_localEvent;
|
||||
[_target, "activity", "STR_ACE_HAS_MEDICATION_ACTIVITY", [[_caller] call EFUNC(common,getName)]] call FUNC(addToLog);
|
||||
};
|
||||
|
||||
true;
|
||||
|
@ -31,5 +31,5 @@ if ([_caller, _target, _items] call FUNC(useItems)) then {
|
||||
[[_target, _removeItem], QUOTE(DFUNC(treatmentIVLocal)), _target] call EFUNC(common,execRemoteFnc); /* TODO Replace by event system */
|
||||
["Medical_treatmentCompleted", [_caller, _target, _selectionName, _className, true]] call ace_common_fnc_localEvent;
|
||||
[_target, _removeItem] call FUNC(addToTriageCard);
|
||||
[_target, "activity", "STR_ACE_HAS_GIVEN_IV_ACTIVITY", [[_caller] call EFUNC(common,getName)]] call FUNC(addToLog);
|
||||
[_target, "activity", "STR_ACE_HAS_GIVEN_IV_ACTIVITY", [[_caller] call EFUNC(common,getName)]] call FUNC(addToLog);
|
||||
};
|
||||
|
@ -44,7 +44,7 @@ if ([_caller, _target, _items] call FUNC(useItems)) then {
|
||||
[[_target, _removeItem], QUOTE(DFUNC(treatmentTourniquetLocal)), _target] call EFUNC(common,execRemoteFnc); /* TODO Replace by event system */
|
||||
["Medical_treatmentCompleted", [_caller, _target, _selectionName, _className, true]] call ace_common_fnc_localEvent;
|
||||
[_target, _removeItem] call FUNC(addToTriageCard);
|
||||
[_target, "activity", "STR_ACE_HAS_APPLIED_TOURNIQUET_ACTIVITY", [[_caller] call EFUNC(common,getName)]] call FUNC(addToLog);
|
||||
[_target, "activity", "STR_ACE_HAS_APPLIED_TOURNIQUET_ACTIVITY", [[_caller] call EFUNC(common,getName)]] call FUNC(addToLog);
|
||||
};
|
||||
|
||||
true;
|
||||
|
@ -21,15 +21,15 @@ _patient = _this select 1;
|
||||
_items = _this select 2;
|
||||
|
||||
{
|
||||
// handle a one of type use item
|
||||
if (typeName _x == "ARRAY") then {
|
||||
{
|
||||
if ([_medic, _patient, _x] call FUNC(useItem)) exitwith {};
|
||||
}foreach _x;
|
||||
};
|
||||
// handle a one of type use item
|
||||
if (typeName _x == "ARRAY") then {
|
||||
{
|
||||
if ([_medic, _patient, _x] call FUNC(useItem)) exitwith {};
|
||||
}foreach _x;
|
||||
};
|
||||
|
||||
// handle required item
|
||||
if (typeName _x == "STRING") then {
|
||||
[_medic, _patient, _x] call FUNC(useItem);
|
||||
};
|
||||
// handle required item
|
||||
if (typeName _x == "STRING") then {
|
||||
[_medic, _patient, _x] call FUNC(useItem);
|
||||
};
|
||||
}foreach _items;
|
||||
|
Loading…
Reference in New Issue
Block a user