mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
Added initial advanced medical handleDamage functionality.
This commit is contained in:
parent
a50276ddaf
commit
0a403ff422
30
addons/medical/functions/fnc_handleAirway.sqf
Normal file
30
addons/medical/functions/fnc_handleAirway.sqf
Normal file
@ -0,0 +1,30 @@
|
||||
/**
|
||||
* fn_assignAirwayStatus.sqf
|
||||
* @Descr: N/A
|
||||
* @Author: Glowbal
|
||||
*
|
||||
* @Arguments: []
|
||||
* @Return:
|
||||
* @PublicAPI: false
|
||||
*/
|
||||
|
||||
#include "script_component.hpp"
|
||||
|
||||
private ["_unit", "_selectionName", "_amountOfDamage", "_sourceOfDamage", "_typeOfDamage", "_bodyPartn"];
|
||||
_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);
|
||||
|
||||
// We process only the head for airway.
|
||||
if (_bodyPartn != 0) exitwith {};
|
||||
|
||||
if (_amountOfDamage > 0.4) then {
|
||||
if (random(1) >= 0.8) then {
|
||||
if !(_unit getvariable[QGVAR(airwayCollapsed), false]) then {
|
||||
_unit setvariable [QGVAR(airwayCollapsed), true, true];
|
||||
};
|
||||
};
|
||||
};
|
@ -0,0 +1,19 @@
|
||||
private ["_unit","_selectionName","_amountOfDamage","_sourceOfDamage","_typeOfProjectile","_typeOfDamage"];
|
||||
_unit = _this select 0;
|
||||
_selectionName = _this select 1;
|
||||
_amountOfDamage = _this select 2;
|
||||
_sourceOfDamage = _this select 3;
|
||||
_typeOfProjectile = _this select 4;
|
||||
_returnDamage = _this select 5;
|
||||
_typeOfDamage = _this select 6; //[_typeOfProjectile] call FUNC(getTypeOfDamage);
|
||||
|
||||
if (GVAR(enableAirway)) then {
|
||||
[_unit,_selectionName,_amountOfDamage,_sourceOfDamage, _typeOfDamage] call FUNC(handleAirway);
|
||||
};
|
||||
if (GVAR(enableFractures)) then {
|
||||
[_unit,_selectionName,_amountOfDamage,_sourceOfDamage, _typeOfDamage] call FUNC(handleFractures);
|
||||
};
|
||||
if (GVAR(enableInternalBleeding)) then {
|
||||
[_unit,_selectionName,_amountOfDamage,_sourceOfDamage, _typeOfDamage] call FUNC(handleInternalInjuries);
|
||||
};
|
||||
_returnDamage;
|
67
addons/medical/functions/fnc_handleFractures.sqf
Normal file
67
addons/medical/functions/fnc_handleFractures.sqf
Normal file
@ -0,0 +1,67 @@
|
||||
/**
|
||||
* fn_assignFractures.sqf
|
||||
* @Descr: N/A
|
||||
* @Author: Glowbal
|
||||
*
|
||||
* @Arguments: []
|
||||
* @Return:
|
||||
* @PublicAPI: false
|
||||
*/
|
||||
|
||||
#include "script_component.hpp"
|
||||
|
||||
private ["_unit", "_selectionName", "_amountOfDamage", "_sourceOfDamage", "_typeOfDamage", "_bodyPartn", "_fractures", "_fractureType"];
|
||||
_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);
|
||||
|
||||
_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"];
|
||||
_fractures = _unit getvariable[QGVAR(fractures), []];
|
||||
_fractureID = 1;
|
||||
_amountOf = count _fractures;
|
||||
if (_amountOf > 0) then {
|
||||
_fractureID = (_fractures select (_amountOf - 1) select 0) + 1;
|
||||
};
|
||||
_fractures pushback [_fractureID, _fractureType, _bodyPartn, 1 /* percentage treated */];
|
||||
_unit setvariable [GVAR(fractures), _fractures, true];
|
||||
};
|
21
addons/medical/functions/fnc_handleInternalInjuries.sqf
Normal file
21
addons/medical/functions/fnc_handleInternalInjuries.sqf
Normal file
@ -0,0 +1,21 @@
|
||||
/**
|
||||
* fn_assignFractures.sqf
|
||||
* @Descr: N/A
|
||||
* @Author: Glowbal
|
||||
*
|
||||
* @Arguments: []
|
||||
* @Return:
|
||||
* @PublicAPI: false
|
||||
*/
|
||||
|
||||
#include "script_component.hpp"
|
||||
|
||||
private ["_unit", "_selectionName", "_amountOfDamage", "_sourceOfDamage", "_typeOfDamage", "_bodyPartn"];
|
||||
_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);
|
||||
|
||||
// TODO implement internal injuries
|
13
addons/medical/functions/fnc_selectionNameToNumber.sqf
Normal file
13
addons/medical/functions/fnc_selectionNameToNumber.sqf
Normal file
@ -0,0 +1,13 @@
|
||||
/**
|
||||
* fn_getBodyPartNumber.sqf
|
||||
* @Descr: N/A
|
||||
* @Author: Glowbal
|
||||
*
|
||||
* @Arguments: []
|
||||
* @Return:
|
||||
* @PublicAPI: false
|
||||
*/
|
||||
|
||||
#include "script_component.hpp"
|
||||
|
||||
(["head","body","hand_l","hand_r","leg_l","leg_r"] find (_this select 0));
|
Loading…
Reference in New Issue
Block a user