mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
e2ac18a05d
* 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
97 lines
3.4 KiB
Plaintext
97 lines
3.4 KiB
Plaintext
#include "script_component.hpp"
|
|
/*
|
|
* Author: Glowbal
|
|
* Translate selection names into medical usable hit selection names.
|
|
* Aims to deal with the new hitpoint system introduced in Arma3 v1.50 and later.
|
|
*
|
|
* Arguments:
|
|
* 0: Unit <OBJECT>
|
|
* 1: selection name <STRING>
|
|
* 2: HitPoint Index/True to get hitpoint <NUMBER><BOOL>
|
|
*
|
|
* Return Value:
|
|
* translated selection/hitpoint name <STRING>
|
|
*
|
|
* Example:
|
|
* [bob, "pelvis", 4] call ace_medical_fnc_translateSelections
|
|
* Returns "body"
|
|
*
|
|
* [bob, "body", true] call ace_medical_fnc_translateSelections
|
|
* Returns "HitBody"
|
|
*
|
|
* Public: No
|
|
*/
|
|
|
|
#define HEAD_SELECTIONS ["face_hub", "neck", "head"]
|
|
#define HEAD_HITPOINTS ["hitface", "hitneck", "hithead"]
|
|
#define TORSO_SELECTIONS ["pelvis", "spine1", "spine2", "spine3", "body"]
|
|
#define TORSO_HITPOINTS ["hitpelvis", "hitabdomen", "hitdiaphragm", "hitchest", "hitbody"]
|
|
#define L_ARM_SELECTIONS ["hand_l"]
|
|
#define L_ARM_HITPOINTS ["hitleftarm", "hand_l"]
|
|
#define R_ARM_SELECTIONS ["hand_r"]
|
|
#define R_ARM_HITPOINTS ["hitrightarm", "hand_r"]
|
|
#define L_LEG_SELECTIONS ["leg_l"]
|
|
#define L_LEG_HITPOINTS ["hitleftleg", "leg_l"]
|
|
#define R_LEG_SELECTIONS ["leg_r"]
|
|
#define R_LEG_HITPOINTS ["hitrightleg", "leg_r"]
|
|
|
|
params ["_unit", "_selection", "_hitPointIndex"];
|
|
|
|
if (_selection == "") exitWith {""};
|
|
|
|
//Get Selection from standard selection ["head","body","hand_l","hand_r","leg_l","leg_r"]
|
|
if (_hitPointIndex isEqualTo true) exitWith {
|
|
private _returnHitPoint = GVAR(HITPOINTS) select (GVAR(SELECTIONS) find _selection);
|
|
//If the selection is a valid hitpoint just return it:
|
|
if (!isNil {_unit getHitPointDamage _returnHitPoint}) exitWith {
|
|
_returnHitPoint;
|
|
};
|
|
|
|
//Those VR fuckers have weird limb hitpoints
|
|
private _hitPoints = switch (_selection) do {
|
|
case ("hand_l"): {L_ARM_HITPOINTS};
|
|
case ("hand_r"): {R_ARM_HITPOINTS};
|
|
case ("leg_l"): {L_LEG_HITPOINTS};
|
|
case ("leg_r"): {R_LEG_HITPOINTS};
|
|
case ("head"): {HEAD_HITPOINTS};
|
|
case ("body"): {TORSO_HITPOINTS};
|
|
default {[]};
|
|
};
|
|
{
|
|
if (!isNil {_unit getHitPointDamage _x}) exitWith {
|
|
_returnHitPoint = _x;
|
|
};
|
|
} forEach _hitPoints;
|
|
_returnHitPoint
|
|
};
|
|
|
|
|
|
//Get Selection from Selection/HitIndex:
|
|
|
|
if (_selection in HEAD_SELECTIONS) exitWith {"head"};
|
|
if (_selection in TORSO_SELECTIONS) exitWith {"body"};
|
|
|
|
// Not necessary unless we get more hitpoints variants in an next arma update
|
|
/*if (_selection in L_ARM_SELECTIONS) exitWith {"hand_l"};
|
|
if (_selection in R_ARM_SELECTIONS) exitWith {"hand_r"};
|
|
if (_selection in L_LEG_SELECTIONS) exitWith {"leg_l"};
|
|
if (_selection in R_LEG_SELECTIONS) exitWith {"leg_r"};*/
|
|
|
|
//Backup method to detect weird selections/hitpoints
|
|
if ((_selection == "?") || {!(_selection in GVAR(SELECTIONS))}) exitWith {
|
|
if (_hitPointIndex < 0) exitWith {_selection};
|
|
private _hitPoint = toLower configName ((configProperties [(configFile >> "CfgVehicles" >> (typeOf _unit) >> "HitPoints")]) select _hitPointIndex);
|
|
TRACE_4("Weird sel/hit", _unit, _selection, _hitPointIndex, _hitPoint);
|
|
|
|
if (_hitPoint in HEAD_HITPOINTS) exitWith {"head"};
|
|
if (_hitPoint in TORSO_HITPOINTS) exitWith {"body"};
|
|
if (_hitPoint in L_ARM_HITPOINTS) exitWith {"hand_l"};
|
|
if (_hitPoint in R_ARM_HITPOINTS) exitWith {"hand_r"};
|
|
if (_hitPoint in L_LEG_HITPOINTS) exitWith {"leg_l"};
|
|
if (_hitPoint in R_LEG_HITPOINTS) exitWith {"leg_r"};
|
|
|
|
_selection
|
|
};
|
|
|
|
_selection;
|