2015-02-08 09:01:32 +00:00
|
|
|
/*
|
|
|
|
* Author: Glowbal
|
|
|
|
* Handling of the fracture injuries upon the handleDamage eventhandler.
|
2015-02-03 20:48:08 +00:00
|
|
|
*
|
2015-02-08 09:01:32 +00:00
|
|
|
* Arguments:
|
|
|
|
* 0: Unit That Was Hit <OBJECT>
|
|
|
|
* 1: Name Of Hit Selection <STRING>
|
|
|
|
* 2: Amount Of Damage <NUMBER>
|
|
|
|
* 3: Shooter or source of the damage <OBJECT>
|
|
|
|
* 4: Type of the damage done <STRING>
|
|
|
|
*
|
|
|
|
* Return Value:
|
|
|
|
* None <NIL>
|
|
|
|
*
|
2017-06-08 13:31:51 +00:00
|
|
|
* Example:
|
|
|
|
* [bob, "leg", 2, kevin, "shot"] call ACE_medical_fnc_handleDamage_fractures
|
|
|
|
*
|
2015-02-08 09:01:32 +00:00
|
|
|
* Public: No
|
2015-02-03 20:48:08 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
#include "script_component.hpp"
|
|
|
|
|
2015-08-22 14:25:10 +00:00
|
|
|
private ["_bodyPartn", "_fractures", "_fractureType"];
|
|
|
|
params ["_unit", "_selectionName", "_amountOfDamage", "_sourceOfDamage", "_typeOfDamage"];
|
2015-02-03 20:48:08 +00:00
|
|
|
_bodyPartn = [_selectionName] call FUNC(selectionNameToNumber);
|
|
|
|
|
|
|
|
_fractureType = 1;
|
|
|
|
if (_amountOfDamage > 0.05) then {
|
|
|
|
|
|
|
|
// TODO specify fractures based off typeOfInjury details better.
|
|
|
|
switch (_typeOfDamage) do {
|
|
|
|
case "Bullet": {
|
|
|
|
_fractureType = round(random(2));
|
|
|
|
};
|
|
|
|
case "Grenade": {
|
|
|
|
_fractureType = round(random(2));
|
|
|
|
if (_fractureType < 1) then {
|
|
|
|
_fractureType = 1;
|
|
|
|
};
|
|
|
|
};
|
|
|
|
case "Explosive": {
|
|
|
|
_fractureType = round(random(2));
|
|
|
|
if (_fractureType < 1) then {
|
|
|
|
_fractureType = 1;
|
|
|
|
};
|
|
|
|
};
|
|
|
|
case "Shell": {
|
|
|
|
_fractureType = round(random(2));
|
|
|
|
if (_fractureType < 1) then {
|
|
|
|
_fractureType = 1;
|
|
|
|
};
|
|
|
|
};
|
|
|
|
case "Unknown": {
|
|
|
|
_fractureType = round(random(1));
|
|
|
|
};
|
|
|
|
case "VehicleCrash": {
|
|
|
|
_fractureType = round(random(0));
|
|
|
|
};
|
|
|
|
default {
|
|
|
|
_fractureType = round(random(1));
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
private ["_fractures", "_fractureID", "_amountOf"];
|
2015-11-30 16:27:09 +00:00
|
|
|
_fractures = _unit getVariable[QGVAR(fractures), []];
|
2015-02-03 20:48:08 +00:00
|
|
|
_fractureID = 1;
|
|
|
|
_amountOf = count _fractures;
|
|
|
|
if (_amountOf > 0) then {
|
|
|
|
_fractureID = (_fractures select (_amountOf - 1) select 0) + 1;
|
|
|
|
};
|
2015-11-30 16:21:28 +00:00
|
|
|
_fractures pushBack [_fractureID, _fractureType, _bodyPartn, 1 /* percentage treated */];
|
2015-11-30 16:27:09 +00:00
|
|
|
_unit setVariable [QGVAR(fractures), _fractures, true];
|
2015-03-21 09:54:52 +00:00
|
|
|
};
|