Merge branch 'medical-rewrite' of https://github.com/KoffeinFlummi/ACE3 into medical-rewrite

Conflicts:
	addons/medical/XEH_preInit.sqf
	addons/medical/functions/fnc_init.sqf
	addons/medical/functions/fnc_treatmentAdvanced_fullHealLocal.sqf
This commit is contained in:
KoffeinFlummi 2015-02-28 20:50:59 +01:00
commit 7f9daeb2f6
21 changed files with 271 additions and 142 deletions

View File

@ -16,6 +16,7 @@ PREP(addToTriageCard);
PREP(addUnconsciousCondition);
PREP(canAccessMedicalEquipment);
PREP(canTreat);
PREP(determineIfFatal);
PREP(getBloodLoss);
PREP(getBloodPressure);
PREP(getBloodVolumeChange);
@ -24,6 +25,7 @@ PREP(getTypeOfDamage);
PREP(getUnconsciousCondition);
PREP(handleDamage);
PREP(handleDamage_advanced);
PREP(handleDamage_advancedSetDamage);
PREP(handleDamage_airway);
PREP(handleDamage_basic);
PREP(handleDamage_caching);
@ -40,6 +42,7 @@ PREP(isInMedicalFacility);
PREP(isMedic);
PREP(isMedicalVehicle);
PREP(onMedicationUsage);
PREP(onTreatmentCompleted);
PREP(parseConfigForInjuries);
PREP(playInjuredSound);
PREP(reactionToDamage);
@ -48,7 +51,6 @@ PREP(setCardiacArrest);
PREP(setDead);
PREP(setHitPointDamage);
PREP(setUnconscious);
PREP(treatmentIV);
PREP(treatment);
PREP(treatment_failure);
PREP(treatment_success);
@ -64,6 +66,7 @@ PREP(treatmentBasic_bandage);
PREP(treatmentBasic_bloodbag);
PREP(treatmentBasic_epipen);
PREP(treatmentBasic_morphine);
PREP(treatmentIV);
PREP(treatmentIVLocal);
PREP(treatmentTourniquet);
PREP(treatmentTourniquetLocal);

View File

@ -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;
};

View File

@ -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;

View File

@ -0,0 +1,42 @@
/**
* fn_determineIfFatal.sqf
* @Descr: N/A
* @Author: Glowbal
*
* @Arguments: []
* @Return:
* @PublicAPI: false
*/
#include "script_component.hpp"
private ["_unit","_part","_damageThreshold", "_withDamage"];
_unit = _this select 0;
_part = _this select 1;
_withDamage = if (count _this > 2) then { _this select 2} else {0};
if (!alive _unit) exitwith {true};
if ((vehicle _unit != _unit) && {!alive (vehicle _unit)}) exitwith { true };
// Find the correct Damage threshold for unit.
_damageThreshold = [1,1,1];
if (isPlayer _unit) then {
_damageThreshold =_unit getvariable[QGVAR(unitDamageThreshold), [GVAR(damageThreshold_Players), GVAR(damageThreshold_Players), GVAR(damageThreshold_Players) * 1.7]];
} else {
_damageThreshold =_unit getvariable[QGVAR(unitDamageThreshold), [GVAR(damageThreshold_AI), GVAR(damageThreshold_AI), GVAR(damageThreshold_AI) * 1.7]];
};
_damageBodyPart = ((_unit getvariable [QGVAR(bodyPartStatus),[0,0,0,0,0,0]]) select _part) + _withDamage;
// Check if damage to body part is higher as damage head
if (_part == 0) exitwith {
(_damageBodyPart >= (_damageThreshold select 0) && {(random(1) > 0.2)});
};
// Check if damage to body part is higher as damage torso
if (_part == 1) exitwith {
(_damageBodyPart >= (_damageThreshold select 1) && {(random(1) > 0.2)});
};
// Check if damage to body part is higher as damage limbs
(_damageBodyPart >= (_damageThreshold select 2) && {(random(1) > 0.95)});

