Updated open wounds injuries to newest CMS version.

This commit is contained in:
Glowbal 2015-02-08 00:07:49 +01:00
parent aadb289962
commit b8be7775bd

View File

@ -1,5 +1,12 @@
#include "script_component.hpp"
#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; \
};
private ["_unit", "_selectionName", "_amountOfDamage", "_sourceOfDamage", "_typeOfDamage", "_bodyPartn", "_woundType"];
_unit = _this select 0;
@ -11,48 +18,47 @@ _bodyPartn = [_selectionName] call FUNC(selectionNameToNumber);
_woundType = 1;
if (_amountOfDamage > 0.05) then {
private ["_wounds", "_woundID", "_amountOf"];
_openWounds = _unit getvariable[QGVAR(openWounds), []];
// TODO specify openWounds based off typeOfInjury details better.
switch (_typeOfDamage) do {
case "Bullet": {
_woundType = round(random(2));
switch (toLower _typeOfInjury) do {
case "bullet": {
ADD_INJURY(_bodyPartn, round(random(2)), 1);
};
case "Grenade": {
_woundType = round(random(2));
if (_woundType < 1) then {
_woundType = 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": {
_woundType = round(random(2));
if (_woundType < 1) then {
_woundType = 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);
};
};
case "Shell": {
_woundType = round(random(2));
if (_woundType < 1) then {
_woundType = 1;
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);
};
};
case "Unknown": {
_woundType = round(random(1));
case "backblast": {
if (random(1)>=0.5) then{
ADD_INJURY(_bodyPartn, round(random(2)), 1);
};
};
case "VehicleCrash": {
_woundType = round(random(0));
case "unknown": {
ADD_INJURY(_bodyPartn, round(random(1)), 1);
};
case "vehiclecrash": {
if (random(1)>=0.5) then{
ADD_INJURY(_bodyPartn, round(random(1)), 1);
};
};
default {
_woundType = round(random(1));
ADD_INJURY(_bodyPartn, round(random(1)), 1);
};
};
private ["_wounds", "_woundID", "_amountOf"];
_wounds = _unit getvariable[QGVAR(openWounds), []];
_woundID = 1;
_amountOf = count _wounds;
if (_amountOf > 0) then {
_woundID = (_wounds select (_amountOf - 1) select 0) + 1;
};
_wounds pushback [_woundID, _woundType, _bodyPartn, 1 /* percentage treated */];
_unit setvariable [GVAR(openWounds), _wounds, true];
};
_unit setvariable [GVAR(openWounds), _openWounds, true];
};