Fixed bandage config lookup

This commit is contained in:
ulteq 2016-12-14 18:04:56 +01:00
parent 5d3f97ace7
commit a2b964a993
6 changed files with 92 additions and 87 deletions

View File

@ -91,13 +91,13 @@ if (_show == 1) then {
private _allInjuryTexts = [];
{
_x params ["", "_woundClassID", "_bodyPartN", "_amountOf", "_bleeding"];
_x params ["", "_woundClassID", "_bodyPartN", "_amountOf", "_bleeding", "_damage", "_category"];
_selectionBloodLoss set [_bodyPartN, (_selectionBloodLoss select _bodyPartN) + (20 * (_bleeding * _amountOf))];
if (_selectionN == _bodyPartN) 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 {
private _className = (EGVAR(medical_damage,woundsData) select _woundClassID) select 6;
private _postfix = ["Minor", "Medium", "Large"] select (floor ((0 max _bleeding min 0.1) / 0.05));
private _postfix = ["Minor", "Medium", "Large"] select _category;
private _woundDescription = localize format [ELSTRING(medical_damage,%1_%2), _className, _postfix];
if (_amountOf >= 1) then {
_allInjuryTexts pushBack [format["%2x %1", _woundDescription, ceil _amountOf], [1,1,1,1]];
@ -109,12 +109,12 @@ if (_show == 1) then {
} forEach (_target getVariable [QEGVAR(medical,openWounds), []]);
{
_x params ["", "_woundClassID", "_bodyPartN", "_amountOf", "_bleeding"];
_x params ["", "_woundClassID", "_bodyPartN", "_amountOf", "_bleeding", "_damage", "_category"];
if (_selectionN == _bodyPartN) 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 {
private _className = (EGVAR(medical_damage,woundsData) select _woundClassID) select 6;
private _postfix = ["Minor", "Medium", "Large"] select (floor ((0 max _bleeding min 0.1) / 0.05));
private _postfix = ["Minor", "Medium", "Large"] select _category;
private _woundDescription = localize format [ELSTRING(medical_damage,%1_%2), _className, _postfix];
if (_amountOf >= 1) then {
_allInjuryTexts pushBack [format ["[B] %2x %1", _woundDescription, ceil _amountOf], [0.88,0.7,0.65,1]];
@ -126,12 +126,12 @@ if (_show == 1) then {
} forEach (_target getVariable [QEGVAR(medical,bandagedWounds), []]);
{
_x params ["", "_woundClassID", "_bodyPartN", "_amountOf", "_bleeding"];
_x params ["", "_woundClassID", "_bodyPartN", "_amountOf", "_bleeding", "_damage", "_category"];
if (_selectionN == _bodyPartN) 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 {
private _className = (EGVAR(medical_damage,woundsData) select _woundClassID) select 6;
private _postfix = ["Minor", "Medium", "Large"] select (floor ((0 max _bleeding min 0.1) / 0.05));
private _postfix = ["Minor", "Medium", "Large"] select _category;
private _woundDescription = localize format [ELSTRING(medical_damage,%1_%2), _className, _postfix];
if (_amountOf >= 1) then {
_allInjuryTexts pushBack [format ["[S] %2x %1", _woundDescription, ceil _amountOf], [0.7,0.7,0.7,1]];

View File

@ -52,9 +52,13 @@ private _bodyPartDamage = _unit getVariable [QEGVAR(medical,bodyPartDamage), [0,
private _painfullness = 0.05 + 0.95 * MATH_E ^ (-(random 30) / _nastinessLikelihood);
_bleeding = _bleeding * _bloodiness;
// wound category (minor, medium, large)
private _category = floor ((0 max _bleeding min 0.1) / 0.05);
_x set [4, _bleeding];
_x set [5, _damage];
_x set [6, _category];
private _pain = ((GVAR(woundsData) select _woundClassIDToAdd) select 3) * _painfullness;
_painLevel = _painLevel max _pain;
@ -76,11 +80,9 @@ private _bodyPartDamage = _unit getVariable [QEGVAR(medical,bodyPartDamage), [0,
// if possible merge into existing wounds
private _createNewWound = true;
{
_x params ["", "_classID", "_bodyPartN", "_oldAmountOf", "_oldBleeding", "_oldDamage"];
_x params ["", "_classID", "_bodyPartN", "_oldAmountOf", "_oldBleeding", "_oldDamage", "_oldCategory"];
if (_woundClassIDToAdd == _classID && {_bodyPartNToAdd == _bodyPartN && {(_damage < PENETRATION_THRESHOLD) isEqualTo (_oldDamage < PENETRATION_THRESHOLD)}}) then {
private _oldCategory = (floor ((0 max _oldBleeding min 0.1) / 0.05));
private _newCategory = (floor ((0 max _bleeding min 0.1) / 0.05));
if (_oldCategory == _newCategory) exitWith {
if (_oldCategory == _category) exitWith {
private _newAmountOf = _oldAmountOf + 1;
_x set [3, _newAmountOf];
private _newBleeding = (_oldAmountOf * _oldBleeding + _bleeding) / _newAmountOf;

View File

@ -101,8 +101,12 @@ private _woundsCreated = [];
_bleeding = _injuryBleedingRate * _bloodiness;
// wound category (minor, medium, large)
private _category = floor ((0 max _bleeding min 0.1) / 0.05);
_injury set [4, _bleeding];
_injury set [5, _damage];
_injury set [6, _category];
private _pain = _injuryPain * _painfullness;
_painLevel = _painLevel max _pain;
@ -124,11 +128,9 @@ private _woundsCreated = [];
// if possible merge into existing wounds
private _createNewWound = true;
{
_x params ["", "_classID", "_bodyPartN", "_oldAmountOf", "_oldBleeding", "_oldDamage"];
_x params ["", "_classID", "_bodyPartN", "_oldAmountOf", "_oldBleeding", "_oldDamage", "_oldCategory"];
if (_woundClassIDToAdd == _classID && {_bodyPartNToAdd == _bodyPartN && {(_damage < PENETRATION_THRESHOLD) isEqualTo (_oldDamage < PENETRATION_THRESHOLD)}}) then {
private _oldCategory = (floor ((0 max _oldBleeding min 0.1) / 0.05));
private _newCategory = (floor ((0 max _bleeding min 0.1) / 0.05));
if (_oldCategory == _newCategory) exitWith {
if (_oldCategory == _category) exitWith {
private _newAmountOf = _oldAmountOf + 1;
_x set [3, _newAmountOf];
private _newBleeding = (_oldAmountOf * _oldBleeding + _bleeding) / _newAmountOf;

View File

@ -69,13 +69,13 @@ private _selectionDamage = _target getVariable [QEGVAR(medical,bodyPartDamage),
private _allInjuryTexts = [];
{
_x params ["", "_woundClassID", "_bodyPartN", "_amountOf", "_bleeding"];
_x params ["", "_woundClassID", "_bodyPartN", "_amountOf", "_bleeding", "_damage", "_category"];
_selectionBloodLoss set [_bodyPartN, (_selectionBloodLoss select _bodyPartN) + (20 * (_bleeding * _amountOf))];
if (_selectionN == _bodyPartN) 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 {
private _className = (EGVAR(medical_damage,woundsData) select _woundClassID) select 6;
private _postfix = ["Minor", "Medium", "Large"] select (floor ((0 max _bleeding min 0.1) / 0.05));
private _postfix = ["Minor", "Medium", "Large"] select _category;
private _woundDescription = localize format [ELSTRING(medical_damage,%1_%2), _className, _postfix];
if (_amountOf >= 1) then {
_allInjuryTexts pushBack [format["%2x %1", _woundDescription, ceil _amountOf], [1,1,1,1]];
@ -87,12 +87,12 @@ private _allInjuryTexts = [];
} forEach (_target getVariable [QEGVAR(medical,openWounds), []]);
{
_x params ["", "_woundClassID", "_bodyPartN", "_amountOf", "_bleeding"];
_x params ["", "_woundClassID", "_bodyPartN", "_amountOf", "_bleeding", "_damage", "_category"];
if (_selectionN == _bodyPartN) 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 {
private _className = (EGVAR(medical_damage,woundsData) select _woundClassID) select 6;
private _postfix = ["Minor", "Medium", "Large"] select (floor ((0 max _bleeding min 0.1) / 0.05));
private _postfix = ["Minor", "Medium", "Large"] select _category;
private _woundDescription = localize format [ELSTRING(medical_damage,%1_%2), _className, _postfix];
if (_amountOf >= 1) then {
_allInjuryTexts pushBack [format ["[B] %2x %1", _woundDescription, ceil _amountOf], [0.88,0.7,0.65,1]];
@ -104,12 +104,12 @@ private _allInjuryTexts = [];
} forEach (_target getVariable [QEGVAR(medical,bandagedWounds), []]);
{
_x params ["", "_woundClassID", "_bodyPartN", "_amountOf", "_bleeding"];
_x params ["", "_woundClassID", "_bodyPartN", "_amountOf", "_bleeding", "_damage", "_category"];
if (_selectionN == _bodyPartN) 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 {
private _className = (EGVAR(medical_damage,woundsData) select _woundClassID) select 6;
private _postfix = ["Minor", "Medium", "Large"] select (floor ((0 max _bleeding min 0.1) / 0.05));
private _postfix = ["Minor", "Medium", "Large"] select _category;
private _woundDescription = localize format [ELSTRING(medical_damage,%1_%2), _className, _postfix];
if (_amountOf >= 1) then {
_allInjuryTexts pushBack [format ["[S] %2x %1", _woundDescription, ceil _amountOf], [0.7,0.7,0.7,1]];

View File

@ -5,7 +5,7 @@ class ADDON {
// packing bandage is average treatment, higher reopen change, longer reopening delay
// elastic bandage is higher treatment, higher reopen change, shorter reopen delay
// quickclot is lower treatment, lower reopen change, longer reopening delay
class BasicBandage { // basic bandage
class BasicBandage {
effectiveness = 5;
reopeningChance = 0;
reopeningMinDelay = 0;
@ -38,19 +38,19 @@ class ADDON {
reopeningChance = 0.9;
};
class Avulsions: Abrasion {
class Avulsion: Abrasion {
effectiveness = 1;
reopeningChance = 0.5;
reopeningMinDelay = 120;
reopeningMaxDelay = 200;
};
class AvulsionsMinor: Avulsions {
class AvulsionMinor: Avulsion {
effectiveness = 1;
};
class AvulsionsMedium: Avulsions {
class AvulsionMedium: Avulsion {
effectiveness = 0.9;
};
class AvulsionsLarge: Avulsions {
class AvulsionLarge: Avulsion {
effectiveness = 0.75;
};
@ -64,21 +64,21 @@ class ADDON {
class ContusionMedium: Contusion {};
class ContusionLarge: Contusion {};
class CrushWound: Abrasion {
class Crush: Abrasion {
effectiveness = 1;
reopeningChance = 0.2;
reopeningMinDelay = 20;
reopeningMaxDelay = 1000;
};
class CrushWoundMinor: CrushWound {
class CrushMinor: Crush {
effectiveness = 1;
reopeningChance = 0.2;
};
class CrushWoundMedium: CrushWound {
class CrushMedium: Crush {
effectiveness = 0.7;
reopeningChance = 0.3;
};
class CrushWoundLarge: CrushWound {
class CrushLarge: Crush {
effectiveness = 0.6;
reopeningChance = 0.4;
};
@ -121,35 +121,35 @@ class ADDON {
reopeningChance = 0.6;
};
class velocityWound: Abrasion {
class VelocityWound: Abrasion {
effectiveness = 2;
reopeningChance = 0.7;
reopeningMinDelay = 100;
reopeningMaxDelay = 500;
};
class velocityWoundMinor: velocityWound {
class VelocityWoundMinor: VelocityWound {
effectiveness = 2;
};
class velocityWoundMedium: velocityWound {
class VelocityWoundMedium: VelocityWound {
effectiveness = 1.5;
};
class velocityWoundLarge: velocityWound {
class VelocityWoundLarge: VelocityWound {
effectiveness = 1;
};
class punctureWound: Abrasion {
class PunctureWound: Abrasion {
effectiveness = 2;
reopeningChance = 0.5;
reopeningMinDelay = 200;
reopeningMaxDelay = 850;
};
class punctureWoundMinor: punctureWound {
class PunctureWoundMinor: PunctureWound {
effectiveness = 2;
};
class punctureWoundMedium: punctureWound {
class PunctureWoundMedium: PunctureWound {
effectiveness = 1.3;
};
class punctureWoundLarge: punctureWound {
class PunctureWoundLarge: PunctureWound {
effectiveness = 0.9;
};
};
@ -173,19 +173,19 @@ class ADDON {
reopeningChance = 1;
};
class Avulsions: Abrasion {
class Avulsion: Abrasion {
effectiveness = 1;
reopeningChance = 0.7;
reopeningMinDelay = 1000;
reopeningMaxDelay = 1600;
};
class AvulsionsMinor: Avulsions {
class AvulsionMinor: Avulsion {
effectiveness = 1;
};
class AvulsionsMedium: Avulsions {
class AvulsionMedium: Avulsion {
effectiveness = 0.9;
};
class AvulsionsLarge: Avulsions {
class AvulsionLarge: Avulsion {
effectiveness = 0.75;
};
@ -199,21 +199,21 @@ class ADDON {
class ContusionMedium: Contusion {};
class ContusionLarge: Contusion {};
class CrushWound: Abrasion {
class Crush: Abrasion {
effectiveness = 1;
reopeningChance = 0.5;
reopeningMinDelay = 600;
reopeningMaxDelay = 1000;
};
class CrushWoundMinor: CrushWound {
class CrushMinor: Crush {
effectiveness = 1;
reopeningChance = 0.6;
};
class CrushWoundMedium: CrushWound {
class CrushMedium: Crush {
effectiveness = 0.7;
reopeningChance = 0.7;
};
class CrushWoundLarge: CrushWound {
class CrushLarge: Crush {
effectiveness = 0.6;
reopeningChance = 0.8;
};
@ -256,35 +256,35 @@ class ADDON {
reopeningChance = 0.9;
};
class velocityWound: Abrasion {
class VelocityWound: Abrasion {
effectiveness = 2;
reopeningChance = 1;
reopeningMinDelay = 800;
reopeningMaxDelay = 2000;
};
class velocityWoundMinor: velocityWound {
class VelocityWoundMinor: VelocityWound {
effectiveness = 2;
};
class velocityWoundMedium: velocityWound {
class VelocityWoundMedium: VelocityWound {
effectiveness = 1.5;
};
class velocityWoundLarge: velocityWound {
class VelocityWoundLarge: VelocityWound {
effectiveness = 1;
};
class punctureWound: Abrasion {
class PunctureWound: Abrasion {
effectiveness = 2;
reopeningChance = 1;
reopeningMinDelay = 1000;
reopeningMaxDelay = 3000;
};
class punctureWoundMinor: punctureWound {
class PunctureWoundMinor: PunctureWound {
effectiveness = 2;
};
class punctureWoundMedium: punctureWound {
class PunctureWoundMedium: PunctureWound {
effectiveness = 1.3;
};
class punctureWoundLarge: punctureWound {
class PunctureWoundLarge: PunctureWound {
effectiveness = 0.9;
};
};
@ -308,19 +308,19 @@ class ADDON {
reopeningChance = 1;
};
class Avulsions: Abrasion {
class Avulsion: Abrasion {
effectiveness = 2;
reopeningChance = 0.7;
reopeningMinDelay = 100;
reopeningMaxDelay = 160;
};
class AvulsionsMinor: Avulsions {
class AvulsionMinor: Avulsion {
effectiveness = 2;
};
class AvulsionsMedium: Avulsions {
class AvulsionMedium: Avulsion {
effectiveness = 1.4;
};
class AvulsionsLarge: Avulsions {
class AvulsionLarge: Avulsion {
effectiveness = 1;
};
@ -334,21 +334,21 @@ class ADDON {
class ContusionMedium: Contusion {};
class ContusionLarge: Contusion {};
class CrushWound: Abrasion {
class Crush: Abrasion {
effectiveness = 2;
reopeningChance = 0.5;
reopeningMinDelay = 60;
reopeningMaxDelay = 100;
};
class CrushWoundMinor: CrushWound {
class CrushMinor: Crush {
effectiveness = 2;
reopeningChance = 0.6;
};
class CrushWoundMedium: CrushWound {
class CrushMedium: Crush {
effectiveness = 1.7;
reopeningChance = 0.7;
};
class CrushWoundLarge: CrushWound {
class CrushLarge: Crush {
effectiveness = 1.6;
reopeningChance = 0.8;
};
@ -391,35 +391,35 @@ class ADDON {
reopeningChance = 0.9;
};
class velocityWound: Abrasion {
class VelocityWound: Abrasion {
effectiveness = 2.2;
reopeningChance = 1;
reopeningMinDelay = 80;
reopeningMaxDelay = 200;
};
class velocityWoundMinor: velocityWound {
class VelocityWoundMinor: VelocityWound {
effectiveness = 2.2;
};
class velocityWoundMedium: velocityWound {
class VelocityWoundMedium: VelocityWound {
effectiveness = 1.75;
};
class velocityWoundLarge: velocityWound {
class VelocityWoundLarge: VelocityWound {
effectiveness = 1.5;
};
class punctureWound: Abrasion {
class PunctureWound: Abrasion {
effectiveness = 2.5;
reopeningChance = 1;
reopeningMinDelay = 100;
reopeningMaxDelay = 300;
};
class punctureWoundMinor: punctureWound {
class PunctureWoundMinor: PunctureWound {
effectiveness = 2.5;
};
class punctureWoundMedium: punctureWound {
class PunctureWoundMedium: PunctureWound {
effectiveness = 2;
};
class punctureWoundLarge: punctureWound {
class PunctureWoundLarge: PunctureWound {
effectiveness = 1.5;
};
};
@ -443,19 +443,19 @@ class ADDON {
reopeningChance = 5;
};
class Avulsions: Abrasion {
class Avulsion: Abrasion {
effectiveness = 0.7;
reopeningChance = 0.2;
reopeningMinDelay = 1000;
reopeningMaxDelay = 1600;
};
class AvulsionsMinor: Avulsions {
class AvulsionMinor: Avulsion {
effectiveness = 0.7;
};
class AvulsionsMedium: Avulsions {
class AvulsionMedium: Avulsion {
effectiveness = 0.65;
};
class AvulsionsLarge: Avulsions {
class AvulsionLarge: Avulsion {
effectiveness = 0.5;
};
@ -469,20 +469,20 @@ class ADDON {
class ContusionMedium: Contusion {};
class ContusionLarge: Contusion {};
class CrushWound: Abrasion {
class Crush: Abrasion {
effectiveness = 0.6;
reopeningChance = 0.5;
reopeningMinDelay = 600;
reopeningMaxDelay = 1000;
};
class CrushWoundMinor: CrushWound {
class CrushMinor: Crush {
effectiveness = 0.6;
reopeningChance = 0.3;
};
class CrushWoundMedium: CrushWound {
class CrushMedium: Crush {
effectiveness = 0.5;
};
class CrushWoundLarge: CrushWound {
class CrushLarge: Crush {
effectiveness = 0.4;
};
@ -520,35 +520,35 @@ class ADDON {
effectiveness = 0.5;
};
class velocityWound: Abrasion {
class VelocityWound: Abrasion {
effectiveness = 1;
reopeningChance = 0.5;
reopeningMinDelay = 800;
reopeningMaxDelay = 2000;
};
class velocityWoundMinor: velocityWound {
class VelocityWoundMinor: VelocityWound {
effectiveness = 1;
};
class velocityWoundMedium: velocityWound {
class VelocityWoundMedium: VelocityWound {
effectiveness = 0.75;
};
class velocityWoundLarge: velocityWound {
class VelocityWoundLarge: VelocityWound {
effectiveness = 0.5;
};
class punctureWound: Abrasion {
class PunctureWound: Abrasion {
effectiveness = 1;
reopeningChance = 0.5;
reopeningMinDelay = 1000;
reopeningMaxDelay = 3000;
};
class punctureWoundMinor: punctureWound {
class PunctureWoundMinor: PunctureWound {
effectiveness = 1;
};
class punctureWoundMedium: punctureWound {
class PunctureWoundMedium: PunctureWound {
effectiveness = 0.7;
};
class punctureWoundLarge: punctureWound {
class PunctureWoundLarge: PunctureWound {
effectiveness = 0.4;
};
};

View File

@ -42,7 +42,7 @@ private _mostEffectiveInjury = _openWounds select 0;
private _exit = false;
{
_x params ["", "_classID", "_partIndexN", "_amountOf", "_bleeding"];
_x params ["", "_classID", "_partIndexN", "_amountOf", "_bleeding", "_damage", "_category"];
TRACE_2("OPENWOUND: ", _target, _x);
// Only parse injuries that are for the selected bodypart.
@ -50,7 +50,8 @@ private _exit = false;
private _woundEffectiveness = _effectiveness;
// Select the classname from the wound classname storage
private _className = EGVAR(medical_damage,woundClassNames) select _classID;
private _postfix = ["Minor", "Medium", "Large"] select _category;
private _className = format ["%1%2", EGVAR(medical_damage,woundClassNames) select _classID, _postfix];
// Check if this wound type has attributes specified for the used bandage
if (isClass (_config >> _className)) then {