Merge pull request #2886 from acemod/bandageReopen

Add all wound types to bandage treatment configs
This commit is contained in:
Thomas Kooi 2015-11-28 20:32:13 +01:00
commit b807d1db48
3 changed files with 117 additions and 8 deletions

View File

@ -254,7 +254,7 @@ class ACE_Medical_Actions {
animationCaller = "AinvPknlMstpSnonWnonDnon_medic1";
};
class SalineIV_500: SalineIV {
displayName = CSTRING(Actions_Saline4_500);
displayName = CSTRING(Actions_Saline4_500);
items[] = {"ACE_salineIV_500"};
};
class SalineIV_250: SalineIV {
@ -670,7 +670,7 @@ class ACE_Medical_Advanced {
};
class Treatment {
class Bandaging {
class FieldDressing {
class FieldDressing {
// How effect is the bandage for treating one wounds type injury
effectiveness = 1;
// What is the chance and delays (in seconds) of the treated default injury reopening
@ -683,198 +683,296 @@ class ACE_Medical_Advanced {
reopeningMinDelay = 0;
reopeningMaxDelay = 0;
};
class AbrasionMinor: Abrasion {};
class AbrasionMedium: Abrasion {};
class AbrasionLarge: Abrasion {};
class Avulsions: Abrasion {
effectiveness = 0.3;
reopeningChance = 0.5;
reopeningMinDelay = 120;
reopeningMaxDelay = 200;
};
class AvulsionsMinor: Avulsions {};
class AvulsionsMedium: Avulsions {};
class AvulsionsLarge: Avulsions {};
class Contusion: Abrasion {
effectiveness = 1;
reopeningChance = 0;
reopeningMinDelay = 0;
reopeningMaxDelay = 0;
};
class ContusionMinor: Contusion {};
class ContusionMedium: Contusion {};
class ContusionLarge: Contusion {};
class CrushWound: Abrasion {
effectiveness = 0.6;
reopeningChance = 0.2;
reopeningMinDelay = 120;
reopeningMaxDelay = 200;
};
class CrushWoundMinor: CrushWound {};
class CrushWoundMedium: CrushWound {};
class CrushWoundLarge: CrushWound {};
class Cut: Abrasion {
effectiveness = 0.4;
reopeningChance = 0.5;
reopeningMinDelay = 220;
reopeningMaxDelay = 260;
};
class CutMinor: Cut {};
class CutMedium: Cut {};
class CutLarge: Cut {};
class Laceration: Abrasion {
effectiveness = 0.7;
reopeningChance = 0.3;
reopeningMinDelay = 120;
reopeningMaxDelay = 260;
};
class LacerationMinor: Laceration {};
class LacerationMedium: Laceration {};
class LacerationLarge: Laceration {};
class velocityWound: Abrasion {
effectiveness = 0.3;
reopeningChance = 0.8;
reopeningMinDelay = 20;
reopeningMaxDelay = 300;
};
class velocityWoundMinor: velocityWound {};
class velocityWoundMedium: velocityWound {};
class velocityWoundLarge: velocityWound {};
class punctureWound: Abrasion {
effectiveness = 0.5;
reopeningChance = 0.8;
reopeningMinDelay = 20;
reopeningMaxDelay = 300;
};
class punctureWoundMinor: punctureWound {};
class punctureWoundMedium: punctureWound {};
class punctureWoundLarge: punctureWound {};
};
class PackingBandage: fieldDressing {
class Abrasion {
class Abrasion {
effectiveness = 1;
reopeningChance = 0;
reopeningMinDelay = 0;
reopeningMaxDelay = 0;
};
class AbrasionMinor: Abrasion {};
class AbrasionMedium: Abrasion {};
class AbrasionLarge: Abrasion {};
class Avulsions: Abrasion {
effectiveness = 1;
reopeningChance = 0.3;
reopeningMinDelay = 120;
reopeningMaxDelay = 200;
};
class AvulsionsMinor: Avulsions {};
class AvulsionsMedium: Avulsions {};
class AvulsionsLarge: Avulsions {};
class Contusion: Abrasion {
effectiveness = 1;
reopeningChance = 0;
reopeningMinDelay = 0;
reopeningMaxDelay = 0;
};
class ContusionMinor: Contusion {};
class ContusionMedium: Contusion {};
class ContusionLarge: Contusion {};
class CrushWound: Abrasion {
effectiveness = 0.6;
reopeningChance = 0.2;
reopeningMinDelay = 120;
reopeningMaxDelay = 200;
};
class CrushWoundMinor: CrushWound {};
class CrushWoundMedium: CrushWound {};
class CrushWoundLarge: CrushWound {};
class Cut: Abrasion {
effectiveness = 0.2;
reopeningChance = 0.6;
reopeningMinDelay = 30;
reopeningMaxDelay = 260;
};
class CutMinor: Cut {};
class CutMedium: Cut {};
class CutLarge: Cut {};
class Laceration: Abrasion {
effectiveness = 0.3;
reopeningChance = 0.3;
reopeningMinDelay = 120;
reopeningMaxDelay = 260;
};
class LacerationMinor: Laceration {};
class LacerationMedium: Laceration {};
class LacerationLarge: Laceration {};
class velocityWound: Abrasion {
effectiveness = 1;
reopeningChance = 0.5;
reopeningMinDelay = 20;
reopeningMaxDelay = 300;
};
class velocityWoundMinor: velocityWound {};
class velocityWoundMedium: velocityWound {};
class velocityWoundLarge: velocityWound {};
class punctureWound: Abrasion {
effectiveness = 0.3;
reopeningChance = 0.5;
reopeningMinDelay = 20;
reopeningMaxDelay = 300;
};
class punctureWoundMinor: punctureWound {};
class punctureWoundMedium: punctureWound {};
class punctureWoundLarge: punctureWound {};
};
class ElasticBandage: fieldDressing {
class Abrasion {
class Abrasion {
effectiveness = 1;
reopeningChance = 0;
reopeningMinDelay = 0;
reopeningMaxDelay = 0;
};
class AbrasionMinor: Abrasion {};
class AbrasionMedium: Abrasion {};
class AbrasionLarge: Abrasion {};
class Avulsions: Abrasion {
effectiveness = 0.3;
reopeningChance = 0.4;
reopeningMinDelay = 120;
reopeningMaxDelay = 200;
};
class AvulsionsMinor: Avulsions {};
class AvulsionsMedium: Avulsions {};
class AvulsionsLarge: Avulsions {};
class Contusion: Abrasion {
effectiveness = 1;
reopeningChance = 0;
reopeningMinDelay = 0;
reopeningMaxDelay = 0;
};
class ContusionMinor: Contusion {};
class ContusionMedium: Contusion {};
class ContusionLarge: Contusion {};
class CrushWound: Abrasion {
effectiveness = 1;
reopeningChance = 0;
reopeningMinDelay = 0;
reopeningMaxDelay = 0;
};
class CrushWoundMinor: CrushWound {};
class CrushWoundMedium: CrushWound {};
class CrushWoundLarge: CrushWound {};
class Cut: Abrasion {
effectiveness = 1;
reopeningChance = 0.2;
reopeningMinDelay = 10;
reopeningMaxDelay = 400;
};
class CutMinor: Cut {};
class CutMedium: Cut {};
class CutLarge: Cut {};
class Laceration: Abrasion {
effectiveness = 1;
reopeningChance = 0.3;
reopeningMinDelay = 120;
reopeningMaxDelay = 260;
};
class LacerationMinor: Laceration {};
class LacerationMedium: Laceration {};
class LacerationLarge: Laceration {};
class velocityWound: Abrasion {
effectiveness = 0.5;
reopeningChance = 0.5;
reopeningMinDelay = 20;
reopeningMaxDelay = 300;
};
class velocityWoundMinor: velocityWound {};
class velocityWoundMedium: velocityWound {};
class velocityWoundLarge: velocityWound {};
class punctureWound: Abrasion {
effectiveness = 0.85;
reopeningChance = 0.5;
reopeningMinDelay = 20;
reopeningMaxDelay = 300;
};
class punctureWoundMinor: punctureWound {};
class punctureWoundMedium: punctureWound {};
class punctureWoundLarge: punctureWound {};
};
class QuikClot: fieldDressing {
class Abrasion {
class Abrasion {
effectiveness = 0.7;
reopeningChance = 0;
reopeningMinDelay = 0;
reopeningMaxDelay = 0;
};
class AbrasionMinor: Abrasion {};
class AbrasionMedium: Abrasion {};
class AbrasionLarge: Abrasion {};
class Avulsions: Abrasion {
effectiveness = 0.2;
reopeningChance = 0.1;
reopeningMinDelay = 300;
reopeningMaxDelay = 350;
};
class AvulsionsMinor: Avulsions {};
class AvulsionsMedium: Avulsions {};
class AvulsionsLarge: Avulsions {};
class Contusion: Abrasion {
effectiveness = 0.7;
reopeningChance = 0;
reopeningMinDelay = 0;
reopeningMaxDelay = 0;
};
class ContusionMinor: Contusion {};
class ContusionMedium: Contusion {};
class ContusionLarge: Contusion {};
class CrushWound: Abrasion {
effectiveness = 0.7;
reopeningChance = 0;
reopeningMinDelay = 0;
reopeningMaxDelay = 0;
};
class CrushWoundMinor: CrushWound {};
class CrushWoundMedium: CrushWound {};
class CrushWoundLarge: CrushWound {};
class Cut: Abrasion {
effectiveness = 0.7;
reopeningChance = 0.2;
reopeningMinDelay = 100;
reopeningMaxDelay = 400;
};
class CutMinor: Cut {};
class CutMedium: Cut {};
class CutLarge: Cut {};
class Laceration: Abrasion {
effectiveness = 0.7;
reopeningChance = 0;
reopeningMinDelay = 0;
reopeningMaxDelay = 0;
};
class LacerationMinor: Laceration {};
class LacerationMedium: Laceration {};
class LacerationLarge: Laceration {};
class velocityWound: Abrasion {
effectiveness = 0.7;
reopeningChance = 0.1;
reopeningMinDelay = 200;
reopeningMaxDelay = 300;
};
class velocityWoundMinor: velocityWound {};
class velocityWoundMedium: velocityWound {};
class velocityWoundLarge: velocityWound {};
class punctureWound: Abrasion {
effectiveness = 0.5;
reopeningChance = 0.1;
reopeningMinDelay = 200;
reopeningMaxDelay = 300;
};
class punctureWoundMinor: punctureWound {};
class punctureWoundMedium: punctureWound {};
class punctureWoundLarge: punctureWound {};
};
};

View File

@ -36,20 +36,25 @@ if (isClass (_config >> _bandage)) then {
_reopeningChance = getNumber (_config >> "reopeningChance");
_reopeningMinDelay = getNumber (_config >> "reopeningMinDelay");
_reopeningMaxDelay = getNumber (_config >> "reopeningMaxDelay") max _reopeningMinDelay;
} else {
ACE_LOGWARNING_2("No config for bandage [%1] config base [%2]", _bandage, _config);
};
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;
};
} else {
ACE_LOGWARNING_2("No config for wound type [%1] config base [%2]", _className, _config);
};
TRACE_5("configs",_bandage,_className,_reopeningChance,_reopeningMinDelay,_reopeningMaxDelay);
_bandagedWounds = _target getvariable [QGVAR(bandagedWounds), []];
_injuryType = _injury select 1;
@ -74,9 +79,11 @@ if !(_exist) then {
_target setvariable [QGVAR(bandagedWounds), _bandagedWounds, true];
TRACE_1("",_reopeningChance);
// Check if we are ever going to reopen this
if (random(1) <= _reopeningChance) then {
_delay = _reopeningMinDelay + random(_reopeningMaxDelay - _reopeningMinDelay);
TRACE_1("Will open",_delay);
[{
private ["_bandage", "_openWounds", "_selectedInjury","_bandagedWounds","_exist"];
params ["_target", "_impact", "_part", "_injuryIndex", "_injury"];
@ -102,11 +109,12 @@ if (random(1) <= _reopeningChance) then {
} foreach _bandagedWounds;
if (_exist) then {
TRACE_2("Reopening Wound",_bandagedWounds,_openWounds);
_target setvariable [QGVAR(bandagedWounds), _bandagedWounds, true];
_target setvariable [QGVAR(openWounds), _openWounds, true];
};
};
// Otherwise something went wrong, we we don't reopen them..
//};
}, [_target, _impact, _part, _injuryIndex, +_injury], _delay, 0] call EFUNC(common,waitAndExecute);
}, [_target, _impact, _part, _injuryIndex, +_injury], _delay] call EFUNC(common,waitAndExecute);
};

View File

@ -48,6 +48,7 @@ _exit = false;
// Select the classname from the wound classname storage
_className = GVAR(woundClassNames) select _classID;
// Check if this wound type has attributes specified for the used bandage
if (isClass (_config >> _className)) then {
// Collect the effectiveness from the used bandage for this wound type
@ -55,6 +56,8 @@ _exit = false;
if (isNumber (_woundTreatmentConfig >> "effectiveness")) then {
_woundEffectivenss = getNumber (_woundTreatmentConfig >> "effectiveness");
};
} else {
ACE_LOGWARNING_2("No config for wound type [%1] config base [%2]", _className, _config);
};
TRACE_2("Wound classes: ", _specificClass, _classID);