View File

@ -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;

View File

@ -1,5 +1,5 @@
/*
* Author: KoffeinFlummi
* Author: KoffeinFlummi, Glowbal
* Main HandleDamage EH function.
*
* Arguments:
@ -26,7 +26,7 @@ _projectile = _this select 4;
if !(local _unit) exitWith {nil};
if !([_unit] call FUNC(hasMedicalEnabled)) exitwith {};
if !([_unit] call FUNC(hasMedicalEnabled)) exitwith {systemChat format["Has no medical enabled: %1", _unit];};
if (typeName _projectile == "OBJECT") then {
_projectile = typeOf _projectile;
@ -47,12 +47,22 @@ 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);
// TODO check if this should would have killed the unit..
if (_damageReturn > 0.9) then {
_damageReturn = 0.9;
};
if (_damageReturn > 0.9) then {
_hitPoints = ["HitHead", "HitBody", "HitLeftArm", "HitRightArm", "HitLeftLeg", "HitRightLeg"];
_newDamage = _damage - (damage _unit);
if (_selectionName in _hitSelections) then {
_newDamage = _damage - (_unit getHitPointDamage (_hitPoints select (_hitSelections find _selectionName)));
};
if ([_unit, [_selectionName] call FUNC(selectionNameToNumber), _newDamage] call FUNC(determineIfFatal)) then {
if ([_unit] call FUNC(setDead)) then {
_damageReturn = 1;
};
} else {
_damageReturn = 0.89;
};
};
};
if (_unit getVariable [QGVAR(preventDeath), false] && {_damageReturn >= 0.9} && {_selection in ["", "head", "body"]}) exitWith {

View File

@ -19,33 +19,39 @@
#include "script_component.hpp"
private ["_unit","_selectionName","_amountOfDamage","_sourceOfDamage","_typeOfProjectile","_typeOfDamage"];
private ["_unit","_selectionName","_amountOfDamage","_sourceOfDamage","_typeOfProjectile","_typeOfDamage", "_part", "_damageBodyParts", "_newDamage", "_hitPoints"];
_unit = _this select 0;
_selectionName = _this select 1;
_amountOfDamage = _this select 2;
_sourceOfDamage = _this select 3;
_typeOfProjectile = _this select 4;
_returnDamage = _this select 5;
_typeOfDamage = [_typeOfProjectile] call FUNC(getTypeOfDamage);
_part = [_selectionName] call FUNC(selectionNameToNumber);
_hitPoints = ["HitHead", "HitBody", "HitLeftArm", "HitRightArm", "HitLeftLeg", "HitRightLeg"];
// Sorting out the damage
_damageBodyParts = _unit getvariable [QGVAR(bodyPartStatus), [0,0,0,0,0,0]];
_newDamage = _amountOfDamage - (_unit getHitPointDamage (_hitPoints select _part));
_damageBodyParts set [_part, (_damageBodyParts select _part) + _newDamage];
_unit setvariable [QGVAR(bodyPartStatus), _damageBodyParts, true];
[_unit] call FUNC(handleDamage_advancedSetDamage);
// TODO parse for new damage
// TODO parse for kill injuries
[_unit, _selectionName, _amountOfDamage, _typeOfProjectile, _typeOfDamage] call FUNC(handleDamage_wounds);
[_unit, _selectionName, _newDamage, _typeOfProjectile, _typeOfDamage] call FUNC(handleDamage_wounds);
if (GVAR(enableAirway)) then {
[_unit,_selectionName,_amountOfDamage,_sourceOfDamage, _typeOfDamage] call FUNC(handleDamage_airway);
[_unit,_selectionName,_newDamage,_sourceOfDamage, _typeOfDamage] call FUNC(handleDamage_airway);
};
if (GVAR(enableFractures)) then {
[_unit,_selectionName,_amountOfDamage,_sourceOfDamage, _typeOfDamage] call FUNC(handleDamage_fractures);
[_unit,_selectionName,_newDamage,_sourceOfDamage, _typeOfDamage] call FUNC(handleDamage_fractures);
};
if (GVAR(enableInternalBleeding)) then {
[_unit,_selectionName,_amountOfDamage,_sourceOfDamage, _typeOfDamage] call FUNC(handleDamage_internalInjuries);
[_unit,_selectionName,_newDamage,_sourceOfDamage, _typeOfDamage] call FUNC(handleDamage_internalInjuries);
};
if (alive _unit && {!(_unit getvariable ["ACE_isUnconscious", false])}) then {
[_unit, _amountOfDamage] call FUNC(reactionToDamage);
[_unit, _newDamage] call FUNC(reactionToDamage);
};
_returnDamage;

View File

@ -0,0 +1,56 @@
/*
* Author: Glowbal
* Sets the hitpoint damage for au nit to the correct values
*
* Arguments:
* 0: Unit for which the hitpoint damage will be sorted out <OBJECT>
*
* Return Value:
* nil
*
* Public: No
*/
#include "script_component.hpp"
private ["_unit", "_bodyStatus", "_headDamage", "_torsoDamage", "_handsDamage", "_legsDamage"];
_unit = _this select 0;
if (!local _unit) exitwith {
// execute only local
};
_bodyStatus = _unit getvariable [QGVAR(bodyPartStatus),[0,0,0,0,0,0]];
// ["head", "body", "hand_l", "hand_r", "leg_l", "leg_r"]
_headDamage = _bodyStatus select 0;
if (_headDamage > 0.95) then {
_unit setHitPointDamage ["hitHead", 0.95];
} else {
_unit setHitPointDamage ["hitHead", _headDamage];
};
_torsoDamage = _bodyStatus select 1;
if (_torsoDamage > 0.95) then {
_unit setHitPointDamage ["hitBody", 0.95];
} else {
_unit setHitPointDamage ["hitBody", _torsoDamage];
};
_handsDamage = (_bodyStatus select 2) + (_bodyStatus select 3);
if (_handsDamage > 0.95) then {
_unit setHitPointDamage ["hitHands", 0.95];
} else {
_unit setHitPointDamage ["hitHands", _handsDamage];
};
_legsDamage = (_bodyStatus select 4) + (_bodyStatus select 5);
if (_legsDamage > 0.95) then {
_unit setHitPointDamage ["hitLegs", 0.95];
} else {
_unit setHitPointDamage ["hitLegs", _legsDamage];
};
if ({_x > 0} count _bodyStatus == 0) then {
_unit setDamage 0;
};

