From 8e539bfb56dd73f1b5d7d309977efc0f016b4df8 Mon Sep 17 00:00:00 2001 From: Glowbal Date: Sun, 22 Feb 2015 09:27:01 +0100 Subject: [PATCH] Added ability to use subclasses for injuries. Allows for usage of minor, medium and large injury variants. --- addons/medical/ACE_Medical_Treatments.hpp | 74 ++++++++++++++++++- .../functions/fnc_parseConfigForInjuries.sqf | 21 ++++++ 2 files changed, 94 insertions(+), 1 deletion(-) diff --git a/addons/medical/ACE_Medical_Treatments.hpp b/addons/medical/ACE_Medical_Treatments.hpp index 11658844c7..fc4c39e236 100644 --- a/addons/medical/ACE_Medical_Treatments.hpp +++ b/addons/medical/ACE_Medical_Treatments.hpp @@ -54,10 +54,19 @@ class ACE_Medical_Advanced { class Abrasion { name = "Scrape"; selections[] = {"All"}; - bleedingRate = 0.01; + bleedingRate = 0.001; pain = 1; causes[] = {"falling", "ropeburn", "vehiclecrash"}; minDamage = 0.01; + class Minor { + minDamage = 0.01; + }; + class Medium { + minDamage = 0.2; + }; + class Large { + minDamage = 0.3; + }; }; // Occur when an entire structure or part of it is forcibly pulled away, such as the loss of a permanent tooth or an ear lobe. Explosions, gunshots, and animal bites may cause avulsions. @@ -68,6 +77,15 @@ class ACE_Medical_Advanced { pain = 1; causes[] = {"explosive", "vehiclecrash", "grenade", "shell", "bullet", "backblast", "bite"}; minDamage = 0.2; + class Minor { + minDamage = 0.2; + }; + class Medium { + minDamage = 0.3; + }; + class Large { + minDamage = 0.5; + }; }; // Also called bruises, these are the result of a forceful trauma that injures an internal structure without breaking the skin. Blows to the chest, abdomen, or head with a blunt instrument (e.g. a football or a fist) can cause contusions. @@ -78,6 +96,15 @@ class ACE_Medical_Advanced { pain = 1; causes[] = {"bullet", "backblast", "punch"}; minDamage = 0.01; + class Minor { + minDamage = 0.01; + }; + class Medium { + minDamage = 0.1; + }; + class Large { + minDamage = 0.3; + }; }; // Occur when a heavy object falls onto a person, splitting the skin and shattering or tearing underlying structures. @@ -88,6 +115,15 @@ class ACE_Medical_Advanced { pain = 1; causes[] = {"falling", "vehiclecrash", "punch"}; minDamage = 0.1; + class Minor { + minDamage = 0.1; + }; + class Medium { + minDamage = 0.4; + }; + class Large { + minDamage = 0.6; + }; }; // Slicing wounds made with a sharp instrument, leaving even edges. They may be as minimal as a paper cut or as significant as a surgical incision. @@ -98,6 +134,15 @@ class ACE_Medical_Advanced { pain = 1; causes[] = {"vehiclecrash", "grenade", "explosive", "shell", "backblast", "stab"}; minDamage = 0.1; + class Minor { + minDamage = 0.1; + }; + class Medium { + minDamage = 0.3; + }; + class Large { + minDamage = 0.65; + }; }; // Also called tears, these are separating wounds that produce ragged edges. They are produced by a tremendous force against the body, either from an internal source as in childbirth, or from an external source like a punch. @@ -108,6 +153,15 @@ class ACE_Medical_Advanced { pain = 1; causes[] = {"punch"}; minDamage = 0.01; + class Minor { + minDamage = 0.1; + }; + class Medium { + minDamage = 0.5; + }; + class Large { + minDamage = 0.7; + }; }; // Also called velocity wounds, they are caused by an object entering the body at a high speed, typically a bullet or small peices of shrapnel. @@ -118,6 +172,15 @@ class ACE_Medical_Advanced { pain = 1; causes[] = {"bullet", "grenade","explosive", "shell"}; minDamage = 0.15; + class Minor { + minDamage = 0.15; + }; + class Medium { + minDamage = 0.3; + }; + class Large { + minDamage = 0.75; + }; }; // Deep, narrow wounds produced by sharp objects such as nails, knives, and broken glass. @@ -128,6 +191,15 @@ class ACE_Medical_Advanced { pain = 1; causes[] = {"stab", "grenade"}; minDamage = 0.01; + class Minor { + minDamage = 0.01; + }; + class Medium { + minDamage = 0.5; + }; + class Large { + minDamage = 0.65; + }; }; }; class fractures { diff --git a/addons/medical/functions/fnc_parseConfigForInjuries.sqf b/addons/medical/functions/fnc_parseConfigForInjuries.sqf index f285a88a0e..a028653df6 100644 --- a/addons/medical/functions/fnc_parseConfigForInjuries.sqf +++ b/addons/medical/functions/fnc_parseConfigForInjuries.sqf @@ -17,6 +17,24 @@ private ["_injuriesRootConfig", "_woundsConfig", "_allWoundClasses", "_amountOf" _injuriesRootConfig = (configFile >> "ACE_Medical_Advanced" >> "Injuries"); _allTypes = ["stab", "grenade", "bullet", "explosive", "shell", "punch", "vehiclecrash", "backblast", "falling", "bite", "ropeburn"]; +_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; +}; + _woundsConfig = (_injuriesRootConfig >> "wounds"); _allWoundClasses = []; if (isClass _woundsConfig) then { @@ -31,6 +49,9 @@ if (isClass _woundsConfig) then { _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 + + // 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]; };