Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add method to deal with new hitpoints #2813

Merged
merged 1 commit into from
Nov 2, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions addons/medical/XEH_preInit.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ PREP(setDead);
PREP(setHitPointDamage);
PREP(setStructuralDamage);
PREP(setUnconscious);
PREP(translateSelections);
PREP(treatment);
PREP(treatment_failure);
PREP(treatment_success);
Expand Down
7 changes: 7 additions & 0 deletions addons/medical/functions/fnc_handleDamage.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,13 @@ TRACE_3("ACE_DEBUG: HandleDamage",_selection,_damage,_unit);
if (_selection == "hands") exitWith {_unit getHit "hands"};
if (_selection == "legs") exitWith {_unit getHit "legs"};

// Deal with the new hitpoint and selection names introduced with Arma v1.50 and later.
// This will convert new selection names into selection names that the medical system understands
// TODO This should be cleaned up when we revisit the medical system at a later stage
// and instead we should deal with the new hitpoints directly
_selection = [_selection] call FUNC(translateSelections);
_this set [1, _selection]; // ensure that the parameters are set correctly

// If the damage is being weird, we just tell it to fuck off. Ignore: "hands", "legs", "?"
if (_selection != "" && {!(_selection in GVAR(SELECTIONS))}) exitWith {0}; //@todo "neck", "pelvis", "spine1", "spine2", "spine3"

Expand Down
37 changes: 37 additions & 0 deletions addons/medical/functions/fnc_translateSelections.sqf
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
/*
* 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: selection name <STRING>
*
* Return Value:
* translated selection name <STRING>
*
* Example:
* ["pelvis"] call ace_medical_fnc_translateSelections
* Returns "body"
*
* Public: No
*/

#define HEAD_SELECTIONS ["face_hub", "neck", "head"]
#define TORSO_SELECTIONS ["pelvis", "spine1", "spine2", "spine3", "body"]
#define L_ARM_SELECTIONS ["hand_l"]
#define R_ARM_SELECTIONS ["hand_r"]
#define L_LEG_SELECTIONS ["leg_l"]
#define R_LEG_SELECTIONS ["leg_r"]

params ["_selection"];

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"};*/

_selection;