2015-02-07 22:48:24 +00:00
|
|
|
|
|
|
|
#include "script_component.hpp"
|
2015-02-07 23:07:49 +00:00
|
|
|
#define ADD_INJURY(BODYPART,TYPE,AMOUNT) _woundID = 1; \
|
|
|
|
_amountOf = count _openWounds; \
|
|
|
|
if (_amountOf > 0) then { _woundID = (_openWounds select (_amountOf - 1) select 0) + 1; }; \
|
|
|
|
for "_i" from 1 to AMOUNT /* step +1 */ do { \
|
|
|
|
_openWounds pushback [_woundID, _woundType, _bodyPartn, 1 /* percentage treated */]; \
|
|
|
|
_woundID = _woundID + 1; \
|
|
|
|
};
|
2015-02-07 22:48:24 +00:00
|
|
|
|
|
|
|
private ["_unit", "_selectionName", "_amountOfDamage", "_sourceOfDamage", "_typeOfDamage", "_bodyPartn", "_woundType"];
|
|
|
|
_unit = _this select 0;
|
|
|
|
_selectionName = _this select 1;
|
|
|
|
_amountOfDamage = _this select 2;
|
|
|
|
_sourceOfDamage = _this select 3;
|
|
|
|
_typeOfDamage = _this select 4;
|
|
|
|
_bodyPartn = [_selectionName] call FUNC(selectionNameToNumber);
|
|
|
|
|
|
|
|
_woundType = 1;
|
|
|
|
if (_amountOfDamage > 0.05) then {
|
2015-02-07 23:07:49 +00:00
|
|
|
private ["_wounds", "_woundID", "_amountOf"];
|
|
|
|
_openWounds = _unit getvariable[QGVAR(openWounds), []];
|
2015-02-07 22:48:24 +00:00
|
|
|
// TODO specify openWounds based off typeOfInjury details better.
|
2015-02-07 23:07:49 +00:00
|
|
|
switch (toLower _typeOfInjury) do {
|
|
|
|
case "bullet": {
|
|
|
|
ADD_INJURY(_bodyPartn, round(random(2)), 1);
|
|
|
|
};
|
|
|
|
case "grenade": {
|
|
|
|
ADD_INJURY(_bodyPartn, round(random(2)), 1);
|
|
|
|
for "_i" from 0 to round(random(3)) /* step +1 */ do {
|
|
|
|
ADD_INJURY(round(random(6)), round(random(2)), 1);
|
|
|
|
};
|
|
|
|
};
|
|
|
|
case "explosive": {
|
|
|
|
ADD_INJURY(_bodyPartn, round(random(2)), 1);
|
|
|
|
for "_i" from 0 to round(random(4)) /* step +1 */ do {
|
|
|
|
ADD_INJURY(round(random(6)), round(random(2)), 1);
|
2015-02-07 22:48:24 +00:00
|
|
|
};
|
|
|
|
};
|
2015-02-07 23:07:49 +00:00
|
|
|
case "shell": {
|
|
|
|
ADD_INJURY(_bodyPartn, round(random(2)), 1);
|
|
|
|
for "_i" from 0 to round(random(5)) /* step +1 */ do {
|
|
|
|
ADD_INJURY(round(random(6)), round(random(2)), 1);
|
2015-02-07 22:48:24 +00:00
|
|
|
};
|
|
|
|
};
|
2015-02-07 23:07:49 +00:00
|
|
|
case "backblast": {
|
|
|
|
if (random(1)>=0.5) then{
|
|
|
|
ADD_INJURY(_bodyPartn, round(random(2)), 1);
|
2015-02-07 22:48:24 +00:00
|
|
|
};
|
|
|
|
};
|
2015-02-07 23:07:49 +00:00
|
|
|
case "unknown": {
|
|
|
|
ADD_INJURY(_bodyPartn, round(random(1)), 1);
|
2015-02-07 22:48:24 +00:00
|
|
|
};
|
2015-02-07 23:07:49 +00:00
|
|
|
case "vehiclecrash": {
|
|
|
|
if (random(1)>=0.5) then{
|
|
|
|
ADD_INJURY(_bodyPartn, round(random(1)), 1);
|
|
|
|
};
|
2015-02-07 22:48:24 +00:00
|
|
|
};
|
|
|
|
default {
|
2015-02-07 23:07:49 +00:00
|
|
|
ADD_INJURY(_bodyPartn, round(random(1)), 1);
|
2015-02-07 22:48:24 +00:00
|
|
|
};
|
|
|
|
};
|
2015-02-07 23:07:49 +00:00
|
|
|
_unit setvariable [GVAR(openWounds), _openWounds, true];
|
|
|
|
};
|