View File

@ -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];
};
};
};

View File

@ -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;

View File

@ -31,8 +31,7 @@ _unit setVariable [QGVAR(internalWounds), [], true];
// vitals
_unit setVariable [QGVAR(heartRate), 80];
_unit setvariable [QGVAR(heartRateAdjustments), []];
// _unit setvariable [QGVAR(bloodPressure), _bloodPressure]; @todo for glowbal
_unit setvariable [QGVAR(bloodPressure), 0];
_unit setvariable [QGVAR(bloodPressure), [80, 120]];
_unit setVariable [QGVAR(peripheralResistance), 100];
// fractures
@ -57,7 +56,7 @@ _unit setvariable [QGVAR(airwayCollapsed), true, true];
// generic medical admin
_unit setvariable [QGVAR(addedToUnitLoop), false, true];
_unit setvariable [QGVAR(inCardiacArrest), true,true];
_unit setvariable [QGVAR(inCardiacArrest), true, true];
_unit setVariable [QGVAR(isUnconscious), false, true];
_unit setvariable [QGVAR(hasLostBlood), true, true];
_unit setvariable [QGVAR(isBleeding), false, true];
@ -72,6 +71,7 @@ _unit setVariable [QGVAR(allUsedMedication), []];
_logs = _unit getvariable [QGVAR(allLogs), []];
{
_unit setvariable [_x, nil, true];
_unit setvariable [_x, nil, true];
} foreach _logs;
_unit setvariable [_x, nil, true];
_unit setvariable [QGVAR(allLogs), [], true];

