mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
Change wound data array
Drop unique id and merge classId and category
This commit is contained in:
parent
92d13fc930
commit
8da089d310
@ -82,24 +82,24 @@
|
||||
_return pushBack "------- Wounds: -------";
|
||||
private _wounds = _unit getVariable [QEGVAR(medical,openWounds), []];
|
||||
{
|
||||
_x params ["", "_xClassID", "_xBodyPartN", "_xAmountOf", "_xBleeding", "_xDamage", "_xCategory"];
|
||||
_return pushBack format ["%1: [%2-%3] [x%4] [Bld: %5] [Dmg: %6]", ALL_SELECTIONS select _xBodyPartN, _xClassID, _xCategory, _xAmountOf toFixed 1, _xBleeding toFixed 4, _xDamage toFixed 2];
|
||||
_x params ["_xClassID", "_xBodyPartN", "_xAmountOf", "_xBleeding", "_xDamage"];
|
||||
_return pushBack format ["%1: [%2] [x%3] [Bld: %4] [Dmg: %5]", ALL_SELECTIONS select _xBodyPartN, _xClassID, _xAmountOf toFixed 1, _xBleeding toFixed 4, _xDamage toFixed 2];
|
||||
} forEach _wounds;
|
||||
|
||||
// Bandaged Wounds:
|
||||
_return pushBack "------- Bandaged Wounds: -------";
|
||||
private _wounds = _unit getVariable [QEGVAR(medical,bandagedWounds), []];
|
||||
{
|
||||
_x params ["", "_xClassID", "_xBodyPartN", "_xAmountOf", "_xBleeding", "_xDamage", "_xCategory"];
|
||||
_return pushBack format ["%1: [%2-%3] [x%4] [Bld: %5] [Dmg: %6]", ALL_SELECTIONS select _xBodyPartN, _xClassID, _xCategory, _xAmountOf toFixed 1, _xBleeding toFixed 4, _xDamage toFixed 2];
|
||||
_x params ["_xClassID", "_xBodyPartN", "_xAmountOf", "_xBleeding", "_xDamage"];
|
||||
_return pushBack format ["%1: [%2] [x%3] [Bld: %4] [Dmg: %5]", ALL_SELECTIONS select _xBodyPartN, _xClassID, _xAmountOf toFixed 1, _xBleeding toFixed 4, _xDamage toFixed 2];
|
||||
} forEach _wounds;
|
||||
|
||||
// Stitched Wounds:
|
||||
_return pushBack "------- Stitched Wounds: -------";
|
||||
private _wounds = _unit getVariable [QEGVAR(medical,stitchedWounds), []];
|
||||
{
|
||||
_x params ["", "_xClassID", "_xBodyPartN", "_xAmountOf", "_xBleeding", "_xDamage", "_xCategory"];
|
||||
_return pushBack format ["%1: [%2-%3] [x%4] [Bld: %5] [Dmg: %6]", ALL_SELECTIONS select _xBodyPartN, _xClassID, _xCategory, _xAmountOf toFixed 1, _xBleeding toFixed 4, _xDamage toFixed 2];
|
||||
_x params ["_xClassID", "_xBodyPartN", "_xAmountOf", "_xBleeding", "_xDamage"];
|
||||
_return pushBack format ["%1: [%2] [x%3] [Bld: %4] [Dmg: %5]", ALL_SELECTIONS select _xBodyPartN, _xClassID, _xAmountOf toFixed 1, _xBleeding toFixed 4, _xDamage toFixed 2];
|
||||
} forEach _wounds;
|
||||
|
||||
// IVs:
|
||||
|
@ -17,11 +17,13 @@ addMissionEventHandler ["Loaded",{
|
||||
}];
|
||||
|
||||
// decide which woundsHandler to use by whether the extension is present or not
|
||||
if ("ace_medical" callExtension "version" != "") then {
|
||||
DFUNC(woundsHandlerActive) = LINKFUNC(woundsHandler);
|
||||
} else {
|
||||
// if ("ace_medical" callExtension "version" != "") then {
|
||||
|
||||
// DFUNC(woundsHandlerActive) = LINKFUNC(woundsHandler);
|
||||
// } else {
|
||||
INFO("Using woundsHandlerSQF");
|
||||
DFUNC(woundsHandlerActive) = LINKFUNC(woundsHandlerSQF);
|
||||
};
|
||||
// };
|
||||
|
||||
[QEGVAR(medical,woundReceived), {
|
||||
params ["_unit", "_woundedHitPoint", "_receivedDamage", "", "_ammo"];
|
||||
|
@ -24,7 +24,7 @@ _bodyPartDamage params ["_headDamage", "_bodyDamage", "_leftArmDamage", "_rightA
|
||||
|
||||
// Exclude non penetrating body damage
|
||||
{
|
||||
_x params ["", "", "_bodyPartN", "_amountOf", "", "_damage"];
|
||||
_x params ["", "_bodyPartN", "_amountOf", "", "_damage"];
|
||||
if (_bodyPartN == 1 && {_damage < PENETRATION_THRESHOLD}) then {
|
||||
_bodyDamage = _bodyDamage - (_amountOf * _damage);
|
||||
};
|
||||
|
@ -35,16 +35,16 @@ private _classID = 0;
|
||||
private _maxDamage = GET_NUMBER(_entry >> "maxDamage",-1);
|
||||
private _causes = GET_ARRAY(_entry >> "causes",[]);
|
||||
private _causeLimping = GET_NUMBER(_entry >> "causeLimping",0);
|
||||
private _causeFracture = GET_NUMBER(_entry >> "causeFracture",0);
|
||||
|
||||
if !(_causes isEqualTo []) then {
|
||||
GVAR(woundClassNames) pushBack _className;
|
||||
GVAR(woundsData) pushBack [_classID, _selections, _bleeding, _pain, [_minDamage, _maxDamage], _causes, _className, _causeLimping];
|
||||
GVAR(woundsData) pushBack [_classID, _selections, _bleeding, _pain, [_minDamage, _maxDamage], _causes, _className, _causeLimping, _causeFracture];
|
||||
_classID = _classID + 1;
|
||||
};
|
||||
} forEach configProperties [_woundsConfig, "isClass _x"];
|
||||
|
||||
// --- parse damage types
|
||||
GVAR(allDamageTypes) = []; // @todo, currently unused by handle damage (was GVAR(allAvailableDamageTypes))
|
||||
GVAR(allDamageTypesData) = [] call CBA_fnc_createNamespace;
|
||||
|
||||
// minimum lethal damage collection, mapped to damageTypes
|
||||
@ -57,8 +57,6 @@ private _selectionSpecificDefault = getNumber (_damageTypesConfig >> "selectionS
|
||||
private _entry = _x;
|
||||
private _className = configName _entry;
|
||||
|
||||
GVAR(allDamageTypes) pushBack _className;
|
||||
|
||||
// Check if this type is in the causes of a wound class, if so, we will store the wound types for this damage type
|
||||
private _woundTypes = [];
|
||||
{
|
||||
|
@ -18,6 +18,8 @@
|
||||
* Public: No
|
||||
*/
|
||||
|
||||
WARNING("this function needs to be updated for changes to woundsHandlerSQF");
|
||||
|
||||
params ["_unit", "_bodyPart", "_damage", "_typeOfDamage"];
|
||||
TRACE_5("start",_unit,_bodyPart,_damage,_typeOfDamage);
|
||||
|
||||
|
@ -19,17 +19,14 @@
|
||||
*/
|
||||
|
||||
params ["_unit", "_bodyPart", "_damage", "_typeOfDamage"];
|
||||
TRACE_4("start",_unit,_bodyPart,_damage,_typeOfDamage);
|
||||
TRACE_4("woundsHandlerSQF",_unit,_bodyPart,_damage,_typeOfDamage);
|
||||
|
||||
// Convert the selectionName to a number and ensure it is a valid selection.
|
||||
private _bodyPartN = ALL_BODY_PARTS find toLower _bodyPart;
|
||||
if (_bodyPartN < 0) exitWith {};
|
||||
if (_bodyPartN < 0) exitWith { ERROR_1("invalid body part %1",_bodyPart); };
|
||||
|
||||
if (_typeOfDamage isEqualTo "") then {
|
||||
_typeOfDamage = "unknown";
|
||||
};
|
||||
|
||||
if (isNil {GVAR(allDamageTypesData) getVariable _typeOfDamage} ) then {
|
||||
if ((_typeOfDamage isEqualTo "") || {isNil {GVAR(allDamageTypesData) getVariable _typeOfDamage}}) then {
|
||||
WARNING_1("damage type [%1] not found",_typeOfDamage);
|
||||
_typeOfDamage = "unknown";
|
||||
};
|
||||
|
||||
@ -65,11 +62,10 @@ private _allPossibleInjuries = [];
|
||||
} forEach _woundTypes;
|
||||
|
||||
// No possible wounds available for this damage type or damage amount.
|
||||
if (_highestPossibleSpot < 0) exitWith {};
|
||||
if (_highestPossibleSpot < 0) exitWith { TRACE_2("no wounds possible",_damage,_highestPossibleSpot); };
|
||||
|
||||
// Administration for open wounds and ids
|
||||
private _openWounds = _unit getVariable [QEGVAR(medical,openWounds), []];
|
||||
private _woundID = _unit getVariable [QEGVAR(medical,lastUniqueWoundID), 1]; // Unique wound ids are not used anywhere: ToDo Remove from openWounds array
|
||||
|
||||
private _painLevel = 0;
|
||||
private _critialDamage = false;
|
||||
@ -88,15 +84,13 @@ private _woundsCreated = [];
|
||||
selectRandom _allPossibleInjuries
|
||||
};
|
||||
|
||||
_oldInjury params ["_woundClassIDToAdd", "", "_injuryBleedingRate", "_injuryPain"];
|
||||
_oldInjury params ["_woundClassIDToAdd", "", "_injuryBleedingRate", "_injuryPain", "", "", "", "_causeLimping", "_causeFracture"];
|
||||
|
||||
private _bodyPartNToAdd = [floor random 6, _bodyPartN] select _isSelectionSpecific; // 6 == count ALL_BODY_PARTS
|
||||
|
||||
_bodyPartDamage set [_bodyPartNToAdd, (_bodyPartDamage select _bodyPartNToAdd) + _woundDamage];
|
||||
_bodyPartVisParams set [[1,2,3,3,4,4] select _bodyPartNToAdd, true]; // Mark the body part index needs updating
|
||||
|
||||
// Create a new injury. Format [ID, classID, bodypart, percentage treated, bleeding rate]
|
||||
private _injury = [_woundID, _woundClassIDToAdd, _bodyPartNToAdd, 1, _injuryBleedingRate];
|
||||
|
||||
// The higher the nastiness likelihood the higher the change to get a painful and bloody wound
|
||||
private _nastinessLikelihood = linearConversion [0, 20, (_woundDamage / _thresholdWoundCount), 0.5, 30, true];
|
||||
@ -110,12 +104,10 @@ private _woundsCreated = [];
|
||||
// wound category (minor [0..0.5], medium[0.5..1.0], large[1.0+])
|
||||
private _category = floor linearConversion [0, 1, _bleedingModifier, 0, 2, true];
|
||||
|
||||
// wound category (minor, medium, large)
|
||||
private _category = floor ((0 max _bleeding min 0.1) / 0.05);
|
||||
private _classComplex = _woundClassIDToAdd + 0.1 * _category;
|
||||
|
||||
_injury set [4, _bleeding];
|
||||
_injury set [5, _woundDamage];
|
||||
_injury set [6, _category];
|
||||
// Create a new injury. Format [0:classComplex, 1:bodypart, 2:amountOf, 3:bleedingRate, 4:woundDamage]
|
||||
private _injury = [_classComplex, _bodyPartNToAdd, 1, _bleeding, _woundDamage];
|
||||
|
||||
if (_bodyPartNToAdd == 0 || {_bodyPartNToAdd == 1 && {_woundDamage > PENETRATION_THRESHOLD}}) then {
|
||||
_critialDamage = true;
|
||||
@ -127,12 +119,12 @@ private _woundsCreated = [];
|
||||
// Emulate damage to vital organs
|
||||
switch (true) do {
|
||||
// Fatal damage to the head is guaranteed death
|
||||
case (_bodyPartNToAdd == 0 && {_woundDamage >= HEAD_DAMAGE_THRESHOLD}): {
|
||||
case (_bodyPartNToAdd == 0 && {_woundDamage >= HEAD_DAMAGE_THRESHOLD}): {
|
||||
TRACE_1("lethal headshot",_woundDamage toFixed 2);
|
||||
[QEGVAR(medical,FatalInjury), _unit] call CBA_fnc_localEvent;
|
||||
};
|
||||
// Fatal damage to torso has various results based on organ hit
|
||||
case (_bodyPartNToAdd == 1 && {_woundDamage >= ORGAN_DAMAGE_THRESHOLD}): {
|
||||
case (_bodyPartNToAdd == 1 && {_woundDamage >= ORGAN_DAMAGE_THRESHOLD}): {
|
||||
// Heart shot is lethal
|
||||
if (random 1 < HEART_HIT_CHANCE) then {
|
||||
TRACE_1("lethal heartshot",_woundDamage toFixed 2);
|
||||
@ -142,7 +134,6 @@ private _woundsCreated = [];
|
||||
};
|
||||
|
||||
// todo `forceWalk` based on leg damage
|
||||
private _causeLimping = (GVAR(woundsData) select _woundClassIDToAdd) select 7;
|
||||
if (_causeLimping == 1 && {_woundDamage > LIMPING_DAMAGE_THRESHOLD} && {_bodyPartNToAdd > 3}) then {
|
||||
[_unit, true] call EFUNC(medical_engine,setLimping);
|
||||
};
|
||||
@ -150,27 +141,28 @@ private _woundsCreated = [];
|
||||
// if possible merge into existing wounds
|
||||
private _createNewWound = true;
|
||||
{
|
||||
_x params ["", "_classID", "_bodyPartN", "_oldAmountOf", "_oldBleeding", "_oldDamage", "_oldCategory"];
|
||||
if (_woundClassIDToAdd == _classID && {_bodyPartNToAdd == _bodyPartN && {(_woundDamage < PENETRATION_THRESHOLD) isEqualTo (_oldDamage < PENETRATION_THRESHOLD)}}) then {
|
||||
if (_oldCategory == _category) exitWith {
|
||||
private _newAmountOf = _oldAmountOf + 1;
|
||||
_x set [3, _newAmountOf];
|
||||
private _newBleeding = (_oldAmountOf * _oldBleeding + _bleeding) / _newAmountOf;
|
||||
_x set [4, _newBleeding];
|
||||
private _newDamage = (_oldAmountOf * _oldDamage + _woundDamage) / _newAmountOf;
|
||||
_x set [5, _newDamage];
|
||||
_createNewWound = false;
|
||||
};
|
||||
_x params ["_classID", "_bodyPartN", "_oldAmountOf", "_oldBleeding", "_oldDamage"];
|
||||
if (
|
||||
(_classComplex == _classID) &&
|
||||
{_bodyPartNToAdd == _bodyPartN} &&
|
||||
{(_bodyPartNToAdd != 1) || {(_woundDamage < PENETRATION_THRESHOLD) isEqualTo (_oldDamage < PENETRATION_THRESHOLD)}} // penetrating body damage is handled differently
|
||||
) exitWith {
|
||||
TRACE_2("merging with existing wound",_forEachIndex,_x);
|
||||
private _newAmountOf = _oldAmountOf + 1;
|
||||
_x set [2, _newAmountOf];
|
||||
private _newBleeding = (_oldAmountOf * _oldBleeding + _bleeding) / _newAmountOf;
|
||||
_x set [3, _newBleeding];
|
||||
private _newDamage = (_oldAmountOf * _oldDamage + _woundDamage) / _newAmountOf;
|
||||
_x set [4, _newDamage];
|
||||
_createNewWound = false;
|
||||
};
|
||||
} forEach _openWounds;
|
||||
|
||||
if (_createNewWound) then {
|
||||
TRACE_1("adding new wound",_injury);
|
||||
_openWounds pushBack _injury;
|
||||
};
|
||||
|
||||
// New injuries will also increase the wound ID
|
||||
_woundID = _woundID + 1;
|
||||
|
||||
// Store the injury so we can process it later correctly.
|
||||
_woundsCreated pushBack _injury;
|
||||
};
|
||||
|
@ -78,8 +78,8 @@
|
||||
#define VISUAL_BODY_DAMAGE_THRESHOLD 0.35
|
||||
|
||||
// Empty wound data, used for some default return values
|
||||
// [ID, classID, bodypartIndex, amountOf, bloodloss, damage, category]
|
||||
#define EMPTY_WOUND [-1, -1, -1, 0, 0, 0, 0]
|
||||
// [classID, bodypartIndex, amountOf, bloodloss, damage]
|
||||
#define EMPTY_WOUND [-1, -1, 0, 0, 0]
|
||||
|
||||
// Base time to bandage each wound category
|
||||
#define BANDAGE_TIME_S 4
|
||||
|
@ -25,7 +25,7 @@ private _bloodLossOnBodyPart = 0;
|
||||
|
||||
// Add all bleeding from wounds on selection
|
||||
{
|
||||
_x params ["", "", "_bodyPartN", "_amountOf", "_bleeding"];
|
||||
_x params ["", "_bodyPartN", "_amountOf", "_bleeding"];
|
||||
|
||||
if (_bodyPartN == _partIndex) then {
|
||||
_bloodLossOnBodyPart = _bloodLossOnBodyPart + (_amountOf * _bleeding);
|
||||
|
@ -24,7 +24,7 @@ private _bodyPartDamage = _target getVariable [QEGVAR(medical,bodyPartDamage), [
|
||||
private _bodyPartBloodLoss = [0, 0, 0, 0, 0, 0];
|
||||
|
||||
{
|
||||
_x params ["", "", "_bodyPartN", "_amountOf", "_bleeding"];
|
||||
_x params ["", "_bodyPartN", "_amountOf", "_bleeding"];
|
||||
_bodyPartBloodLoss set [_bodyPartN, (_bodyPartBloodLoss select _bodyPartN) + (_bleeding * _amountOf)];
|
||||
} forEach (_target getVariable [QEGVAR(medical,openWounds), []]);
|
||||
|
||||
|
@ -93,7 +93,9 @@ if (_totalIvVolume >= 1) then {
|
||||
private _woundEntries = [];
|
||||
|
||||
private _fnc_getWoundDescription = {
|
||||
private _className = EGVAR(medical_damage,woundsData) select _woundClassID select 6;
|
||||
private _classIndex = floor _woundClassID;
|
||||
private _category = round (10 * (_woundClassID % 1));
|
||||
private _className = EGVAR(medical_damage,woundsData) select _classIndex select 6;
|
||||
private _suffix = ["Minor", "Medium", "Large"] select _category;
|
||||
private _woundName = localize format [ELSTRING(medical_damage,%1_%2), _className, _suffix];
|
||||
if (_amountOf >= 1) then {
|
||||
@ -104,7 +106,7 @@ private _fnc_getWoundDescription = {
|
||||
};
|
||||
|
||||
{
|
||||
_x params ["", "_woundClassID", "_bodyPartN", "_amountOf", "", "", "_category"];
|
||||
_x params ["_woundClassID", "_bodyPartN", "_amountOf"];
|
||||
if (_selectionN == _bodyPartN) then {
|
||||
if (_amountOf > 0) then {
|
||||
_woundEntries pushBack [call _fnc_getWoundDescription, [1, 1, 1, 1]];
|
||||
@ -117,14 +119,14 @@ private _fnc_getWoundDescription = {
|
||||
} forEach (_target getVariable [QEGVAR(medical,openWounds), []]);
|
||||
|
||||
{
|
||||
_x params ["", "_woundClassID", "_bodyPartN", "_amountOf", "", "", "_category"];
|
||||
_x params ["_woundClassID", "_bodyPartN", "_amountOf"];
|
||||
if (_selectionN == _bodyPartN && {_amountOf > 0}) then {
|
||||
_woundEntries pushBack [format ["[B] %1", call _fnc_getWoundDescription], [0.88, 0.7, 0.65, 1]];
|
||||
};
|
||||
} forEach (_target getVariable [QEGVAR(medical,bandagedWounds), []]);
|
||||
|
||||
{
|
||||
_x params ["", "_woundClassID", "_bodyPartN", "_amountOf", "", "", "_category"];
|
||||
_x params ["_woundClassID", "_bodyPartN", "_amountOf"];
|
||||
if (_selectionN == _bodyPartN && {_amountOf > 0}) then {
|
||||
_woundEntries pushBack [format ["[S] %1", call _fnc_getWoundDescription], [0.7, 0.7, 0.7, 1]];
|
||||
};
|
||||
|
@ -20,7 +20,7 @@ params ["_unit"];
|
||||
private _tourniquets = GET_TOURNIQUETS(_unit);
|
||||
private _bodyPartBleeding = [0,0,0,0,0,0];
|
||||
{
|
||||
_x params ["", "", "_bodyPart", "_amountOf", "_bleeeding"];
|
||||
_x params ["", "_bodyPart", "_amountOf", "_bleeeding"];
|
||||
if (_tourniquets select _bodyPart == 0) then {
|
||||
_bodyPartBleeding set [_bodyPart, (_bodyPartBleeding select _bodyPart) + (_amountOf * _bleeeding)];
|
||||
};
|
||||
|
@ -28,7 +28,7 @@ private _index = ALL_BODY_PARTS find toLower _bodypart;
|
||||
private _canBandage = false;
|
||||
|
||||
{
|
||||
_x params ["", "", "_bodyPartN", "_amountOf", "_bleeding"];
|
||||
_x params ["", "_bodyPartN", "_amountOf", "_bleeding"];
|
||||
|
||||
// If any single wound on the bodypart is bleeding bandaging can go ahead
|
||||
if (_bodyPartN == _index && {_amountOf * _bleeding > 0}) exitWith {
|
||||
|
@ -37,7 +37,10 @@ private _woundIndex = -1;
|
||||
private _effectivenessFound = -1;
|
||||
|
||||
{
|
||||
_x params ["", "_classID", "_partIndexN", "_amountOf", "_bleeding", "_damage", "_category"];
|
||||
_x params ["_classID", "_partIndexN", "_amountOf", "_bleeding", "_damage"];
|
||||
|
||||
private _classIndex = floor _classID;
|
||||
private _category = round (10 * (_classID % 1));
|
||||
|
||||
// Ignore wounds on other bodyparts
|
||||
if (_partIndexN == _partIndex) then {
|
||||
@ -45,7 +48,7 @@ private _effectivenessFound = -1;
|
||||
|
||||
// Select the classname from the wound classname storage
|
||||
private _suffix = ["Minor", "Medium", "Large"] select _category;
|
||||
private _className = format ["%1%2", EGVAR(medical_damage,woundClassNames) select _classID, _suffix];
|
||||
private _className = format ["%1%2", EGVAR(medical_damage,woundClassNames) select _classIndex, _suffix];
|
||||
|
||||
// Get the effectiveness of the bandage on this wound type
|
||||
if (isClass (_config >> _className)) then {
|
||||
|
@ -22,11 +22,13 @@ if (_partIndex < 0) exitWith { 0 };
|
||||
|
||||
private _targetWound = [_patient, _bandage, _partIndex] call FUNC(findMostEffectiveWound);
|
||||
_targetWound params ["_wound", "_woundIndex", "_effectiveness"];
|
||||
TRACE_3("findMostEffectiveWound",_wound,_woundIndex,_effectiveness);
|
||||
|
||||
// Everything is patched up on this body part already
|
||||
if (_wound isEqualTo EMPTY_WOUND) exitWith { 0 };
|
||||
|
||||
_wound params ["", "", "", "_amountOf", "_bloodloss", "_damage", "_category"];
|
||||
_wound params ["_classID", "", "_amountOf", "_bloodloss", "_damage"];
|
||||
private _category = round (10 * (_classID % 1));
|
||||
|
||||
// Base bandage time is based on wound size and remaining percentage
|
||||
private _bandageTime = ([
|
||||
|
@ -20,11 +20,12 @@
|
||||
params ["_target", "_impact", "_part", "_injuryIndex", "_injury", "_bandage"];
|
||||
TRACE_6("handleBandageOpening",_target,_impact,_part,_injuryIndex,_injury,_bandage);
|
||||
|
||||
private _classID = _injury select 1;
|
||||
private _bodyPartN = _injury select 2;
|
||||
private _category = _injury select 6;
|
||||
_injury params ["_classID", "_bodyPartN"];
|
||||
private _classIndex = floor _classID;
|
||||
private _category = round (10 * (_classID % 1));
|
||||
|
||||
private _postfix = ["Minor", "Medium", "Large"] select _category;
|
||||
private _className = format ["%1%2", EGVAR(medical_damage,woundClassNames) select _classID, _postfix];
|
||||
private _className = format ["%1%2", EGVAR(medical_damage,woundClassNames) select _classIndex, _postfix];
|
||||
|
||||
private _reopeningChance = DEFAULT_BANDAGE_REOPENING_CHANCE;
|
||||
private _reopeningMinDelay = DEFAULT_BANDAGE_REOPENING_MIN_DELAY;
|
||||
@ -64,17 +65,18 @@ TRACE_5("configs",_bandage,_className,_reopeningChance,_reopeningMinDelay,_reope
|
||||
private _bandagedWounds = _target getVariable [QEGVAR(medical,bandagedWounds), []];
|
||||
private _exist = false;
|
||||
{
|
||||
_x params ["", "_id", "_partN", "_amountOf", "", "", "_oldCategory"];
|
||||
if (_id == _classID && {_partN == _bodyPartN && {_oldCategory == _category}}) exitWith {
|
||||
_x set [3, _amountOf + _impact];
|
||||
_bandagedWounds set [_forEachIndex, _x];
|
||||
_x params ["_id", "_partN", "_amountOf"];
|
||||
if (_id == _classID && {_partN == _bodyPartN}) exitWith {
|
||||
_x set [2, _amountOf + _impact];
|
||||
TRACE_2("adding to existing bandagedWound",_id,_partN);
|
||||
_exist = true;
|
||||
};
|
||||
} forEach _bandagedWounds;
|
||||
|
||||
if (!_exist) then {
|
||||
TRACE_2("adding new bandagedWound",_classID,_bodyPartN);
|
||||
private _bandagedInjury = +_injury;
|
||||
_bandagedInjury set [3, _impact];
|
||||
_bandagedInjury set [2, _impact];
|
||||
_bandagedWounds pushBack _bandagedInjury;
|
||||
};
|
||||
|
||||
@ -96,25 +98,25 @@ if (random 1 <= _reopeningChance) then {
|
||||
private _openWounds = _target getVariable [QEGVAR(medical,openWounds), []];
|
||||
if (count _openWounds - 1 < _injuryIndex) exitWith { TRACE_2("index bounds",_injuryIndex,count _openWounds); };
|
||||
|
||||
_injury params ["", "_classID", "_bodyPartN", "", "", "", "_category"];
|
||||
_injury params ["_classID", "_bodyPartN"];
|
||||
|
||||
private _selectedInjury = _openWounds select _injuryIndex;
|
||||
if (_selectedInjury select 1 == _classID && {_selectedInjury select 2 == _bodyPartN}) then { // matching the IDs
|
||||
_selectedInjury params ["_selClassID", "_selBodyPart", "_selAmmount"];
|
||||
if ((_selClassID == _classID) && {_selBodyPart == _bodyPartN}) then { // matching the IDs
|
||||
private _bandagedWounds = _target getVariable [QEGVAR(medical,bandagedWounds), []];
|
||||
private _exist = false;
|
||||
{
|
||||
_x params ["", "_id", "_partN", "_amountOf", "", "", "_oldCategory"];
|
||||
if (_id == _classID && {_partN == _bodyPartN && {_oldCategory == _category}}) exitWith {
|
||||
_x set [3, 0 max (_amountOf - _impact)];
|
||||
_bandagedWounds set [_forEachIndex, _x];
|
||||
_x params ["_id", "_partN", "_amountOf"];
|
||||
if ((_id == _classID) && {_partN == _bodyPartN}) exitWith {
|
||||
TRACE_2("bandagedWound exists",_id,_classID);
|
||||
_x set [2, 0 max (_amountOf - _impact)];
|
||||
_exist = true;
|
||||
};
|
||||
} forEach _bandagedWounds;
|
||||
|
||||
if (_exist) then {
|
||||
TRACE_2("Reopening Wound",_bandagedWounds,_openWounds);
|
||||
_selectedInjury set [3, (_selectedInjury select 3) + _impact];
|
||||
_openWounds set [_injuryIndex, _selectedInjury];
|
||||
_selectedInjury set [2, _selAmmount + _impact];
|
||||
_target setVariable [QEGVAR(medical,bandagedWounds), _bandagedWounds, true];
|
||||
_target setVariable [QEGVAR(medical,openWounds), _openWounds, true];
|
||||
|
||||
|
@ -31,9 +31,9 @@ _targetWound params ["_wound", "_woundIndex", "_effectiveness"];
|
||||
if (_effectiveness == -1) exitWith {};
|
||||
|
||||
// Find the impact this bandage has and reduce the amount this injury is present
|
||||
private _amountOf = _wound select 3;
|
||||
private _amountOf = _wound select 2;
|
||||
private _impact = _effectiveness min _amountOf;
|
||||
_wound set [3, _amountOf - _impact];
|
||||
_wound set [2, _amountOf - _impact];
|
||||
_openWounds set [_woundIndex, _wound];
|
||||
|
||||
_target setVariable [QEGVAR(medical,openWounds), _openWounds, true];
|
||||
|
@ -26,7 +26,7 @@ private _bandagedWounds = _target getVariable [QEGVAR(medical,bandagedWounds), [
|
||||
private _stitchedWounds = _target getVariable [QEGVAR(medical,stitchedWounds), []];
|
||||
|
||||
//In case two people stitch up one patient and the last wound has already been closed we can stop already
|
||||
if (count _bandagedWounds == 0) exitWith { false };
|
||||
if (_bandagedWounds isEqualTo []) exitWith { false };
|
||||
|
||||
//Has enough time elapsed that we can close another wound?
|
||||
if (_totalTime - _elapsedTime <= (count _bandagedWounds - 1) * 5) then {
|
||||
|
@ -56,7 +56,7 @@ private _partIndex = (ALL_BODY_PARTS find toLower _bodyPart) max 0;
|
||||
private _openWounds = _target getVariable [QEGVAR(medical,openWounds), []];
|
||||
|
||||
{
|
||||
_x params ["", "", "_bodyPartN", "_amountOf", "_percentageOpen"];
|
||||
_x params ["", "_bodyPartN", "_amountOf", "_percentageOpen"];
|
||||
|
||||
if (_bodyPartN isEqualTo _partIndex) then {
|
||||
_bloodLossOnBodyPart = _bloodLossOnBodyPart + (_amountOf * _percentageOpen);
|
||||
|
Loading…
Reference in New Issue
Block a user