ACE3/addons/medical/functions/fnc_handleDamage_fractures.sqf
Dedmen Miller e2ac18a05d [WIP] Fix script errors reporting wrong line numbers (#6407)
* advanced_ballistics

* advanced_fatigue

* advanced_throwing

* ai

* aircraft

* arsenal

* atragmx

* attach

* backpacks

* ballistics

* captives

* cargo

* chemlights

* common

* concertina_wire

* cookoff

* dagr

* disarming

* disposable

* dogtags

* dragging

* explosives

* fastroping

* fcs

* finger

* frag

* gestures

* gforces

* goggles

* grenades

* gunbag

* hearing

* hitreactions

* huntir

* interact_menu

* interaction

* inventory

* kestrel4500

* laser

* laserpointer

* logistics_uavbattery

* logistics_wirecutter

* magazinerepack

* map

* map_gestures

* maptools

* markers

* medical

* medical_ai

* medical_blood

* medical_menu

* microdagr

* minedetector

* missileguidance

* missionmodules

* mk6mortar

* modules

* movement

* nametags

* nightvision

* nlaw

* optics

* optionsmenu

* overheating

* overpressure

* parachute

* pylons

* quickmount

* rangecard

* rearm

* recoil

* refuel

* reload

* reloadlaunchers

* repair

* respawn

* safemode

* sandbag

* scopes

* slideshow

* spectator

* spottingscope

* switchunits

* tacticalladder

* tagging

* trenches

* tripod

* ui

* vector

* vehiclelock

* vehicles

* viewdistance

* weaponselect

* weather

* winddeflection

* yardage450

* zeus

* arsenal defines.hpp

* optionals

* DEBUG_MODE_FULL 1

* DEBUG_MODE_FULL 2

* Manual fixes

* Add SQF Validator check for #include after block comment

* explosives fnc_openTimerUI

* fix uniqueItems
2018-09-17 14:19:29 -05:00

71 lines
2.0 KiB
Plaintext

#include "script_component.hpp"
/*
* Author: Glowbal
* Handling of the fracture injuries upon the handleDamage eventhandler.
*
* 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>
*
* Example:
* [bob, "leg", 2, kevin, "shot"] call ACE_medical_fnc_handleDamage_fractures
*
* Public: No
*/
params ["_unit", "_selectionName", "_amountOfDamage", "_sourceOfDamage", "_typeOfDamage"];
private _bodyPartn = [_selectionName] call FUNC(selectionNameToNumber);
private _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 = _unit getVariable[QGVAR(fractures), []];
private _fractureID = 1;
private _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 [QGVAR(fractures), _fractures, true];
};