View File

@ -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;
};

View File

@ -16,6 +16,8 @@
* Public: No
*/
#include "script_component.hpp"
private ["_target", "_className", "_variable", "_maxDosage", "_timeInSystem", "_incompatabileMeds", "_foundEntry", "_allUsedMedication","_allMedsFromClassname", "_usedMeds", "_hasOverDosed", "_med", "_limit", "_classNamesUsed", "_decreaseAmount"];
_target = _this select 0;
_className = _this select 1;

View File

@ -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,19 +76,20 @@ _thresholds = getArray(_damageTypesConfig >> "thresholds");
_selectionSpecific = getNumber(_damageTypesConfig >> "selectionSpecific");
{
_varName = format[QGVAR(woundInjuryType_%1),_x];
_woundTypes = [];
_type = _x;
{
if (_type in (_x select 4)) 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;

View File

@ -99,4 +99,17 @@ if (_iconDisplayed != "") then {
[QGVAR(treatmentActionIcon), true, _iconDisplayed, [1,1,1,1], getNumber(_config >> "actionIconDisplayTime")] call EFUNC(common,displayIcon);
};
// handle display of text/hints
_displayText = "";
if (_target != _caller) then {
_displayText = getText(_config >> "displayTextOther");
} else {
_displayText = getText(_config >> "displayTextSelf");
};
if (_displayText != "") then {
["displayTextStructured", [_caller], [[_displayText, [_caller] call EFUNC(common,getName), [_target] call EFUNC(common,getName)], 1.5, _caller]] call EFUNC(common,targetEvent);
};
true;

View File

@ -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;

View File

@ -10,7 +10,7 @@
#include "script_component.hpp"
private ["_unit", "_caller"];
private ["_unit", "_caller", "_allUsedMedication"];
_unit = _this select 0;
_caller = _this select 1;
@ -30,7 +30,7 @@ if (alive _unit) exitwith {
// vitals
_unit setVariable [QGVAR(heartRate), 80];
_unit setvariable [QGVAR(heartRateAdjustments), []];
_unit setvariable [QGVAR(bloodPressure), _bloodPressure];
_unit setvariable [QGVAR(bloodPressure), [80, 120]];
_unit setVariable [QGVAR(peripheralResistance), 100];
// fractures
@ -51,22 +51,18 @@ if (alive _unit) exitwith {
// generic medical admin
_unit setvariable [QGVAR(addedToUnitLoop), false, true];
_unit setvariable [QGVAR(inCardiacArrest), true,true];
_unit setvariable [QGVAR(inCardiacArrest), true, true];
_unit setVariable [QGVAR(isUnconscious), false, true];
_unit setvariable [QGVAR(hasLostBlood), true, true];
_unit setvariable [QGVAR(isBleeding), false, true];
_unit setvariable [QGVAR(hasPain), false, true];
// medication
_allUsedMedication = _target getVariable [QGVAR(allUsedMedication), []];
_allUsedMedication = _unit getVariable [QGVAR(allUsedMedication), []];
{
_unit setvariable [_x select 0, nil];
}foreach _allUsedMedication;
// Resetting damage
_unit setDamage 0;
["Medical_onFullyHealed", [_unit, true]] call ace_common_fnc_localEvent;
[format["Completed healLocal %1", _this]] call EFUNC(common,debug);
};
["Medical_onFullyHealed", [_unit, false]] call ace_common_fnc_localEvent;

View File

@ -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;

View File

@ -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);
};

View File

@ -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;

View File

@ -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;