Merge pull request #318 from KoffeinFlummi/medicalImprovements

Medical improvements and fixes round 2
This commit is contained in:
Glowbal 2015-04-05 22:17:00 +02:00
commit 52fa8df1fa
21 changed files with 257 additions and 91 deletions

View File

@ -18,9 +18,6 @@
EXPLODE_2_PVT(_this,_unit,_isUnconc);
diag_log "handleOnUnconscious";
diag_log _this;
diag_log _unit;
if (!local _unit) exitWith {};
if (_isUnconc) then {

View File

@ -265,7 +265,7 @@ class ACE_Medical_Actions {
condition = "((_this select 1) getvariable ['ACE_medical_inCardiacArrest', false])";
callbackSuccess = QUOTE(DFUNC(treatmentAdvanced_CPR));
callbackFailure = "";
callbackProgress = "((_this select 1) getvariable ['ACE_medical_inCardiacArrest', false])";
callbackProgress = "(((_this select 0) select 1) getvariable ['ACE_medical_inCardiacArrest', false])";
animationPatient = "";
animationPatientUnconscious = "AinjPpneMstpSnonWrflDnon_rolltoback";
animationCaller = "AinvPknlMstpSlayWnonDnon_medic";

View File

@ -16,13 +16,12 @@ class ACE_Settings {
};
class GVAR(enableOverdosing) {
typeName = "BOOL";
value = true;
value = 1;
};
class GVAR(bleedingCoefficient) {
typeName = "SCALAR";
value = 1;
};
class GVAR(enableAirway) {
typeName = "BOOL";
value = false;
@ -37,11 +36,11 @@ class ACE_Settings {
};
class GVAR(enableVehicleCrashes) {
typeName = "BOOL";
value = true;
value = 1;
};
class GVAR(enableScreams) {
typeName = "BOOL";
value = true;
value = 1;
};
class GVAR(playerDamageThreshold) {
typeName = "SCALAR";
@ -58,7 +57,7 @@ class ACE_Settings {
};
class GVAR(preventInstaDeath) {
typeName = "BOOL";
value = false;
value = 0;
};
class GVAR(maxReviveTime) {
typeName = "SCALAR";
@ -70,7 +69,7 @@ class ACE_Settings {
};
class GVAR(allowDeadBodyMovement) {
typeName = "BOOL";
value = false;
value = 0;
};
class GVAR(allowLitterCreation) {
typeName = "BOOL";
@ -83,17 +82,25 @@ class ACE_Settings {
class GVAR(medicSetting_PAK) {
typeName = "SCALAR";
value = 1;
values[] = {"Anyone", "Medics only", "Doctors only"};
};
class GVAR(medicSetting_SurgicalKit) {
typeName = "SCALAR";
value = 1;
values[] = {"Anyone", "Medics only", "Doctors only"};
};
class GVAR(consumeItem_PAK) {
typeName = "SCALAR";
value = 0;
values[] = {"No", "Yes"};
};
class GVAR(consumeItem_SurgicalKit) {
typeName = "SCALAR";
value = 0;
values[] = {"No", "Yes"};
};
class GVAR(keepLocalSettingsSynced) {
typeName = "BOOL";
value = 1;
};
};

View File

@ -128,6 +128,12 @@ class CfgVehicles {
typeName = "NUMBER";
defaultValue = 1;
};
class keepLocalSettingsSynced {
displayName = "Sync status";
description = "Keep unit status synced. Recommended on.";
typeName = "BOOL";
defaultValue = 1;
};
};
class ModuleDescription {
description = "Provides a medical system for both players and AI.";
@ -135,7 +141,7 @@ class CfgVehicles {
};
};
class ACE_moduleTreatmentConfiguration: ACE_Module {
class ACE_moduleTreatmentSettings: ACE_Module {
scope = 2;
displayName = "Treatment Settings [ACE]";
icon = QUOTE(PATHTOF(UI\Icon_Module_Medical_ca.paa));

View File

@ -10,14 +10,12 @@ class CfgWeapons {
type = 0;
class ItemInfo: InventoryFirstAidKitItem_Base_F {
mass = 4;
type = 201;
};
};
class Medikit: ItemCore {
type = 0;
class ItemInfo: MedikitItem {
mass = 60;
type = 201;
};
};
@ -31,11 +29,10 @@ class CfgWeapons {
descriptionShort = $STR_ACE_MEDICAL_BANDAGE_BASIC_DESC_SHORT;
descriptionUse = $STR_ACE_MEDICAL_BANDAGE_BASIC_DESC_USE;
class ItemInfo: InventoryItem_Base_F {
mass=1;
type=201;
mass = 1;
};
};
class ACE_packingBandage: ItemCore {
class ACE_packingBandage: ACE_ItemCore {
scope = 2;
value = 1;
count = 1;
@ -46,11 +43,10 @@ class CfgWeapons {
descriptionShort = $STR_ACE_MEDICAL_PACKING_BANDAGE_DESC_SHORT;
descriptionUse = $STR_ACE_MEDICAL_PACKING_BANDAGE_DESC_USE;
class ItemInfo: InventoryItem_Base_F {
mass=1;
type=201;
mass = 1;
};
};
class ACE_elasticBandage: ItemCore {
class ACE_elasticBandage: ACE_ItemCore {
scope = 2;
value = 1;
count = 1;
@ -61,11 +57,10 @@ class CfgWeapons {
descriptionShort = $STR_ACE_MEDICAL_BANDAGE_ELASTIC_DESC_SHORT;
descriptionUse = $STR_ACE_MEDICAL_BANDAGE_ELASTIC_DESC_USE;
class ItemInfo: InventoryItem_Base_F {
mass=1;
type=201;
mass = 1;
};
};
class ACE_tourniquet: ItemCore {
class ACE_tourniquet: ACE_ItemCore {
scope = 2;
value = 1;
count = 1;
@ -76,11 +71,10 @@ class CfgWeapons {
descriptionShort = $STR_ACE_MEDICAL_TOURNIQUET_DESC_SHORT;
descriptionUse = $STR_ACE_MEDICAL_TOURNIQUET_DESC_USE;
class ItemInfo: InventoryItem_Base_F {
mass=1;
type=201;
mass = 1;
};
};
class ACE_morphine: ItemCore {
class ACE_morphine: ACE_ItemCore {
scope = 2;
value = 1;
count = 1;
@ -91,11 +85,10 @@ class CfgWeapons {
descriptionShort = $STR_ACE_MEDICAL_MORPHINE_DESC_SHORT;
descriptionUse = $STR_ACE_MEDICAL_MORPHINE_DESC_USE;
class ItemInfo: InventoryItem_Base_F {
mass=1;
type=201;
mass = 1;
};
};
class ACE_atropine: ItemCore {
class ACE_atropine: ACE_ItemCore {
scope = 2;
value = 1;
count = 1;
@ -106,11 +99,11 @@ class CfgWeapons {
descriptionShort = $STR_ACE_MEDICAL_ATROPINE_DESC_SHORT;
descriptionUse = $STR_ACE_MEDICAL_ATROPINE_DESC_USE;
class ItemInfo: InventoryItem_Base_F {
mass=1;
type=201;
mass = 1;
};
};
class ACE_epinephrine: ItemCore {
class ACE_epinephrine: ACE_ItemCore {
scope = 2;
value = 1;
count = 1;
@ -121,11 +114,10 @@ class CfgWeapons {
descriptionShort = $STR_ACE_MEDICAL_EPINEPHRINE_DESC_SHORT;
descriptionUse = $STR_ACE_MEDICAL_EPINEPHRINE_DESC_USE;
class ItemInfo: InventoryItem_Base_F {
mass=1;
type=201;
mass = 1;
};
};
class ACE_plasmaIV: ItemCore {
class ACE_plasmaIV: ACE_ItemCore {
scope = 2;
value = 1;
count = 1;
@ -135,24 +127,21 @@ class CfgWeapons {
descriptionUse = $STR_ACE_MEDICAL_PLASMA_IV_DESC_USE;
class ItemInfo: InventoryItem_Base_F {
mass = 10;
type = 201;
};
};
class ACE_plasmaIV_500: ACE_plasmaIV {
displayName = $STR_ACE_MEDICAL_PLASMA_IV_500;
class ItemInfo: InventoryItem_Base_F {
mass = 5;
type = 201;
};
};
class ACE_plasmaIV_250: ACE_plasmaIV {
displayName = $STR_ACE_MEDICAL_PLASMA_IV_250;
class ItemInfo: InventoryItem_Base_F {
mass = 2.5;
type = 201;
};
};
class ACE_bloodIV: ItemCore {
class ACE_bloodIV: ACE_ItemCore {
scope = 2;
value = 1;
count = 1;
@ -163,24 +152,21 @@ class CfgWeapons {
descriptionUse = $STR_ACE_MEDICAL_BLOOD_IV_DESC_USE;
class ItemInfo: InventoryItem_Base_F {
mass = 10;
type = 201;
};
};
class ACE_bloodIV_500: ACE_bloodIV {
displayName = $STR_ACE_MEDICAL_BLOOD_IV_500;
class ItemInfo: InventoryItem_Base_F {
mass = 5;
type = 201;
};
};
class ACE_bloodIV_250: ACE_bloodIV {
displayName = $STR_ACE_MEDICAL_BLOOD_IV_250;
class ItemInfo: InventoryItem_Base_F {
mass = 2.5;
type = 201;
};
};
class ACE_salineIV: ItemCore {
class ACE_salineIV: ACE_ItemCore {
scope = 2;
value = 1;
count = 1;
@ -190,24 +176,21 @@ class CfgWeapons {
descriptionUse = $STR_ACE_MEDICAL_SALINE_IV_DESC_USE;
class ItemInfo: InventoryItem_Base_F {
mass = 10;
type = 201;
};
};
class ACE_salineIV_500: ACE_salineIV {
displayName = $STR_ACE_MEDICAL_SALINE_IV_500;
class ItemInfo: InventoryItem_Base_F {
mass = 2.5;
type = 201;
};
};
class ACE_salineIV_250: ACE_salineIV {
displayName = $STR_ACE_MEDICAL_SALINE_IV_250;
class ItemInfo: InventoryItem_Base_F {
mass = 2.5;
type = 201;
};
};
class ACE_quikclot: ItemCore {
class ACE_quikclot: ACE_ItemCore {
scope = 2;
value = 1;
count = 1;
@ -218,25 +201,22 @@ class CfgWeapons {
descriptionUse = $STR_ACE_MEDICAL_QUIKCLOT_DESC_USE;
class ItemInfo: InventoryItem_Base_F {
mass = 1;
type = 201;
};
};
class ACE_personalAidKit: ItemCore {
class ACE_personalAidKit: ACE_ItemCore {
scope = 2;
value = 1;
count = 1;
type = 16;
displayName = $STR_ACE_MEDICAL_AID_KIT_DISPLAY;
picture = QUOTE(PATHTOF(ui\items\personal_aid_kit.paa));
//model = QUOTE(PATHTOF(equipment\Personal-aidkits\MTP.p3d));
descriptionShort = $STR_ACE_MEDICAL_AID_KIT_DESC_SHORT;
descriptionUse = $STR_ACE_MEDICAL_AID_KIT_DESC_USE;
class ItemInfo: InventoryItem_Base_F {
mass = 2;
type = 201;
};
};
class ACE_surgicalKit: ItemCore {
class ACE_surgicalKit: ACE_ItemCore {
scope=2;
displayName= $STR_ACE_MEDICAL_SURGICALKIT_DISPLAY;
model = QUOTE(PATHTOF(data\surgical_kit.p3d));
@ -245,10 +225,9 @@ class CfgWeapons {
descriptionUse = $STR_ACE_MEDICAL_SURGICALKIT_DESC_USE;
class ItemInfo: InventoryItem_Base_F {
mass = 5;
type = 201;
};
};
class ACE_bodyBag: ItemCore {
class ACE_bodyBag: ACE_ItemCore {
scope=2;
displayName= $STR_ACE_MEDICAL_BODYBAG_DISPLAY;
model = QUOTE(PATHTOF(data\bodybagItem.p3d));
@ -257,7 +236,6 @@ class CfgWeapons {
descriptionUse = $STR_ACE_MEDICAL_BODYBAG_DESC_USE;
class ItemInfo: InventoryItem_Base_F {
mass = 15;
type = 201;
};
};
};

View File

@ -45,6 +45,7 @@ PREP(handleDamage_wounds);
PREP(handleUnitVitals);
PREP(handleKilled);
PREP(handleLocal);
PREP(handleBandageOpening);
PREP(hasItem);
PREP(hasItems);
PREP(hasMedicalEnabled);

View File

@ -22,18 +22,18 @@ if !([_caller, "ACE_itemBodyBag"] call EFUNC(common,hasItem)) exitwith {};
[_caller, "ACE_itemBodyBag"] call EFUNC(common,useItem);
_nameOfUnit = [_unit] call EFUNC(common,getName);
if (alive _unit) then {
_nameOfUnit = [_target] call EFUNC(common,getName);
if (alive _target) then {
// force kill the unit.
[_unit, true] call FUNC(setDead);
[_target, true] call FUNC(setDead);
};
_onPosition = getPos _unit;
deleteVehicle _unit;
_onPosition = getPos _target;
deleteVehicle _target;
_bodyBagCreated = createVehicle ["ACE_bodyBag", _onPosition, [], 0, "NONE"];
// reset the position to ensure it is on the correct one.
_bodyBagCreated setPos _onPosition;
// TODO Does this need to be something with QUOTE(DEFUNC)?
[[_bodyBagCreated], QEFUNC(common,revealObject), true] call call EFUNC(common,execRemoteFnc); /* TODO Replace by event system */
[[_bodyBagCreated], QUOTE(DEFUNC(common,revealObject)), true] call call EFUNC(common,execRemoteFnc); /* TODO Replace by event system */
_bodyBagCreated;

View File

@ -24,6 +24,7 @@ _className = _this select 3;
_usersOfItems = _this select 5;
if !(GVAR(allowLitterCreation)) exitwith {};
if (vehicle _caller != _caller || vehicle _target != _target) exitwith {};
_config = (configFile >> "ACE_Medical_Actions" >> "Basic" >> _className);
if (GVAR(level) >= 2) then {

View File

@ -61,6 +61,18 @@ if (_show) then {
_genericMessages pushback [localize "STR_ACE_MEDICAL_STATUS_PAIN", [1, 1, 1, 1]];
};
_totalIvVolume = 0;
{
private "_value";
_value = _target getvariable _x;
if !(isnil "_value") then {
_totalIvVolume = _totalIvVolume + (_target getvariable [_x, 0]);
};
}foreach GVAR(IVBags);
if (_totalIvVolume >= 1) then {
_genericMessages pushback [format[localize "STR_ACE_MEDICAL_receivingIvVolume", floor _totalIvVolume], [1, 1, 1, 1]];
};
_selectionBloodLoss = [0,0,0,0,0,0];
if (GVAR(level) >= 2) then {
_openWounds = _target getvariable [QGVAR(openWounds), []];
@ -74,24 +86,45 @@ if (_show) then {
if (_amountOf > 0) then {
if (_amountOf >= 1) then {
// TODO localization
_allInjuryTexts pushback format["%2x %1", (GVAR(AllWoundInjuryTypes) select (_x select 1)) select 6, _amountOf];
_allInjuryTexts pushback [format["%2x %1", (GVAR(AllWoundInjuryTypes) select (_x select 1)) select 6, _amountOf], [1,1,1,1]];
} else {
// TODO localization
_allInjuryTexts pushback format["Partial %1", (GVAR(AllWoundInjuryTypes) select (_x select 1)) select 6];
_allInjuryTexts pushback [format["Partial %1", (GVAR(AllWoundInjuryTypes) select (_x select 1)) select 6], [1,1,1,1]];
};
};
};
}foreach _openWounds;
_bandagedwounds = _target getvariable [QGVAR(bandagedWounds), []];
{
_amountOf = _x select 3;
// Find how much this bodypart is bleeding
//if (_selectionBloodLoss select (_x select 2) == 0) then {
// _selectionBloodLoss set [(_x select 2), (_selectionBloodLoss select (_x select 2)) + (15 * ((_x select 4) * _amountOf))];
//};
if (GVAR(currentSelectedSelectionN) == (_x select 2)) then {
// Collect the text to be displayed for this injury [ Select injury class type definition - select the classname DisplayName (6th), amount of injuries for this]
if (_amountOf > 0) then {
if (_amountOf >= 1) then {
// TODO localization
_allInjuryTexts pushback [format["[B] %2x %1", (GVAR(AllWoundInjuryTypes) select (_x select 1)) select 6, _amountOf], [1,0.5,0.5,1]];
} else {
// TODO localization
_allInjuryTexts pushback [format["[B] Partial %1", (GVAR(AllWoundInjuryTypes) select (_x select 1)) select 6], [1,0.5,0.5,1]];
};
};
};
}foreach _bandagedwounds;
} else {
{
_selectionBloodLoss set [_forEachIndex, _target getHitPointDamage _x];
if (_target getHitPointDamage _x > 0.1) then {
// @todo localize
_allInjuryTexts pushBack format ["%1 %2",
_allInjuryTexts pushBack [format ["%1 %2",
["Lightly wounded", "Heavily wounded"] select (_target getHitPointDamage _x > 0.5),
["head", "torso", "left arm", "right arm", "left leg", "right leg"] select _forEachIndex
];
], [1,1,1,1]];
};
} forEach ["HitHead", "HitBody", "HitLeftArm", "HitRightArm", "HitLeftLeg", "HitRightLeg"];
};
@ -125,7 +158,8 @@ if (_show) then {
_lbCtrl lbSetColor [_foreachIndex, _x select 1];
}foreach _genericMessages;
{
_lbCtrl lbAdd _x;
_lbCtrl lbAdd (_x select 0);
_lbCtrl lbSetColor [_foreachIndex, _x select 1];
}foreach _allInjuryTexts;
if (count _allInjuryTexts == 0) then {
_lbCtrl lbAdd "No injuries on this bodypart..";

View File

@ -43,28 +43,27 @@ if (_show) then {
_lbCtrl = (_display displayCtrl 200);
lbClear _lbCtrl;
_log = _target getvariable ["myVariableTESTKOEAKJR", []];
_log = _target getvariable [QGVAR(triageCard), []];
{
// [_message,_moment,_type, _arguments]
_message = _x select 0;
_moment = _x select 1;
_arguments = _x select 3;
if (isLocalized _message) then {
_message = localize _message;
};
{
if (typeName _x == "STRING" && {isLocalized _x}) then {
_arguments set [_foreachIndex, localize _x];
_item = _x select 0;
_amount = _x select 1;
_message = _item;
if (isClass(configFile >> "CfgWeapons" >> _item)) then {
_message = getText(configFile >> "CfgWeapons" >> _item >> "DisplayName");
} else {
if (isLocalized _message) then {
_message = localize _message;
};
}foreach _arguments;
_message = format([_message] + _arguments);
_lbCtrl lbAdd format["%1 %2", _moment, _message];
};
_triageCardTexts pushback format["%1x - %2", _amount, _message];
}foreach _log;
if (count _triageCardTexts == 0) then {
_lbCtrl lbAdd "No entries on this triage card..";
};
{
_lbCtrl lbAdd _x;
}foreach _triageCardTexts;
_triageStatus = [_target] call FUNC(getTriageStatus);
(_display displayCtrl 2000) ctrlSetText (_triageStatus select 0);

View File

@ -13,6 +13,8 @@
#include "script_component.hpp"
#define BLOODLOSSRATE_BASIC 0.4
private ["_totalBloodLoss","_tourniquets","_openWounds", "_value", "_cardiacOutput", "_internalWounds"];
// TODO Only use this calculation if medium or higher, otherwise use vanilla calculations (for basic medical).
_totalBloodLoss = 0;
@ -40,6 +42,6 @@ if (GVAR(level) >= 2) then {
// cap the blood loss to be no greater as the current cardiac output
//(_totalBloodLoss min _cardiacOutput);
} else {
// TODO basic medical
_totalBloodLoss = BLOODLOSSRATE_BASIC * (damage _this);
};
_totalBloodLoss * (GVAR(bleedingCoefficient) max 0);

View File

@ -44,6 +44,12 @@ if (_bloodVolume < 100.0) then {
_unit setvariable [_x,_ivVolume];
};
}foreach GVAR(IVBags);
} else {
{
if ((_unit getvariable [_x, 0]) > 0) then {
_unit setvariable [_x, 0]; // lets get rid of exessive IV volume
};
}foreach GVAR(IVBags);
};
_bloodVolumeChange;

View File

@ -0,0 +1,118 @@
/*
* Author: Glowbal
* Handles the bandage of a patient.
*
* Arguments:
* 0: The target <OBJECT>
* 1: The impact <NUMBER>
* 2: Selection part number <NUMBER>
* 3: Injury index <NUMBER>
* 4: Injury <ARRAY>
* 5: Used Bandage type <STRING>
*
* Return Value:
* None
*
* Public: No
*/
#include "script_component.hpp"
private ["_target", "_impact", "_part", "_injuryIndex", "_injury", "_bandage", "_classID", "_className", "_reopeningChance", "_reopeningMinDelay", "_reopeningMaxDelay", "_config", "_woundTreatmentConfig", "_bandagedWounds", "_exist", "_injuryId", "_existingInjury", "_delay", "_openWounds", "_selectedInjury"];
_target = _this select 0;
_impact = _this select 1;
_part = _this select 2;
_injuryIndex = _this select 3;
_injury = _this select 4;
_bandage = _this select 5;
_classID = _injury select 1;
_className = GVAR(woundClassNames) select _classID;
// default, just in case..
_reopeningChance = 0.1;
_reopeningMinDelay = 120;
_reopeningMaxDelay = 200;
// Get the default values for the used bandage
_config = (ConfigFile >> "ACE_Medical_Advanced" >> "Treatment" >> "Bandaging");
if (isClass (_config >> _bandage)) then {
_config = (_config >> _bandage);
_reopeningChance = getNumber (_config >> "reopeningChance");
_reopeningMinDelay = getNumber (_config >> "reopeningMinDelay");
_reopeningMaxDelay = getNumber (_config >> "reopeningMaxDelay") max _reopeningMinDelay;
};
if (isClass (_config >> _className)) then {
_woundTreatmentConfig = (_config >> _className);
if (isNumber (_woundTreatmentConfig >> "reopeningChance")) then {
_reopeningChance = getNumber (_woundTreatmentConfig >> "reopeningChance");
};
if (isNumber (_woundTreatmentConfig >> "reopeningMinDelay")) then {
_reopeningMinDelay = getNumber (_woundTreatmentConfig >> "reopeningMinDelay");
};
if (isNumber (_woundTreatmentConfig >> "reopeningMaxDelay")) then {
_reopeningMaxDelay = getNumber (_woundTreatmentConfig >> "reopeningMaxDelay") max _reopeningMinDelay;
};
};
_bandagedWounds = _target getvariable [QGVAR(bandagedWounds), []];
_exist = false;
_injuryId = _injury select 0;
{
if ((_x select 0) == _injuryId) exitwith {
_exist = true;
_existingInjury = _x;
_existingInjury set [3, (_existingInjury select 3) + _impact];
_bandagedWounds set [_foreachIndex, _existingInjury];
};
}foreach _bandagedWounds;
if !(_exist) then {
// [ID, classID, bodypart, percentage treated, bloodloss rate]
_bandagedWounds pushback [_injuryId, _injury select 1, _injury select 2, _impact, _injury select 4];
};
_target setvariable [QGVAR(bandagedWounds), _bandagedWounds, true];
// Check if we are ever going to reopen this
if (random(1) <= _reopeningChance) then {
_delay = _reopeningMinDelay + random(_reopeningMaxDelay - _reopeningMinDelay);
[{
private ["_target", "_impact", "_part", "_injuryIndex", "_bandage", "_injury", "_openWounds", "_selectedInjury","_bandagedWounds","_exist"];
_target = _this select 0;
_impact = _this select 1;
_part = _this select 2;
_injuryIndex = _this select 3;
_injury = _this select 4;
if (alive _target) then {
_openWounds = _target getvariable [QGVAR(openWounds), []];
if ((count _openWounds)-1 < _injuryIndex) exitwith {};
_selectedInjury = _openWounds select _injuryIndex;
if (_selectedInjury select 0 == _injury select 0) then { // matching the IDs
_selectedInjury set [3, (_selectedInjury select 3) + _impact];
_openWounds set [_injuryIndex, _selectedInjury];
_target setvariable [QGVAR(openWounds), _openWounds, !USE_WOUND_EVENT_SYNC];
if (USE_WOUND_EVENT_SYNC) then {
["medical_propagateWound", [_target, _selectedInjury]] call EFUNC(common,globalEvent);
};
_bandagedWounds = _target getvariable [QGVAR(bandagedWounds), []];
_exist = false;
_injuryId = _injury select 0;
{
if ((_x select 0) == _injuryId) exitwith {
_exist = true;
_existingInjury = _x;
_existingInjury set [3, ((_existingInjury select 3) - _impact) max 0];
_bandagedWounds set [_foreachIndex, _existingInjury];
};
}foreach _bandagedWounds;
if (_exist) then {
_target setvariable [QGVAR(bandagedWounds), _bandagedWounds, true];
};
};
// Otherwise something went wrong, we we don't reopen them..
};
}, [_target, _impact, _part, _injuryIndex, _injury], _delay, 0] call EFUNC(common,waitAndExecute);
};

View File

@ -22,7 +22,7 @@ _unit setVariable [QGVAR(lastMomentVitalsHandled), time];
if (_interval == 0) exitWith {};
_lastTimeValuesSynced = _unit getvariable [QGVAR(lastMomentValuesSynced), 0];
_syncValues = time - _lastTimeValuesSynced >= (10 + floor(random(10)));
_syncValues = (time - _lastTimeValuesSynced >= (10 + floor(random(10))) && GVAR(keepLocalSettingsSynced));
if (_syncValues) then {
_unit setvariable [QGVAR(lastMomentValuesSynced), time];
};
@ -167,4 +167,15 @@ if (GVAR(level) >= 2) then {
[_unit] call FUNC(setCardiacArrest);
};
};
// syncing any remaining values
if (_syncValues) then {
{
private "_value";
_value = _unit getvariable _x;
if !(isnil "_value") then {
_unit setvariable [_x,(_unit getvariable [_x, 0]), true];
};
}foreach GVAR(IVBags);
};
};

View File

@ -26,6 +26,7 @@ _unit setvariable [QGVAR(tourniquets), [0,0,0,0,0,0], true];
// wounds and injuries
_unit setvariable [QGVAR(openWounds), [], true];
_unit setvariable [QGVAR(bandagedWounds), [], true];
_unit setVariable [QGVAR(internalWounds), [], true];
// vitals

View File

@ -34,3 +34,4 @@ if !(_activated) exitWith {};
[_logic, QGVAR(enableUnsconsiousnessAI), "enableUnsconsiousnessAI"] call EFUNC(common,readSettingFromModule);
[_logic, QGVAR(preventInstaDeath), "preventInstaDeath"] call EFUNC(common,readSettingFromModule);
[_logic, QGVAR(bleedingCoefficient), "bleedingCoefficient"] call EFUNC(common,readSettingFromModule);
[_logic, QGVAR(keepLocalSettingsSynced), "keepLocalSettingsSynced"] call EFUNC(common,readSettingFromModule);

View File

@ -26,7 +26,6 @@ _unit setvariable [QGVAR(heartRate), 0];
[_unit, true] call FUNC(setUnconscious);
_timeInCardiacArrest = 120 + round(random(600));
systemChat format["Unit went cardiac arrest; hr: %1", _unit getvariable [QGVAR(heartRate), -1]];
[{
private ["_args","_unit","_startTime","_timeInCardiacArrest","_heartRate"];
_args = _this select 0;
@ -36,7 +35,6 @@ systemChat format["Unit went cardiac arrest; hr: %1", _unit getvariable [QGVAR(h
_heartRate = _unit getvariable [QGVAR(heartRate), 0];
if (_heartRate > 0 || !alive _unit) exitwith {
systemChat format["Unit no longer cardiac arrest; hr: %1", _unit getvariable [QGVAR(heartRate), -1]];
[(_this select 1)] call cba_fnc_removePerFrameHandler;
_unit setvariable [QGVAR(inCardiacArrest), nil,true];
};

View File

@ -10,7 +10,7 @@
* Return Value:
* Succesful treatment started <BOOL>
*
* Public: Yes
* Public: No
*/
#include "script_component.hpp"
@ -82,18 +82,17 @@ if (_effectivenessFound == -1) exitwith {}; // Seems everything is patched up on
// TODO refactor this part
// Find the impact this bandage has and reduce the amount this injury is present
_impact = if ((_mostEffectiveInjury select 3) >= _effectivenessFound) then {_effectivenessFound} else { (_mostEffectiveInjury select 3) };
_mostEffectiveInjury set [ 3, ((_mostEffectiveInjury select 3) - _effectivenessFound) max 0];
_mostEffectiveInjury set [ 3, ((_mostEffectiveInjury select 3) - _impact) max 0];
_openWounds set [_mostEffectiveSpot, _mostEffectiveInjury];
_target setvariable [QGVAR(openWounds), _openWounds, !USE_WOUND_EVENT_SYNC];
if (USE_WOUND_EVENT_SYNC) then {
["medical_propagateWound", [_unit, _mostEffectiveInjury]] call EFUNC(common,globalEvent);
["medical_propagateWound", [_target, _mostEffectiveInjury]] call EFUNC(common,globalEvent);
};
// Handle the reopening of bandaged wounds
if (_impact > 0) then {
// TODO handle reopening of bandaged wounds
// [_target, _impact, _part,_highestSpot, _removeItem] call FUNC(handleBandageOpening);
if (_impact > 0 && {GVAR(enableAdvancedWounds)}) then {
[_target, _impact, _part, _mostEffectiveSpot, _mostEffectiveInjury, _bandage] call FUNC(handleBandageOpening);
};
// If all wounds have been bandaged, we will reset all damage to 0, so the unit is not showing any blood on the model anymore.

View File

@ -25,6 +25,7 @@ if (alive _target) exitwith {
// wounds and injuries
_target setvariable [QGVAR(openWounds), [], true];
_target setvariable [QGVAR(bandagedWounds), [], true];
_target setVariable [QGVAR(internalWounds), [], true];
// vitals

View File

@ -19,6 +19,9 @@ private ["_target", "_ivItem", "_config", "_volumeAdded", "_typeOf", "_varName"]
_target = _this select 0;
_ivItem = _this select 1;
_bloodVolume = _target getvariable [QGVAR(bloodVolume), 100];
if (_bloodVolume >= 100) exitwith {};
// Find the proper attributes for the used IV
_config = (configFile >> "ACE_Medical_Advanced" >> "Treatment" >> "IV");
_volumeAdded = getNumber (_config >> "volume");
@ -31,7 +34,7 @@ if (isClass (_config >> _className)) then {
};
_varName = format["ACE_Medical_IVVolume_%1",_typeOf];
_target setvariable [_varName, (_target getvariable [_varName, 0]) + _volumeAdded];
_target setvariable [_varName, (_target getvariable [_varName, 0]) + _volumeAdded, true];
if !(_varName in GVAR(IVBags)) then {
GVAR(IVBags) pushback _varName;

View File

@ -336,6 +336,9 @@
<French>Garot [CAT]</French>
<Polish>Opaska uciskowa [CAT]</Polish>
</Key>
<Key ID="STR_ACE_MEDICAL_receivingIvVolume">
<English>Receiving IV [%1ml]</English>
</Key>
</Container>
<Container name="CfgWeapons">
<Key ID="STR_ACE_MEDICAL_BANDAGE_BASIC_DISPLAY">