mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
Added minimum lethal damage for injury types in adv medical
This commit is contained in:
parent
b267a52ec6
commit
57b093f845
@ -443,6 +443,8 @@ class ACE_Medical_Advanced {
|
||||
class damageTypes {
|
||||
thresholds[] = {{0.1, 1}};
|
||||
selectionSpecific = 1;
|
||||
lethalDamage = 0.01;
|
||||
|
||||
class bullet {
|
||||
// above damage, amount. Put the highest threshold to the left and lower the threshold with the elements to the right of it.
|
||||
thresholds[] = {{0.1, 1}};
|
||||
@ -465,8 +467,9 @@ class ACE_Medical_Advanced {
|
||||
selectionSpecific = 0;
|
||||
};
|
||||
class backblast {
|
||||
thresholds[] = {{0.25, 5}};
|
||||
thresholds[] = {{0, 2},{0.55, 5}, {1, 6}};
|
||||
selectionSpecific = 0;
|
||||
lethalDamage = 1;
|
||||
};
|
||||
class stab {
|
||||
thresholds[] = {{0.1, 1}};
|
||||
|
@ -24,6 +24,7 @@ _damage = _this select 2;
|
||||
_shooter = _this select 3;
|
||||
_projectile = _this select 4;
|
||||
|
||||
|
||||
if !(local _unit) exitWith {nil};
|
||||
|
||||
if !([_unit] call FUNC(hasMedicalEnabled)) exitwith {};
|
||||
@ -46,12 +47,17 @@ if (GVAR(level) >= 2) then {
|
||||
[_unit, _selection, _damage, _source, _projectile, _damageReturn] call FUNC(handleDamage_caching);
|
||||
|
||||
if (_damageReturn > 0.9) then {
|
||||
|
||||
_typeOfDamage = [_projectile] call FUNC(getTypeOfDamage);
|
||||
_minLethalDamage = GVAR(minLethalDamages) select (GVAR(allAvailableDamageTypes) find _typeOfDamage);
|
||||
|
||||
_hitPoints = ["HitHead", "HitBody", "HitLeftArm", "HitRightArm", "HitLeftLeg", "HitRightLeg"];
|
||||
_newDamage = _damage - (damage _unit);
|
||||
if (_selection in _hitSelections) then {
|
||||
_newDamage = _damage - (_unit getHitPointDamage (_hitPoints select (_hitSelections find _selection)));
|
||||
};
|
||||
if ([_unit, [_selection] call FUNC(selectionNameToNumber), _newDamage] call FUNC(determineIfFatal)) then {
|
||||
|
||||
if ((_minLethalDamage <= _newDamage) && {[_unit, [_selection] call FUNC(selectionNameToNumber), _newDamage] call FUNC(determineIfFatal)}) then {
|
||||
if ([_unit] call FUNC(setDead)) then {
|
||||
_damageReturn = 1;
|
||||
};
|
||||
|
@ -12,25 +12,35 @@
|
||||
|
||||
#include "script_component.hpp"
|
||||
|
||||
private ["_injuriesRootConfig", "_woundsConfig", "_allWoundClasses", "_amountOf", "_entry","_classType", "_selections", "_bloodLoss", "_pain","_minDamage","_causes", "_allTypes", "_damageTypesConfig", "_thresholds", "_typeThresholds", "_selectionSpecific", "_selectionSpecificType", "_classDisplayName", "_subClassDisplayName", "_maxDamage", "_subClassmaxDamage"];
|
||||
private ["_injuriesRootConfig", "_woundsConfig", "_allWoundClasses", "_amountOf", "_entry","_classType", "_selections", "_bloodLoss", "_pain","_minDamage","_causes", "_allTypes", "_damageTypesConfig", "_thresholds", "_typeThresholds", "_selectionSpecific", "_selectionSpecificType", "_classDisplayName", "_subClassDisplayName", "_maxDamage", "_subClassmaxDamage", "_defaultMinLethalDamage", "_minLethalDamage"];
|
||||
|
||||
_injuriesRootConfig = (configFile >> "ACE_Medical_Advanced" >> "Injuries");
|
||||
_allTypes = ["stab", "grenade", "bullet", "explosive", "shell", "punch", "vehiclecrash", "backblast", "falling", "bite", "ropeburn"];
|
||||
|
||||
// Collect all available damage types from the config
|
||||
_allFoundDamageTypes = [];
|
||||
_configDamageTypes = (_injuriesRootConfig >> "damageTypes");
|
||||
|
||||
// minimum lethal damage collection, mapped to damageTypes
|
||||
_defaultMinLethalDamage = getNumber (_configDamageTypes >> "lethalDamage");
|
||||
GVAR(minLethalDamages) = [];
|
||||
|
||||
// Collect all available damage types from the config
|
||||
for "_i" from 0 to (count _configDamageTypes -1) /* step +1 */ do {
|
||||
// Only get the subclasses in damageType class
|
||||
if (isClass(_configDamageTypes select _i)) then {
|
||||
_allFoundDamageTypes pushback (configName (_configDamageTypes select _i));
|
||||
_minLethalDamage = if (isNumber((_configDamageTypes select _i) >> "lethalDamage")) then {
|
||||
getNumber((_configDamageTypes select _i) >> "lethalDamage");
|
||||
} else {
|
||||
_defaultMinLethalDamage
|
||||
};
|
||||
|
||||
GVAR(minLethalDamages) pushback _minLethalDamage;
|
||||
};
|
||||
};
|
||||
GVAR(allAvailableDamageTypes) = _allFoundDamageTypes;
|
||||
GVAR(woundClassNames) = [];
|
||||
GVAR(fractureClassNames) = [];
|
||||
|
||||
|
||||
// Parsing the wounds
|
||||
// function for parsing a sublcass of an injury
|
||||
_parseForSubClassWounds = {
|
||||
|
Loading…
Reference in New Issue
Block a user